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));
}
}
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);
}
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());
}
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);
}
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);
}
}
Aggregations