Search in sources :

Example 11 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard in project sling by apache.

the class OakSlingRepositoryManager method acquireRepository.

@Override
protected Repository acquireRepository() {
    final BundleContext bundleContext = componentContext.getBundleContext();
    final Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
    this.indexProvider.start(whiteboard);
    this.indexEditorProvider.start(whiteboard);
    this.oakExecutorServiceReference = bundleContext.registerService(Executor.class.getName(), new Executor() {

        @Override
        public void execute(Runnable command) {
            threadPool.execute(command);
        }
    }, new Hashtable<String, Object>());
    final Oak oak = new Oak(nodeStore).withAsyncIndexing("async", 5);
    final Jcr jcr = new Jcr(oak, false).with(new InitialContent()).with(new ExtraSlingContent()).with(JcrConflictHandler.createJcrConflictHandler()).with(new VersionHook()).with(securityProvider).with(new NameValidatorProvider()).with(new NamespaceEditorProvider()).with(new TypeEditorProvider()).with(new ConflictValidatorProvider()).with(indexProvider).with(indexEditorProvider).with(getDefaultWorkspace()).with(whiteboard).withFastQueryResultSize(true).withObservationQueueLength(configuration.oak_observation_queue_length());
    if (commitRateLimiter != null) {
        jcr.with(commitRateLimiter);
    }
    jcr.createContentRepository();
    return new TcclWrappingJackrabbitRepository((JackrabbitRepository) jcr.createRepository());
}
Also used : NamespaceEditorProvider(org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider) Hashtable(java.util.Hashtable) VersionHook(org.apache.jackrabbit.oak.plugins.version.VersionHook) NameValidatorProvider(org.apache.jackrabbit.oak.plugins.name.NameValidatorProvider) ConflictValidatorProvider(org.apache.jackrabbit.oak.plugins.commit.ConflictValidatorProvider) InitialContent(org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent) Executor(java.util.concurrent.Executor) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) TypeEditorProvider(org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider) Oak(org.apache.jackrabbit.oak.Oak) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) BundleContext(org.osgi.framework.BundleContext)

Example 12 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard in project jackrabbit-oak by apache.

the class DocumentNodeStoreService method activate.

@Activate
protected void activate(ComponentContext context, Map<String, ?> config) throws Exception {
    closer = Closer.create();
    this.context = context;
    whiteboard = new OsgiWhiteboard(context.getBundleContext());
    executor = new WhiteboardExecutor();
    executor.start(whiteboard);
    maxReplicationLagInSecs = toLong(config.get(PROP_REPLICATION_LAG), DEFAULT_MAX_REPLICATION_LAG);
    customBlobStore = toBoolean(prop(CUSTOM_BLOB_STORE), false);
    documentStoreType = DocumentStoreType.fromString(PropertiesUtil.toString(config.get(PROP_DS_TYPE), "MONGO"));
    registerNodeStoreIfPossible();
}
Also used : OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) WhiteboardExecutor(org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor) Activate(org.apache.felix.scr.annotations.Activate)

Example 13 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard in project jackrabbit-oak by apache.

the class SecondaryStoreCacheService method activate.

@Activate
private void activate(BundleContext context, Map<String, Object> config) {
    bundleContext = context;
    whiteboard = new OsgiWhiteboard(context);
    String[] includedPaths = toStringArray(config.get(PROP_INCLUDES), new String[] { "/" });
    //TODO Support for exclude is not possible as once a NodeState is loaded from secondary
    //store it assumes that complete subtree is in same store. With exclude it would need to
    //check for each child access and route to primary
    pathFilter = new PathFilter(asList(includedPaths), Collections.<String>emptyList());
    SecondaryStoreBuilder builder = new SecondaryStoreBuilder(secondaryStoreProvider.getNodeStore()).differ(differ).metaPropNames(DocumentNodeStore.META_PROP_NAMES).statisticsProvider(statisticsProvider).pathFilter(pathFilter);
    SecondaryStoreCache cache = builder.buildCache();
    SecondaryStoreObserver observer = builder.buildObserver(cache);
    registerObserver(observer, config);
    regs.add(bundleContext.registerService(DocumentNodeStateCache.class.getName(), cache, null));
//TODO Need to see OSGi dynamics. Its possible that DocumentNodeStore works after the cache
//gets deregistered but the SegmentNodeState instances might still be in use and that would cause
//failure
}
Also used : PathFilter(org.apache.jackrabbit.oak.plugins.index.PathFilter) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Activate(org.apache.felix.scr.annotations.Activate)

Example 14 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard in project jackrabbit-oak by apache.

the class SecurityProviderImpl method activate.

protected void activate(BundleContext context) {
    whiteboard = new OsgiWhiteboard(context);
    authorizableActionProvider.start(whiteboard);
    authorizableNodeName.start(whiteboard);
    restrictionProvider.start(whiteboard);
    userAuthenticationFactory.start(whiteboard);
    initializeConfigurations();
}
Also used : OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)

Example 15 with OsgiWhiteboard

use of org.apache.jackrabbit.oak.osgi.OsgiWhiteboard in project jackrabbit-oak by apache.

the class ExternalLoginModuleFactory method mayRegisterSyncMBean.

private void mayRegisterSyncMBean() {
    log.debug("Trying to register SynchronizationMBean");
    if (mbeanRegistration != null) {
        log.debug("SynchronizationMBean already registered");
        return;
    }
    if (bundleContext == null) {
        log.debug("Cannot register SynchronizationMBean; not yet activated.");
        return;
    }
    if (contentRepository == null || securityProvider == null) {
        log.debug("Cannot register SynchronizationMBean; waiting for references to ContentRepository|SecurityProvider.");
        return;
    }
    Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
    try {
        log.debug("Registering SynchronizationMBean");
        String idpName = osgiConfig.getConfigValue(PARAM_IDP_NAME, "");
        String sncName = osgiConfig.getConfigValue(PARAM_SYNC_HANDLER_NAME, "");
        SyncMBeanImpl bean = new SyncMBeanImpl(contentRepository, securityProvider, syncManager, sncName, idpManager, idpName);
        Hashtable<String, String> table = new Hashtable();
        table.put("type", "UserManagement");
        table.put("name", "External Identity Synchronization Management");
        table.put("handler", ObjectName.quote(sncName));
        table.put("idp", ObjectName.quote(idpName));
        mbeanRegistration = whiteboard.register(SynchronizationMBean.class, bean, ImmutableMap.of("jmx.objectname", new ObjectName("org.apache.jackrabbit.oak", table)));
        log.debug("Registration of SynchronizationMBean completed");
    } catch (MalformedObjectNameException e) {
        log.error("Unable to register SynchronizationMBean", e);
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Hashtable(java.util.Hashtable) SynchronizationMBean(org.apache.jackrabbit.oak.spi.security.authentication.external.impl.jmx.SynchronizationMBean) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) SyncMBeanImpl(org.apache.jackrabbit.oak.spi.security.authentication.external.impl.jmx.SyncMBeanImpl) ObjectName(javax.management.ObjectName)

Aggregations

OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)19 Activate (org.apache.felix.scr.annotations.Activate)15 Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)9 WhiteboardExecutor (org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor)3 Hashtable (java.util.Hashtable)2 CacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean)2 BundleContext (org.osgi.framework.BundleContext)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Executor (java.util.concurrent.Executor)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1 Oak (org.apache.jackrabbit.oak.Oak)1 ConsolidatedCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.ConsolidatedCacheStatsMBean)1 ConsolidatedDataStoreCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.ConsolidatedDataStoreCacheStatsMBean)1 PersistentCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean)1 S3DataStoreStatsMBean (org.apache.jackrabbit.oak.blob.cloud.s3.stats.S3DataStoreStatsMBean)1 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)1