-
Notifications
You must be signed in to change notification settings - Fork 349
Working impl of HK2 dependency injection #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
795416d
8361fd8
578ff76
7df1038
ab1e19d
ccb710f
e01a66a
080113e
c4950ae
9763f0b
46abf02
89d2e2b
025c992
9e09e03
88b960e
73ca1ed
2f60a7b
43640c3
a3d6141
5b2182d
25e130c
e7928fc
492f3bf
705221c
2587138
2190330
30a404a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,11 +16,16 @@ | |||||
| * specific language governing permissions and limitations | ||||||
| * under the License. | ||||||
| */ | ||||||
| package org.apache.polaris.service.tracing; | ||||||
| package org.apache.polaris.core.context; | ||||||
|
|
||||||
| import io.opentelemetry.api.OpenTelemetry; | ||||||
| import jakarta.inject.Scope; | ||||||
| import java.lang.annotation.Documented; | ||||||
| import java.lang.annotation.ElementType; | ||||||
| import java.lang.annotation.Retention; | ||||||
| import java.lang.annotation.Target; | ||||||
|
|
||||||
| /** Allows setting a configured instance of {@link OpenTelemetry} */ | ||||||
| public interface OpenTelemetryAware { | ||||||
| void setOpenTelemetry(OpenTelemetry openTelemetry); | ||||||
| } | ||||||
| @Scope | ||||||
collado-mike marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| @Documented | ||||||
| @Retention(java.lang.annotation.RetentionPolicy.RUNTIME) | ||||||
| @Target({ElementType.TYPE, ElementType.METHOD}) | ||||||
|
||||||
| @Target({ElementType.TYPE, ElementType.METHOD}) | |
| @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm - right now, the bean scope is defined at either the factory or the bean class itself. I don't know that the dependents ought to decide the scope of the bean its depending on
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public @interface RealmScope {} | |
| public @interface RealmScope extends AlterableContext {} |
And have functionality to perform cleanup when a realm is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, that's not in the jakarta cdi api jar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jakarta.enterprise.context.spi.AlterableContext
collado-mike marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,11 +51,14 @@ public class PolarisEntityManager { | |
| /** | ||
| * @param metaStoreManager the metastore manager for the current realm | ||
| * @param credentialCache the storage credential cache for the current realm | ||
| * @param entityCache the entity cache | ||
| */ | ||
| public PolarisEntityManager( | ||
| PolarisMetaStoreManager metaStoreManager, StorageCredentialCache credentialCache) { | ||
| PolarisMetaStoreManager metaStoreManager, | ||
|
||
| StorageCredentialCache credentialCache, | ||
| EntityCache entityCache) { | ||
| this.metaStoreManager = metaStoreManager; | ||
| this.entityCache = new EntityCache(metaStoreManager); | ||
| this.entityCache = entityCache; | ||
| this.credentialCache = credentialCache; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,17 +23,20 @@ | |
| import com.github.benmanes.caffeine.cache.RemovalListener; | ||
| import jakarta.annotation.Nonnull; | ||
| import jakarta.annotation.Nullable; | ||
| import jakarta.inject.Inject; | ||
| import java.util.AbstractMap; | ||
| import java.util.List; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import java.util.concurrent.TimeUnit; | ||
| import org.apache.polaris.core.PolarisCallContext; | ||
| import org.apache.polaris.core.context.RealmScope; | ||
| import org.apache.polaris.core.entity.PolarisBaseEntity; | ||
| import org.apache.polaris.core.entity.PolarisEntityType; | ||
| import org.apache.polaris.core.entity.PolarisGrantRecord; | ||
| import org.apache.polaris.core.persistence.cache.PolarisRemoteCache.CachedEntryResult; | ||
|
|
||
| /** The entity cache, can be private or shared */ | ||
| @RealmScope | ||
|
||
| public class EntityCache { | ||
|
|
||
| // cache mode | ||
|
|
@@ -53,6 +56,7 @@ public class EntityCache { | |
| * | ||
| * @param polarisRemoteCache the meta store manager implementation | ||
| */ | ||
| @Inject | ||
| public EntityCache(@Nonnull PolarisRemoteCache polarisRemoteCache) { | ||
|
|
||
| // by name cache | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,9 +25,7 @@ | |
| import org.apache.polaris.core.PolarisConfigurationStore; | ||
| import org.apache.polaris.core.auth.PolarisSecretsManager.PrincipalSecretsResult; | ||
| import org.apache.polaris.core.persistence.MetaStoreManagerFactory; | ||
| import org.apache.polaris.service.config.ConfigurationStoreAware; | ||
| import org.apache.polaris.service.config.PolarisApplicationConfig; | ||
| import org.apache.polaris.service.context.CallContextResolver; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
|
|
@@ -48,17 +46,11 @@ protected void run( | |
| Bootstrap<PolarisApplicationConfig> bootstrap, | ||
| Namespace namespace, | ||
| PolarisApplicationConfig configuration) { | ||
| MetaStoreManagerFactory metaStoreManagerFactory = configuration.getMetaStoreManagerFactory(); | ||
| MetaStoreManagerFactory metaStoreManagerFactory = | ||
|
||
| configuration.findService(MetaStoreManagerFactory.class); | ||
|
|
||
| PolarisConfigurationStore configurationStore = configuration.getConfigurationStore(); | ||
| if (metaStoreManagerFactory instanceof ConfigurationStoreAware) { | ||
| ((ConfigurationStoreAware) metaStoreManagerFactory).setConfigurationStore(configurationStore); | ||
| } | ||
| CallContextResolver callContextResolver = configuration.getCallContextResolver(); | ||
| callContextResolver.setMetaStoreManagerFactory(metaStoreManagerFactory); | ||
| if (callContextResolver instanceof ConfigurationStoreAware csa) { | ||
| csa.setConfigurationStore(configurationStore); | ||
| } | ||
| PolarisConfigurationStore configurationStore = | ||
| configuration.findService(PolarisConfigurationStore.class); | ||
|
|
||
| // Execute the bootstrap | ||
| Map<String, PrincipalSecretsResult> results = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.