Search in sources :

Example 16 with Whiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.

the class NodeStateSolrServersObserverService method activate.

@Activate
protected void activate(ComponentContext componentContext) throws Exception {
    boolean enabled = PropertiesUtil.toBoolean(componentContext.getProperties().get(ENABLED), false);
    if (enabled) {
        BundleContext bundleContext = componentContext.getBundleContext();
        Whiteboard whiteboard = new OsgiWhiteboard(bundleContext);
        executor = new WhiteboardExecutor();
        executor.start(whiteboard);
        backgroundObserver = new BackgroundObserver(nodeStateSolrServersObserver, executor, 5);
        regs.add(bundleContext.registerService(Observer.class.getName(), backgroundObserver, null));
    }
}
Also used : BackgroundObserver(org.apache.jackrabbit.oak.spi.commit.BackgroundObserver) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) WhiteboardExecutor(org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardExecutor) OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) BundleContext(org.osgi.framework.BundleContext) Activate(org.apache.felix.scr.annotations.Activate)

Example 17 with Whiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.

the class AuthenticationConfigurationImpl method getLoginContextProvider.

//----------------------------------------< AuthenticationConfiguration >---
/**
     * Create a {@code LoginContextProvider} using standard
     * {@link javax.security.auth.login.Configuration#getConfiguration() JAAS}
     * functionality. In case no login configuration for the specified app name
     * can be retrieve this implementation uses the default as defined by
     * {@link org.apache.jackrabbit.oak.spi.security.authentication.ConfigurationUtil#getDefaultConfiguration(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)}.
     * <p>
     * The {@link LoginContextProvider} implementation is intended to be used with
     * <ul>
     *     <li>Regular login using JAAS {@link javax.security.auth.spi.LoginModule} or</li>
     *     <li>Pre-authenticated subjects in which case any authentication
     *     related validation is omitted</li>
     * </ul>
     *
     * <h3>Configuration Options</h3>
     * <ul>
     *     <li>{@link #PARAM_APP_NAME}: The appName passed to
     *     {@code Configuration#getAppConfigurationEntry(String)}. The default
     *     value is {@link #DEFAULT_APP_NAME}.</li>
     * </ul>
     *
     * @param contentRepository The content repository.
     * @return An new instance of {@link LoginContextProvider}.
     */
@Nonnull
@Override
public LoginContextProvider getLoginContextProvider(ContentRepository contentRepository) {
    String appName = getParameters().getConfigValue(PARAM_APP_NAME, DEFAULT_APP_NAME);
    SecurityProvider provider = getSecurityProvider();
    Whiteboard whiteboard = null;
    if (provider instanceof WhiteboardAware) {
        whiteboard = ((WhiteboardAware) provider).getWhiteboard();
    } else {
        log.warn("Unable to obtain whiteboard from SecurityProvider");
    }
    return new LoginContextProviderImpl(appName, getParameters(), contentRepository, getSecurityProvider(), whiteboard);
}
Also used : WhiteboardAware(org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardAware) SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) Nonnull(javax.annotation.Nonnull)

Example 18 with Whiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard 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 19 with Whiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard in project jackrabbit-oak by apache.

the class NodeStoreFixtureProvider method create.

public static NodeStoreFixture create(Options options, boolean readOnly) throws Exception {
    CommonOptions commonOpts = options.getOptionBean(CommonOptions.class);
    Whiteboard wb = options.getWhiteboard();
    Closer closer = Closer.create();
    BlobStoreFixture blobFixture = BlobStoreFixtureProvider.create(options);
    BlobStore blobStore = null;
    if (blobFixture != null) {
        blobStore = blobFixture.getBlobStore();
        closer.register(blobFixture);
    }
    StatisticsProvider statisticsProvider = createStatsProvider(options, wb, closer);
    wb.register(StatisticsProvider.class, statisticsProvider, Collections.emptyMap());
    NodeStore store;
    if (commonOpts.isMongo() || commonOpts.isRDB()) {
        store = configureDocumentMk(options, blobStore, statisticsProvider, closer, wb, readOnly);
    } else {
        store = configureSegment(options, blobStore, statisticsProvider, closer, readOnly);
    }
    return new SimpleNodeStoreFixture(store, blobStore, wb, closer);
}
Also used : Closer(com.google.common.io.Closer) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MetricStatisticsProvider(org.apache.jackrabbit.oak.plugins.metric.MetricStatisticsProvider) StatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider) Whiteboard(org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore)

Example 20 with Whiteboard

use of org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard 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

Whiteboard (org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard)25 DefaultWhiteboard (org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard)11 Test (org.junit.Test)10 OsgiWhiteboard (org.apache.jackrabbit.oak.osgi.OsgiWhiteboard)9 Activate (org.apache.felix.scr.annotations.Activate)7 Oak (org.apache.jackrabbit.oak.Oak)3 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)3 Closeable (java.io.Closeable)2 Hashtable (java.util.Hashtable)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Repository (javax.jcr.Repository)2 ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)2 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)2 CacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean)2 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)2 LongPropertyState (org.apache.jackrabbit.oak.plugins.memory.LongPropertyState)2 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)2 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)2 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)2 BundleContext (org.osgi.framework.BundleContext)2