@Reference( name = "interceptor", service = Interceptor.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeInterceptor" ) protected void addInterceptor(Interceptor interceptor, Map properties) { StartupServiceUtils.updateServiceCache("wso2-microservices-server", Interceptor.class); }
@Reference( name = "interceptor-config", service = OSGiInterceptorConfig.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeInterceptorConfig" ) protected void addInterceptorConfig(OSGiInterceptorConfig interceptorConfig, Map properties) { StartupServiceUtils.updateServiceCache("wso2-microservices-server", OSGiInterceptorConfig.class); }
@Reference( name = "interceptor-config", service = OSGiInterceptorConfig.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeInterceptorConfig" ) protected void addInterceptorConfig(OSGiInterceptorConfig interceptorConfig, Map properties) { StartupServiceUtils.updateServiceCache("wso2-microservices-server", OSGiInterceptorConfig.class); }
@Reference( name = "interceptor", service = Interceptor.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeInterceptor" ) protected void addInterceptor(Interceptor interceptor, Map properties) { StartupServiceUtils.updateServiceCache("wso2-microservices-server", Interceptor.class); }
@Reference( name = "sample.transport.service.reference", service = Transport.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "deregisterTransport" ) public void registerTransport(Transport transport) { transportList.add(transport); StartupServiceUtils.updateServiceCache(RepositoryServicesListener.COMPONENT_NAME, Transport.class); }
@Reference( name = "sample.runtime.service.reference", service = Runtime.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "deregisterRuntime" ) public void registerRuntime(Runtime runtime) { runtimeList.add(runtime); StartupServiceUtils.updateServiceCache(RepositoryServicesListener.COMPONENT_NAME, Runtime.class); }
@Reference( name = "sample.transport.service.reference", service = Transport.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "deregisterTransport" ) public void registerTransport(Transport transport) { transportList.add(transport); StartupServiceUtils.updateServiceCache(TransportServicesListener.COMPONENT_NAME, Transport.class); }
@Reference( name = "sample.runtime.service.reference", service = Runtime.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "deregisterRuntime" ) public void registerRuntime(Runtime runtime) { runtimeList.add(runtime); StartupServiceUtils.updateServiceCache(RuntimeServicesListener.COMPONENT_NAME, Runtime.class); }
@Reference( name = "sample.deployer.service.reference", service = Deployer.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "deregisterDeployer" ) public void registerDeployer(Deployer deployer) { deployerList.add(deployer); StartupServiceUtils.updateServiceCache(COMPONENT_NAME, Deployer.class); }
/** * This will store all the auth implementations of AuthenticationService class * * @param service implementation of Authentication Service interface. */ @Reference(name = "auth.service.reference", service = AuthenticationService.class, cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, unbind = "unregisterAuthService") public void registerAuthService(AuthenticationService service) { authList.add(service); //This is required to sync the list of OSGI services known by OSGI framework and OSGI components. StartupServiceUtils.updateServiceCache(COMPONENT_NAME, AuthenticationService.class); }
@Reference(service = RestApiProvider.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetRestApiProvider") protected void setRestApiProvider(RestApiProvider restApiProvider) { this.restApiProviders.add(restApiProvider); StartupServiceUtils.updateServiceCache(CARBON_COMPONENT_NAME, RestApiProvider.class); LOGGER.debug("An instance of class '{}' registered as a REST APIs provider for '{}' web app.", restApiProvider.getAppName(), restApiProvider.getClass().getName()); }
@Reference( name = "sp-idp-factory", service = IdPClientFactory.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unregisterReader" ) protected void registerReader(IdPClientFactory idPClientFactory) { idPClientFactoryHashMap.put(idPClientFactory.getType(), idPClientFactory); StartupServiceUtils.updateServiceCache(COMPONENT_NAME, IdPClientFactory.class); }
@Reference( name = "carbon.datasource.DataSourceReader", service = DataSourceReader.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unregisterReader" ) protected void registerReader(DataSourceReader reader) { readers.put(reader.getType(), reader); StartupServiceUtils.updateServiceCache(COMPONENT_NAME, DataSourceReader.class); }
@Reference(service = RestApiProvider.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetRestApiProvider") protected void setRestApiProvider(RestApiProvider restApiProvider) { this.restApiProviders.add(restApiProvider); StartupServiceUtils.updateServiceCache(CARBON_COMPONENT_NAME, RestApiProvider.class); LOGGER.debug("An instance of class '{}' registered as a REST APIs provider for '{}' web app.", restApiProvider.getAppName(), restApiProvider.getClass().getName()); }
/** * This is a dependency of DeploymentEngineComponent for deployment listener registrations from other bundles. * This is the bind method that gets called for deployment listener instance registrations that satisfy the policy. * * @param listener the deployer instances that are registered as services. */ @Reference( name = "carbon.deployment.listener.service", service = LifecycleListener.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unregisterDeploymentListener" ) protected void registerDeploymentListener(LifecycleListener listener) { logger.debug("Received LifecycleListener {} ", listener.getClass().getName()); deploymentEngine.registerDeploymentLifecycleListener(listener); StartupServiceUtils.updateServiceCache(COMPONENT_NAME, LifecycleListener.class); }
@Reference( name = "microservice", service = Microservice.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeService" ) protected void addService(Microservice service, Map properties) { /* Some Microservices might get register even after #onAllRequiredCapabilitiesAvailable That is due to the UUF doesn't know the actual service count before hand. Therefore we need to handle those services separately. */ if (isAllRequiredCapabilitiesAvailable) { Object channelId = properties.get(MSF4JConstants.CHANNEL_ID); Object contextPath = properties.get(MSF4JConstants.CONTEXT_PATH); addMicroserviceToRegistry(service, channelId, contextPath); } StartupServiceUtils.updateServiceCache("wso2-microservices-server", Microservice.class); }
@Reference( name = "microservice", service = Microservice.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeService" ) protected void addService(Microservice service, Map properties) { /* Some Microservices might get register even after #onAllRequiredCapabilitiesAvailable That is due to the UUF doesn't know the actual service count before hand. Therefore we need to handle those services separately. */ if (isAllRequiredCapabilitiesAvailable) { Object channelId = properties.get(MSF4JConstants.CHANNEL_ID); Object contextPath = properties.get(MSF4JConstants.CONTEXT_PATH); addMicroserviceToRegistry(service, channelId, contextPath); } StartupServiceUtils.updateServiceCache("wso2-microservices-server", Microservice.class); }
/** * The is a dependency of DeploymentEngineComponent for deployer registrations from other bundles. * This is the bind method that gets called for deployer instance registrations that satisfy the policy. * * @param deployer the deployer instances that are registered as services. */ @Reference( name = "carbon.deployer.service", service = Deployer.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unregisterDeployer" ) protected void registerDeployer(Deployer deployer) { try { deploymentEngine.registerDeployer(deployer); StartupServiceUtils.updateServiceCache(COMPONENT_NAME, Deployer.class); } catch (DeployerRegistrationException e) { logger.error("Error while adding deployer to the deployment engine", e); } }
/** * Register the runtime instance. * * @param runtime - runtime instance */ @Reference( name = "carbon.runtime.service", service = Runtime.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unRegisterRuntime" ) protected void registerRuntime(Runtime runtime) { try { runtimeManager.registerRuntime(runtime); StartupServiceUtils.updateServiceCache(COMPONENT_NAME, Runtime.class); } catch (Exception e) { logger.error("Error while adding runtime to the Runtime manager", e); } }
/** * To deploy micro services, we need to have at least one micro service registry in the system. * Since microservice registry is added when microservice server is active, added the reference to wait till * microservices server is active. * Otherwise if deployer registered before at least one registry is added, Deployer will start to deploy services * and will fail deployment. */ @Reference( name = "microservices-regitry", service = MicroservicesRegistry.class, cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, unbind = "removeMicroservicesRegistry" ) protected void addMicroservicesRegitry(MicroservicesRegistry registry, Map properties) { log.debug("MicroservicesRegistry get registered successfully."); DataHolder.getInstance().addMicroserviceRegistry(properties.get(CHANNEL_ID).toString(), registry); StartupServiceUtils.updateServiceCache("wso2-microservices-deployer", MicroservicesRegistry.class); }