@Activate protected void activate(ComponentContext ctx) { bctx = ctx.getBundleContext(); ignored_bundles = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_IGNORED_BUNDLES)); if (ignored_bundles != null ) { log.info ("Ignoring bundles {}", ignored_bundles.toString()); } }
@Activate public void activate(ComponentContext context) { this.path = (String) context.getProperties().get(ReasoningService.SERVICE_PATH); } }
@Activate protected void activate(BundleContext context, Map<String, Object> config) { username = PropertiesUtil.toString(config.get(USERNAME), "").trim(); password = PropertiesUtil.toString(config.get(PASSWORD), "").trim(); String id = String.valueOf(username.hashCode()); Dictionary<String, String> mbeanProps = new Hashtable<String, String>(); mbeanProps.put("jmx.objectname", "org.apache.sling.distribution:type=transport,id=" + ObjectName.quote(id)); UserCredentialsDistributionTransportSecretMBean mbean = new UserCredentialsDistributionTransportSecretMBeanImpl(username); mbeanServiceRegistration = context.registerService(UserCredentialsDistributionTransportSecretMBean.class.getName(), mbean, mbeanProps); }
@Activate protected void activate(BundleContext context) { if(ServerConstants.IS_KARAF) { logger.info("Registering Jabylon JaasRealm in Karaf"); context.registerService(JaasRealm.class, new JabylonJaasRealmService(), null); } }
@Activate public void activate(ComponentContext context) throws Exception { context.getBundleContext().addBundleListener(this); path = PropertiesUtil.toString(context.getProperties().get(PROP_CONFIGURATION_I18N_PATH), DEFAULT_CONFIGURATION_I18N_PATH); int ignored = 0; try { Bundle[] bundles = context.getBundleContext().getBundles(); for (int i=0;i<bundles.length; i++) { Bundle bundle = bundles[i];
@Activate void activate(ComponentContext componentContext) throws IOException, BundleException { // Use system bundle' bundle context to avoid running into // "Invalid BundleContext" exceptions when updating bundles BundleContext bundleContext = componentContext.getBundleContext().getBundle(0).getBundleContext(); File karafHome = new File(bundleContext.getProperty("karaf.home")); helper = new OSGiPatchHelper(karafHome, bundleContext); }
@Activate public void activate(ComponentContext ctx) { URL url = ctx.getBundleContext().getBundle().getResource(TEMPLATE_FILENAME); if (url == null) { LOG.error("File " + TEMPLATE_FILENAME + " not found in bundle."); return; } readTemplateFromUrl(url); }
@Activate protected void activate(final ComponentContext context) { resourceProvidingBundles = new HashSet<Bundle>(); path2Bundle = new HashMap<String, Bundle>(); final Bundle[] registeredBundles = context.getBundleContext().getBundles(); for (int i = 0; i < registeredBundles.length; i++) { if (registeredBundles[i].getState() == Bundle.ACTIVE) { registerResources(registeredBundles[i]); } } context.getBundleContext().addBundleListener(this); }
@Activate protected void activate(ComponentContext ctx) { BundleContext bundleContext = ctx.getBundleContext(); // this is less than ideal, but there's no better way to get to the fs classloader's data directory for (Bundle bundle : bundleContext.getBundles()) { if (bundle.getSymbolicName().equals("org.apache.sling.commons.fsclassloader")) { this.fileRoot = new File(slingSettingsService.getSlingHomePath(), "launchpad/felix/bundle" + bundle.getBundleId() + "/data/classes"); break; } } } }
@Activate protected void activate(final ComponentContext cc) { port = cc.getBundleContext().getProperty("org.osgi.service.http.port"); }
@Activate protected void activate(ComponentContext ctx) throws InvalidSyntaxException { BundleContext bundleContext = ctx.getBundleContext(); StringBuilder builder = new StringBuilder(); builder.append("(&("); builder.append(Constants.OBJECTCLASS).append("=").append(Importer.SERVICE_NAME).append(")"); builder.append("(displayName=*))"); Filter filter = bundleContext.createFilter(builder.toString()); this.tracker = new ServiceTracker(bundleContext, filter, null); this.tracker.open(); }
@Activate protected void activate(BundleContext context) { recipesGraph = new IndexedGraph(); context.addBundleListener(this); for (Bundle b : context.getBundles()) { if (b.getState() == Bundle.ACTIVE) { loadRecipesData(b); } } }
@Activate protected void activate(ComponentContext ctx) throws FileNotFoundException, IOException{ bundleContext = ctx.getBundleContext(); //(1) read the mappings mappingsFile = bundleContext.getDataFile(PREFIX_MAPPINGS); if(mappingsFile.isFile()){ readPrefixMappings(new FileInputStream(mappingsFile)); } //else no mappings yet ... nothing todo }
/** * Activates the LoginModuleFactory service * @param context the component context */ @SuppressWarnings("UnusedDeclaration") @Activate private void activate(ComponentContext context) { //noinspection unchecked osgiConfig = ConfigurationParameters.of(context.getProperties()); bundleContext = context.getBundleContext(); mayRegisterSyncMBean(); }
@Activate protected void activate(BundleContext ctx) { final String path0 = ctx.getProperty("org.smartrplace.analysis.backup.parser.basepath"); final String path = path0 != null ? path0 : "ogemaCollect/rest"; basePath = Paths.get(path); controller = new GatewaysController(backupParser, ctx, basePath); }
@Activate protected void activate(ComponentContext ctx) throws ConfigurationException { String folderName = requireProperty(ctx.getProperties(), DATA_FILES_FOLDER_PROP, String.class); dataFilesFolder = new File(folderName); if(!dataFilesFolder.exists()){ if(!dataFilesFolder.mkdirs()){ throw new ConfigurationException(DATA_FILES_FOLDER_PROP, "Unable to create the configured Directory "+dataFilesFolder); } } else if(!dataFilesFolder.isDirectory()){ throw new ConfigurationException(DATA_FILES_FOLDER_PROP, "The configured DataFile directory "+dataFilesFolder+" does already exists but is not a directory!"); } //else exists and is a directory! }
@Activate public void activate(Map<String, Object> properties) { final ConfigBuilder builder = new ConfigBuilder();
@Activate public void activate(ComponentContext context) { this.path = (String) context.getProperties().get(ReasoningService.SERVICE_PATH); } }
@Activate protected void activate(final BundleContext context) { final Dictionary<String, Object> props = new Hashtable<String, Object>(); final ProductInfo[] productInfos = productInfoService.getInfos(); if (productInfos.length > 0) { final Version actualVersion = productInfos[0].getVersion(); if (actualVersion.compareTo(AEM_63_VERSION) < 0) { // AEM 6.2 Support - Legacy Sling Resource Provider Implementation props.put(org.apache.sling.api.resource.ResourceProvider.ROOTS, ROOT); legacyResourceProviderRegistration = context.registerService(org.apache.sling.api.resource.ResourceProvider.class.getName(), this, props); } else { // Is >= 6.3.0, use new Resource Provider props.put(ResourceProvider.PROPERTY_NAME, "acs-aem-tools.aem-fiddle"); props.put(ResourceProvider.PROPERTY_ROOT, ROOT); props.put(ResourceProvider.PROPERTY_REFRESHABLE, true); resourceProviderRegistration = context.registerService(ResourceProvider.class.getName(), this, props); } } }