org.apache.felix.scr.annotations.Activate Java Examples
The following examples show how to use
org.apache.felix.scr.annotations.Activate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SampleFelixServiceImpl.java From aem-osgi-annotation-demo with Apache License 2.0 | 6 votes |
@Activate @Modified protected final void activate(final Map<String, Object> config) { Map<String, Object> properties = Collections.emptyMap(); if (config != null) { properties = config; } booleanProp = PropertiesUtil.toBoolean(properties.get(BOOLEAN_PROPERTY_NAME), BOOLEAN_PROPERTY_DEFAULT_VALUE); stringProp = PropertiesUtil.toString(properties.get(STRING_PROPERTY_NAME), STRING_PROPERTY_DEFAULT_VALUE); dropdownProp = PropertiesUtil.toString(properties.get(DROPDOWN_PROPERTY_NAME), DROPDOWN_PROPERTY_DEFAULT_VALUE); stringArrayProp = PropertiesUtil.toStringArray(properties.get(STRING_ARRAY_PROPERTY_NAME)); passwordProp = PropertiesUtil.toString(properties.get(PASSWORD_PROPERTY_NAME), "").toCharArray(); longProp = PropertiesUtil.toLong(properties.get(LONG_PROPERTY_NAME), LONG_PROPERTY_DEFAULT_VALUE); }
Example #2
Source File: DistributedNetworkStore.java From onos-byon with Apache License 2.0 | 6 votes |
@Activate public void activate() { /** * TODO Lab 5: Replace the ConcurrentHashMap with ConsistentMap * * You should use storageService.consistentMapBuilder(), and the * serializer: Serializer.using(KryoNamespaces.API) */ networks = Maps.newConcurrentMap(); /* * TODO Lab 6: Add the listener to the networks map * * Use networks.addListener() */ log.info("Started"); }
Example #3
Source File: NetworkManager.java From onos-byon with Apache License 2.0 | 5 votes |
@Activate protected void activate() { appId = coreService.registerApplication("org.onos.byon"); /* * TODO Lab 6: Remove delegate and event sink * * 1. Add the listener registry to the event dispatcher using eventDispatcher.addSink() * 2. Set the delegate in the store */ log.info("Started"); }
Example #4
Source File: ActiveBundleHealthCheck.java From aem-healthcheck with Apache License 2.0 | 5 votes |
@Activate protected void activate(ComponentContext context) { bundleContext = context.getBundleContext(); Dictionary<String, Object> properties = context.getProperties(); if(properties != null) { ignoredBundles = PropertiesUtil.toStringArray(properties.get(IGNORED_BUNDLES)); } else { ignoredBundles = new String[]{}; } }
Example #5
Source File: LongSessionService.java From AEM-Rules-for-SonarQube with Apache License 2.0 | 5 votes |
@Activate protected void activate(final BundleContext bundleContext, final Map<String, Object> properties) { try { resolver = resourceResolverFactory.getAdministrativeResourceResolver(null); registerObservation(); } catch (LoginException x) { } }
Example #6
Source File: SampleFelixServlet.java From aem-osgi-annotation-demo with Apache License 2.0 | 5 votes |
@Activate @Modified protected final void activate(final Map<String, Object> config) { Map<String, Object> properties = Collections.emptyMap(); if (config != null) { properties = config; } enabled = PropertiesUtil.toBoolean(properties.get(ENABLE_SERVICE), ENABLE_SERVICE_DEFAULT); }
Example #7
Source File: LongSessionEventListener.java From AEM-Rules-for-SonarQube with Apache License 2.0 | 4 votes |
@Activate public void activate(final Map<String, String> config) throws RepositoryException, LoginException { observationSession = repository.loginAdministrative(null); final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager(); resolver = resourceResolverFactory.getAdministrativeResourceResolver(null); }
Example #8
Source File: DefaultSolrSearchService.java From aem-solr-search with Apache License 2.0 | 4 votes |
@Activate protected void activate(final Map<String, String> config) { resetService(config); }
Example #9
Source File: ManagedKubernetesClient.java From kubernetes-client with Apache License 2.0 | 4 votes |
@Activate public void activate(Map<String, Object> properties) { final ConfigBuilder builder = new ConfigBuilder(); if (properties.containsKey(KUBERNETES_MASTER_SYSTEM_PROPERTY)) { builder.withMasterUrl((String) properties.get(KUBERNETES_MASTER_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_API_VERSION_SYSTEM_PROPERTY)) { builder.withApiVersion((String) properties.get(KUBERNETES_API_VERSION_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_NAMESPACE_SYSTEM_PROPERTY)) { builder.withNamespace((String) properties.get(KUBERNETES_NAMESPACE_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CA_CERTIFICATE_FILE_SYSTEM_PROPERTY)) { builder.withCaCertFile((String) properties.get(KUBERNETES_CA_CERTIFICATE_FILE_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CA_CERTIFICATE_DATA_SYSTEM_PROPERTY)) { builder.withCaCertData((String) properties.get(KUBERNETES_CA_CERTIFICATE_DATA_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CLIENT_CERTIFICATE_FILE_SYSTEM_PROPERTY)) { builder.withClientCertFile((String) properties.get(KUBERNETES_CLIENT_CERTIFICATE_FILE_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CLIENT_CERTIFICATE_DATA_SYSTEM_PROPERTY)) { builder.withClientCertData((String) properties.get(KUBERNETES_CLIENT_CERTIFICATE_DATA_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CLIENT_KEY_FILE_SYSTEM_PROPERTY)) { builder.withClientKeyFile((String) properties.get(KUBERNETES_CLIENT_KEY_FILE_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CLIENT_KEY_DATA_SYSTEM_PROPERTY)) { builder.withClientKeyData((String) properties.get(KUBERNETES_CLIENT_KEY_DATA_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CLIENT_KEY_ALGO_SYSTEM_PROPERTY)) { builder.withClientKeyAlgo((String) properties.get(KUBERNETES_CLIENT_KEY_ALGO_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_CLIENT_KEY_PASSPHRASE_SYSTEM_PROPERTY)) { builder.withClientKeyPassphrase((String) properties.get(KUBERNETES_CLIENT_KEY_PASSPHRASE_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_AUTH_BASIC_USERNAME_SYSTEM_PROPERTY)) { builder.withUsername((String) properties.get(KUBERNETES_AUTH_BASIC_USERNAME_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_AUTH_BASIC_PASSWORD_SYSTEM_PROPERTY)) { builder.withPassword((String) properties.get(KUBERNETES_AUTH_BASIC_PASSWORD_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY)) { builder.withOauthToken((String) properties.get(KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY)); } if (properties.containsKey(KUBERNETES_WATCH_RECONNECT_INTERVAL_SYSTEM_PROPERTY)) { builder.withWatchReconnectInterval(Integer.parseInt((String) properties.get(KUBERNETES_WATCH_RECONNECT_INTERVAL_SYSTEM_PROPERTY))); } if (properties.containsKey(KUBERNETES_WATCH_RECONNECT_LIMIT_SYSTEM_PROPERTY)) { builder.withWatchReconnectLimit(Integer.parseInt((String) properties.get(KUBERNETES_WATCH_RECONNECT_LIMIT_SYSTEM_PROPERTY))); } if (properties.containsKey(KUBERNETES_REQUEST_TIMEOUT_SYSTEM_PROPERTY)) { builder.withRequestTimeout(Integer.parseInt((String) properties.get(KUBERNETES_REQUEST_TIMEOUT_SYSTEM_PROPERTY))); } if (properties.containsKey(KUBERNETES_HTTP_PROXY)) { builder.withHttpProxy((String) properties.get(KUBERNETES_HTTP_PROXY)); } if (properties.containsKey(KUBERNETES_HTTPS_PROXY)) { builder.withHttpsProxy((String) properties.get(KUBERNETES_HTTPS_PROXY)); } if (properties.containsKey(KUBERNETES_NO_PROXY)) { String noProxyProperty = (String) properties.get(KUBERNETES_NO_PROXY); builder.withNoProxy(noProxyProperty.split(",")); } if (properties.containsKey(KUBERNETES_WEBSOCKET_TIMEOUT_SYSTEM_PROPERTY)) { builder.withWebsocketTimeout(Long.parseLong((String) properties.get(KUBERNETES_WEBSOCKET_TIMEOUT_SYSTEM_PROPERTY))); } if (properties.containsKey(KUBERNETES_WEBSOCKET_PING_INTERVAL_SYSTEM_PROPERTY)) { builder.withWebsocketPingInterval(Long.parseLong((String) properties.get(KUBERNETES_WEBSOCKET_PING_INTERVAL_SYSTEM_PROPERTY))); } if (properties.containsKey(KUBERNETES_TRUSTSTORE_FILE_PROPERTY)) { builder.withTrustStoreFile((String) properties.get(KUBERNETES_TRUSTSTORE_FILE_PROPERTY)); } if (properties.containsKey(KUBERNETES_TRUSTSTORE_PASSPHRASE_PROPERTY)) { builder.withTrustStorePassphrase((String) properties.get(KUBERNETES_TRUSTSTORE_PASSPHRASE_PROPERTY)); } if (properties.containsKey(KUBERNETES_KEYSTORE_FILE_PROPERTY)) { builder.withKeyStoreFile((String) properties.get(KUBERNETES_KEYSTORE_FILE_PROPERTY)); } if (properties.containsKey(KUBERNETES_KEYSTORE_PASSPHRASE_PROPERTY)) { builder.withKeyStorePassphrase((String) properties.get(KUBERNETES_KEYSTORE_PASSPHRASE_PROPERTY)); } if (provider != null ) { builder.withOauthTokenProvider(provider); } delegate = new DefaultKubernetesClient(builder.build()); }
Example #10
Source File: HttpServiceImpl.java From publick-sling-blog with Apache License 2.0 | 4 votes |
/** * Service activation. */ @Activate protected void activate(Map<String, Object> properties) { }
Example #11
Source File: SystemSettingsServiceImpl.java From publick-sling-blog with Apache License 2.0 | 4 votes |
/** Service activation */ @Activate protected void activate(Map<String, Object> properties) { }
Example #12
Source File: RecaptchaServiceImpl.java From publick-sling-blog with Apache License 2.0 | 4 votes |
/** * Service activation. */ @Activate protected void activate(Map<String, Object> properties) { }
Example #13
Source File: LinkRewriterServiceImpl.java From publick-sling-blog with Apache License 2.0 | 4 votes |
/** * Service activation. */ @Activate protected void activate(Map<String, Object> properties) { }
Example #14
Source File: EmailServiceImpl.java From publick-sling-blog with Apache License 2.0 | 4 votes |
/** * Service activation. */ @Activate protected void activate(Map<String, Object> properties) { }
Example #15
Source File: AkismetServiceImpl.java From publick-sling-blog with Apache License 2.0 | 4 votes |
/** * Service activation. */ @Activate protected void activate(Map<String, Object> properties) { }
Example #16
Source File: NPEfix19_nineteen_t.java From coming with MIT License | 4 votes |
@Activate private void activate(final ComponentContext ctx) { final Dictionary props = ctx.getProperties(); String[] contentDispostionProps = PropertiesUtil.toStringArray(props.get(PROP_CONTENT_DISPOSTION_PATHS)); Set<String> paths = new HashSet<String>(); List<String> pfxs = new ArrayList<String>(); Map<String, Set<String>> contentTypesMap = new HashMap<String, Set<String>>(); for (String path : contentDispostionProps) { path = path.trim(); if (path.length() > 0) { int idx = path.indexOf('*'); int colonIdx = path.indexOf(":"); if (colonIdx > -1 && colonIdx < idx) { // ':' in paths is not allowed logger.info("':' in paths is not allowed."); } else { String p = null; if (idx >= 0) { if (idx > 0) { p = path.substring(0, idx); pfxs.add(p); } else { // we don't allow "*" - that would defeat the // purpose. logger.info("catch-all wildcard for paths not allowed."); } } else { if (colonIdx > -1) { p = path.substring(0, colonIdx); } else { p = path; } paths.add(p); } if (colonIdx != -1 && p != null) { Set <String> contentTypes = getContentTypes(path.substring(colonIdx+1)); contentTypesMap.put(p, contentTypes); } } } } contentDispositionPaths = paths.isEmpty() ? Collections.<String>emptySet() : paths; contentDispositionPathsPfx = pfxs.toArray(new String[pfxs.size()]); contentTypesMapping = contentTypesMap.isEmpty()?Collections.<String, Set<String>>emptyMap(): contentTypesMap; enableContentDispositionAllPaths = PropertiesUtil.toBoolean(props.get(PROP_ENABLE_CONTENT_DISPOSTION_ALL_PATHS),DEFAULT_ENABLE_CONTENT_DISPOSTION_ALL_PATHS); String[] contentDispostionExcludedPathsArray = PropertiesUtil.toStringArray(props.get(PROP_CONTENT_DISPOSTION_EXCLUDED_PATHS)); contentDispositionExcludedPaths = new HashSet<String>(Arrays.asList(contentDispostionExcludedPathsArray)); logger.info("Initialized. content disposition paths: {}, content disposition paths-pfx {}, content disposition excluded paths: {}. Enable Content Disposition for all paths is set to {}", new Object[]{ contentDispositionPaths, contentDispositionPathsPfx, contentDispositionExcludedPaths, enableContentDispositionAllPaths} ); }
Example #17
Source File: NPEfix19_nineteen_s.java From coming with MIT License | 4 votes |
@Activate private void activate(final ComponentContext ctx) { final Dictionary props = ctx.getProperties(); String[] contentDispostionProps = PropertiesUtil.toStringArray(props.get(PROP_CONTENT_DISPOSTION_PATHS)); Set<String> paths = new HashSet<String>(); List<String> pfxs = new ArrayList<String>(); Map<String, Set<String>> contentTypesMap = new HashMap<String, Set<String>>(); for (String path : contentDispostionProps) { path = path.trim(); if (path.length() > 0) { int idx = path.indexOf('*'); int colonIdx = path.indexOf(":"); if (colonIdx > -1 && colonIdx < idx) { // ':' in paths is not allowed logger.info("':' in paths is not allowed."); } else { String p = null; if (idx >= 0) { if (idx > 0) { p = path.substring(0, idx); pfxs.add(p); } else { // we don't allow "*" - that would defeat the // purpose. logger.info("catch-all wildcard for paths not allowed."); } } else { if (colonIdx > -1) { p = path.substring(0, colonIdx); } else { p = path; } paths.add(p); } if (colonIdx != -1 && p != null) { Set <String> contentTypes = getContentTypes(path.substring(colonIdx+1)); contentTypesMap.put(p, contentTypes); } } } } contentDispositionPaths = paths.isEmpty() ? Collections.<String>emptySet() : paths; contentDispositionPathsPfx = pfxs.toArray(new String[pfxs.size()]); contentTypesMapping = contentTypesMap.isEmpty()?Collections.<String, Set<String>>emptyMap(): contentTypesMap; enableContentDispositionAllPaths = PropertiesUtil.toBoolean(props.get(PROP_ENABLE_CONTENT_DISPOSTION_ALL_PATHS),DEFAULT_ENABLE_CONTENT_DISPOSTION_ALL_PATHS); String[] contentDispostionExcludedPathsArray = PropertiesUtil.toStringArray(props.get(PROP_CONTENT_DISPOSTION_EXCLUDED_PATHS)); contentDispositionExcludedPaths = new HashSet<String>(Arrays.asList(contentDispostionExcludedPathsArray)); logger.info("Initialized. content disposition paths: {}, content disposition paths-pfx {}, content disposition excluded paths: {}. Enable Content Disposition for all paths is set to {}", new Object[]{ contentDispositionPaths, contentDispositionPathsPfx, contentDispositionExcludedPaths, enableContentDispositionAllPaths} ); }
Example #18
Source File: LongSessionEventListenerError.java From AEM-Rules-for-SonarQube with Apache License 2.0 | 4 votes |
@Activate public void activate(final Map<String, String> config) throws RepositoryException { observationSession = repository.loginAdministrative(null); final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager(); }
Example #19
Source File: LongResourceResolverEvenListenerError.java From AEM-Rules-for-SonarQube with Apache License 2.0 | 4 votes |
@Activate public void activate(final Map<String, String> config) throws RepositoryException, LoginException { resolver = resourceResolverFactory.getAdministrativeResourceResolver(null); }
Example #20
Source File: SimpleScheduledTask.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 4 votes |
@Activate protected void activate(final Map<String, Object> config) { configure(config); }
Example #21
Source File: HealthCheckExecutorServlet.java From aem-healthcheck with Apache License 2.0 | 4 votes |
@Activate protected void activate(ComponentContext context) { logger.debug("Starting HealthCheckExecutorServlet"); }
Example #22
Source File: SearchSandbox.java From sling-samples with Apache License 2.0 | 4 votes |
@Activate public void test() throws PersistenceException, LoginException { System.out.println("*** Search service sandbox"); if (resolver == null) { resolver = resourceResolverFactory.getAdministrativeResourceResolver(null); } Resource testRoot; final Resource root = resolver.getResource("/"); final String path = getClass().getSimpleName(); testRoot = resolver.getResource(root, path); if (testRoot == null) { testRoot = resolver.create(root, path, null); resolver.commit(); } for (int i = 0; i < 3; i++) { final Props props = new Props("title", "HELLO", "jcr:text", "world"); resolver.create(testRoot, "child_" + System.currentTimeMillis(), props).getPath(); resolver.commit(); } Scanner sc = new Scanner(System.in); System.out.println("Type \"quit\" to continue loading MAS."); System.out.print("*** New query: >"); String query = sc.nextLine(); while (!query.equalsIgnoreCase("quit")) { try { System.out.println("*** sql"); Iterator<Resource> resSQL = resolver.findResources(query, Query.JCR_SQL2); while (resSQL.hasNext()) { Resource resource = (Resource) resSQL.next(); System.out.println(resource.toString()); } // System.out.println("*** xpath"); // Iterator<Resource> resXPath = resolver.findResources(query, Query.XPATH); // while (resXPath.hasNext()) { // Resource resource = (Resource) resXPath.next(); // System.out.println(resource.toString()); // } } catch (Exception e) { e.printStackTrace(); } System.out.print("*** New query: >"); query = sc.nextLine(); } }
Example #23
Source File: ConnectorScheduler.java From sling-samples with Apache License 2.0 | 4 votes |
@Activate public void activate() { executionThread = new Thread(this, "Connector Scheduler's execution thread"); executionThread.setDaemon(true); executionThread.start(); }
Example #24
Source File: SearchServiceImpl.java From sling-samples with Apache License 2.0 | 4 votes |
@Activate public void activate() throws LoginException { if (resolver == null) { resolver = resourceResolverFactory.getAdministrativeResourceResolver(null); } }
Example #25
Source File: MessageStoreImpl.java From sling-samples with Apache License 2.0 | 4 votes |
@Activate private void activate(BundleContext bc) { bundleContext = bc; }
Example #26
Source File: SampleFelixScheduledTask.java From aem-osgi-annotation-demo with Apache License 2.0 | 4 votes |
@Activate protected void activate(final Map<String, Object> config) { configure(config); }
Example #27
Source File: FileUploadServiceImpl.java From publick-sling-blog with Apache License 2.0 | 2 votes |
/** * Activate service. * * @param properties */ @Activate protected void activate(Map<String, Object> properties) { }