use of org.osgi.service.component.annotations.Activate in project sling by apache.
the class WiserSmtpService method activate.
@Activate
public void activate(final WiserSmtpServiceConfiguration configuration) throws Exception {
wiser = new Wiser(configuration.smtpPort());
wiser.start();
}
use of org.osgi.service.component.annotations.Activate in project sling by apache.
the class SetupService method activate.
@Activate
protected void activate(final BundleContext bc) throws IOException, LoginException, PersistenceException, RepositoryException {
logger.info("Setting up SlingShot...");
ResourceResolver resolver = null;
try {
resolver = this.factory.getServiceResourceResolver(null);
setupContent(resolver);
} finally {
if (resolver != null) {
resolver.close();
}
}
logger.info("Finished setting up SlingShot");
}
use of org.osgi.service.component.annotations.Activate in project sling by apache.
the class SystemPropertyConfigurationOverrideProvider method activate.
@Activate
void activate(Config config) {
List<String> overrides = new ArrayList<>();
if (config.enabled()) {
Properties properties = System.getProperties();
Enumeration<Object> keys = properties.keys();
while (keys.hasMoreElements()) {
Object keyObject = keys.nextElement();
if (keyObject instanceof String) {
String key = (String) keyObject;
if (StringUtils.startsWith(key, SYSTEM_PROPERTY_PREFIX)) {
overrides.add(StringUtils.substringAfter(key, SYSTEM_PROPERTY_PREFIX) + "=" + System.getProperty(key));
}
}
}
}
this.overrideStrings = overrides;
}
use of org.osgi.service.component.annotations.Activate in project sling by apache.
the class JobManagerConfiguration method activate.
/**
* Activate this component.
* @param props Configuration properties
* @param config Configuration properties
* @throws RuntimeException If the default paths can't be created
*/
@Activate
protected void activate(final Map<String, Object> props, final Config config) {
this.update(props, config);
this.jobsBasePathWithSlash = PropertiesUtil.toString(props.get(PROPERTY_REPOSITORY_PATH), DEFAULT_REPOSITORY_PATH) + '/';
// create initial resources
this.assignedJobsPath = this.jobsBasePathWithSlash + "assigned";
this.unassignedJobsPath = this.jobsBasePathWithSlash + "unassigned";
this.localJobsPath = this.assignedJobsPath.concat("/").concat(Environment.APPLICATION_ID);
this.localJobsPathWithSlash = this.localJobsPath.concat("/");
this.previousVersionAnonPath = this.jobsBasePathWithSlash + "anon";
this.previousVersionIdentifiedPath = this.jobsBasePathWithSlash + "identified";
this.storedCancelledJobsPath = this.jobsBasePathWithSlash + "cancelled";
this.storedSuccessfulJobsPath = this.jobsBasePathWithSlash + "finished";
this.scheduledJobsPath = PropertiesUtil.toString(props.get(PROPERTY_SCHEDULED_JOBS_PATH), DEFAULT_SCHEDULED_JOBS_PATH);
this.scheduledJobsPathWithSlash = this.scheduledJobsPath + "/";
// create initial resources
final ResourceResolver resolver = this.createResourceResolver();
try {
ResourceHelper.getOrCreateBasePath(resolver, this.getLocalJobsPath());
ResourceHelper.getOrCreateBasePath(resolver, this.getUnassignedJobsPath());
} catch (final PersistenceException pe) {
logger.error("Unable to create default paths: " + pe.getMessage(), pe);
throw new RuntimeException(pe);
} finally {
resolver.close();
}
this.active.set(true);
// SLING-5560 : use an InitDelayingTopologyEventListener
if (this.startupDelay > 0) {
logger.debug("activate: job manager will start in {} sec. ({})", this.startupDelay, config.startup_delay());
this.startupDelayListener = new InitDelayingTopologyEventListener(startupDelay, new TopologyEventListener() {
@Override
public void handleTopologyEvent(TopologyEvent event) {
doHandleTopologyEvent(event);
}
}, logger);
} else {
logger.debug("activate: job manager will start without delay. ({}:{})", config.startup_delay(), this.startupDelay);
}
}
use of org.osgi.service.component.annotations.Activate in project sling by apache.
the class ActiveMQConnectionFactoryService method activate.
@Activate
public void activate(Config config) {
pooledConnectionFactory = new PooledConnectionFactory(config.jms_brokerUri());
pooledConnectionFactory.start();
}
Aggregations