From a4f9ebdc57a6d2f72811cd2ba86754086eecc4e2 Mon Sep 17 00:00:00 2001 From: Pulasthi Mahawithana Date: Wed, 10 Jan 2018 17:01:53 +0530 Subject: [PATCH 1/3] Fixing SCR annotations generated by tool --- .../ThriftAuthenticationServiceComponent.java | 117 ++++++-------- .../ClaimManagementServiceComponent.java | 51 +++--- ...entityClaimManagementServiceComponent.java | 72 +++++---- .../IdentityEventServiceComponent.java | 83 +++++----- ...otificationManagementServiceComponent.java | 49 +++--- .../IdentityProvisionServiceComponent.java | 68 ++++---- .../IdentityUserProfileServiceComponent.java | 53 ++++--- .../internal/UserRegistrationDSComponent.java | 39 +++-- .../user/mgt/internal/UserMgtDSComponent.java | 67 ++++---- .../internal/WorkflowMgtServiceComponent.java | 146 ++++++++---------- 10 files changed, 388 insertions(+), 357 deletions(-) diff --git a/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/src/main/java/org/wso2/carbon/identity/thrift/authentication/internal/ThriftAuthenticationServiceComponent.java b/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/src/main/java/org/wso2/carbon/identity/thrift/authentication/internal/ThriftAuthenticationServiceComponent.java index 3998c6f7aea0..a7062f709b4c 100644 --- a/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/src/main/java/org/wso2/carbon/identity/thrift/authentication/internal/ThriftAuthenticationServiceComponent.java +++ b/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/src/main/java/org/wso2/carbon/identity/thrift/authentication/internal/ThriftAuthenticationServiceComponent.java @@ -38,97 +38,81 @@ import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.ConfigurationContextService; - import javax.servlet.ServletException; import java.net.MalformedURLException; import java.net.URL; import java.util.Hashtable; - -/** - * @scr.component name="org.wso2.carbon.identity.thrift.authentication.internal.ThriftAuthenticationServiceComponent" immediate="true" - * @scr.reference name="http.service" interface="org.osgi.service.http.HttpService" - * cardinality="1..1" policy="dynamic" bind="setHttpService" unbind="unsetHttpService" - * @scr.reference name="org.wso2.carbon.user.core" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="configuration.context" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="1..1" policy="dynamic" bind="setConfigurationContext" unbind="unsetConfigurationContext" - */ - +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; + +@Component( + name = "org.wso2.carbon.identity.thrift.authentication.internal.ThriftAuthenticationServiceComponent", + immediate = true) public class ThriftAuthenticationServiceComponent { private static Log log = LogFactory.getLog(ThriftAuthenticationServiceComponent.class); - private static HttpService httpServiceInstance; + private static RealmService realmServiceInstance; + private ServiceRegistration thriftAuthenticationService; + private ConfigurationContextService configurationContext; + private TCPThriftAuthenticationService TCPThriftAuthenticationService; public static int readPortOffset() { - return CarbonUtils. - getPortFromServerConfig(ThriftAuthenticationConstants.CARBON_CONFIG_PORT_OFFSET_NODE) + 1; + return CarbonUtils.getPortFromServerConfig(ThriftAuthenticationConstants.CARBON_CONFIG_PORT_OFFSET_NODE) + 1; } + @Activate protected void activate(ComponentContext compCtx) { try { - //configure ThriftSessionDAO + // configure ThriftSessionDAO ThriftSessionDAO thriftSessionDAO; try { - OMElement thriftSessionDAOElement = ThriftAuthenticationConfigParser.getInstance() - .getConfigElement("ThriftSessionDAO"); + OMElement thriftSessionDAOElement = ThriftAuthenticationConfigParser.getInstance().getConfigElement("ThriftSessionDAO"); thriftSessionDAO = ((ThriftSessionDAO) Class.forName(thriftSessionDAOElement.getText()).newInstance()).getInstance(); } catch (Throwable throwable) { log.error("Error in loading ThriftSessionDAO hence using default org.wso2.carbon.identity.thrift.authentication.dao.DBThriftSessionDAO, ", throwable); thriftSessionDAO = new DBThriftSessionDAO(); } - //configure thriftSessionTimeout in ms + // configure thriftSessionTimeout in ms long thriftSessionTimeout; try { - OMElement thriftSessionTimeoutElement = ThriftAuthenticationConfigParser.getInstance() - - .getConfigElement("ThriftSessionTimeout"); - + OMElement thriftSessionTimeoutElement = ThriftAuthenticationConfigParser.getInstance().getConfigElement("ThriftSessionTimeout"); thriftSessionTimeout = Long.parseLong(thriftSessionTimeoutElement.getText()); - } catch (Throwable throwable) { - log.error("Error in loading ThriftSessionTimeout hence using the default: 30min, ", throwable); - thriftSessionTimeout = 60000L * 30; - } - //get an instance of this to register as an osgi service - - ThriftAuthenticatorServiceImpl thriftAuthenticatorServiceImpl = - - new ThriftAuthenticatorServiceImpl(getRealmServiceInstance(), thriftSessionDAO, thriftSessionTimeout); - //register as an osgi service - - thriftAuthenticationService = compCtx.getBundleContext().registerService( - - ThriftAuthenticatorService.class.getName(), thriftAuthenticatorServiceImpl, null); - //register AuthenticatorServiceImpl as a thrift service. - + // get an instance of this to register as an osgi service + ThriftAuthenticatorServiceImpl thriftAuthenticatorServiceImpl = new ThriftAuthenticatorServiceImpl(getRealmServiceInstance(), thriftSessionDAO, thriftSessionTimeout); + // register as an osgi service + thriftAuthenticationService = compCtx.getBundleContext().registerService(ThriftAuthenticatorService.class.getName(), thriftAuthenticatorServiceImpl, null); + // register AuthenticatorServiceImpl as a thrift service. startThriftServices(thriftAuthenticatorServiceImpl); } catch (RuntimeException e) { log.error("Error in starting Thrift Authentication Service ", e); } catch (Throwable e) { log.error("Error in starting Thrift Authentication Service ", e); } - //populate thrift sessions from db, if there is any in the db + // populate thrift sessions from db, if there is any in the db } + @Deactivate protected void deactivate(ComponentContext compCtx) { - if (TCPThriftAuthenticationService != null) { TCPThriftAuthenticationService.stop(); } compCtx.getBundleContext().ungetService(thriftAuthenticationService.getReference()); - } + public static HttpService getHttpServiceInstance() { return httpServiceInstance; } @@ -144,15 +128,27 @@ public static RealmService getRealmServiceInstance() { public static void setRealmServiceInstance(RealmService realmServiceInstance) { ThriftAuthenticationServiceComponent.realmServiceInstance = realmServiceInstance; } + + @Reference( + name = "http.service", + service = org.osgi.service.http.HttpService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetHttpService") protected void setHttpService(HttpService httpService) { setHttpServiceInstance(httpService); } protected void unsetHttpService(HttpService httpService) { - setHttpServiceInstance(null); } + @Reference( + name = "org.wso2.carbon.user.core", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { setRealmServiceInstance(realmService); } @@ -161,6 +157,12 @@ protected void unsetRealmService(RealmService realmService) { setRealmServiceInstance(null); } + @Reference( + name = "configuration.context", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContext") protected void setConfigurationContext(ConfigurationContextService configurationContext) { this.configurationContext = configurationContext; } @@ -175,22 +177,12 @@ private void startThriftServices(ThriftAuthenticatorService thriftAuthenticatorS } private void startThriftHttpAuthenticatorService(ThriftAuthenticatorService thriftAuthenticatorService) { - // Authenticator service should be exposed over SSL. Since Thrift 0.5 doesn't have support - // for SSL transport this is commented out for now until later Thrift version is used. Using // servlet based authenticator service for authentication for now. try { - AuthenticatorService.Processor authServiceProcessor = new AuthenticatorService.Processor( - new AuthenticatorServiceImpl(thriftAuthenticatorService)); - + AuthenticatorService.Processor authServiceProcessor = new AuthenticatorService.Processor(new AuthenticatorServiceImpl(thriftAuthenticatorService)); TCompactProtocol.Factory inProtFactory = new TCompactProtocol.Factory(); TCompactProtocol.Factory outProtFactory = new TCompactProtocol.Factory(); - - getHttpServiceInstance().registerServlet("/thriftAuthenticator", - new AuthenticatorServlet(authServiceProcessor, - inProtFactory, - outProtFactory), - new Hashtable(), - getHttpServiceInstance().createDefaultHttpContext()); + getHttpServiceInstance().registerServlet("/thriftAuthenticator", new AuthenticatorServlet(authServiceProcessor, inProtFactory, outProtFactory), new Hashtable(), getHttpServiceInstance().createDefaultHttpContext()); } catch (ServletException e) { log.error("Unable to start Thrift Authenticator Service." + e); } catch (NamespaceException e) { @@ -199,14 +191,9 @@ private void startThriftHttpAuthenticatorService(ThriftAuthenticatorService thri } private void startThriftTcpAuthenticatorService(ThriftAuthenticatorService thriftAuthenticatorService) throws Exception { - int portOffset = readPortOffset(); - ServerConfiguration serverConfig = ServerConfiguration.getInstance(); - String serverUrl = CarbonUtils.getServerURL(serverConfig, configurationContext.getServerConfigContext()); - - OMElement hostnameElement = ThriftAuthenticationConfigParser.getInstance().getConfigElement("Hostname"); String hostName; if (hostnameElement == null) { @@ -221,7 +208,6 @@ private void startThriftTcpAuthenticatorService(ThriftAuthenticatorService thrif } else { hostName = hostnameElement.getText(); } - OMElement portElement = ThriftAuthenticationConfigParser.getInstance().getConfigElement("Port"); int port; if (portElement != null) { @@ -230,7 +216,6 @@ private void startThriftTcpAuthenticatorService(ThriftAuthenticatorService thrif throw new Exception("Error, Thrift Authentication Service config does not have a port defined!"); } port = port + portOffset; - String keyStore = serverConfig.getFirstProperty("Security.KeyStore.Location"); if (keyStore == null) { keyStore = System.getProperty("Security.KeyStore.Location"); @@ -245,7 +230,6 @@ private void startThriftTcpAuthenticatorService(ThriftAuthenticatorService thrif throw new Exception("Cannot initialize Thrift Authentication Service, Security.KeyStore.Password is null "); } } - OMElement clientTimeoutElement = ThriftAuthenticationConfigParser.getInstance().getConfigElement(ThriftAuthenticationConstants.CLIENT_TIMEOUT); int clientTimeout; if (clientTimeoutElement != null) { @@ -263,7 +247,6 @@ private void startThriftTcpAuthenticatorService(ThriftAuthenticatorService thrif } TCPThriftAuthenticationService = new TCPThriftAuthenticationService(hostName, port, keyStore, keyStorePassword, clientTimeout, thriftAuthenticatorService); TCPThriftAuthenticationService.start(); - } - } + diff --git a/components/claim-mgt/org.wso2.carbon.claim.mgt/src/main/java/org/wso2/carbon/claim/mgt/internal/ClaimManagementServiceComponent.java b/components/claim-mgt/org.wso2.carbon.claim.mgt/src/main/java/org/wso2/carbon/claim/mgt/internal/ClaimManagementServiceComponent.java index 9c4e6e00f24a..a3ef04bd2c80 100644 --- a/components/claim-mgt/org.wso2.carbon.claim.mgt/src/main/java/org/wso2/carbon/claim/mgt/internal/ClaimManagementServiceComponent.java +++ b/components/claim-mgt/org.wso2.carbon.claim.mgt/src/main/java/org/wso2/carbon/claim/mgt/internal/ClaimManagementServiceComponent.java @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.claim.mgt.internal; import org.apache.commons.logging.Log; @@ -25,21 +24,16 @@ import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; - -/** - * @scr.component name="claim.mgt.component" immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - */ - +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; + +@Component( + name = "claim.mgt.component", + immediate = true) public class ClaimManagementServiceComponent { private static final Log log = LogFactory.getLog(ClaimManagementServiceComponent.class); @@ -58,6 +52,12 @@ public static RealmService getRealmService() { /** * @param realmService */ + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { try { ClaimManagementServiceDataHolder.getInstance().setRealmService(realmService); @@ -73,6 +73,12 @@ public static RegistryService getRegistryService() { return ClaimManagementServiceDataHolder.getInstance().getRegistryService(); } + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { try { ClaimManagementServiceDataHolder.getInstance().setRegistryService(registryService); @@ -87,6 +93,7 @@ protected void setRegistryService(RegistryService registryService) { /** * @param ctxt */ + @Activate protected void activate(ComponentContext ctxt) { try { ClaimManagementServiceDataHolder.getInstance().setBundleContext(ctxt.getBundleContext()); @@ -101,6 +108,7 @@ protected void activate(ComponentContext ctxt) { /** * @param ctxt */ + @Deactivate protected void deactivate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.debug("Claim Management bundle is deactivated"); @@ -124,13 +132,20 @@ protected void unsetRealmService(RealmService realmService) { } } + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService") protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } } + diff --git a/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/src/main/java/org/wso2/carbon/identity/claim/metadata/mgt/internal/IdentityClaimManagementServiceComponent.java b/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/src/main/java/org/wso2/carbon/identity/claim/metadata/mgt/internal/IdentityClaimManagementServiceComponent.java index 3ffcbe3f6083..1979723f7158 100644 --- a/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/src/main/java/org/wso2/carbon/identity/claim/metadata/mgt/internal/IdentityClaimManagementServiceComponent.java +++ b/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/src/main/java/org/wso2/carbon/identity/claim/metadata/mgt/internal/IdentityClaimManagementServiceComponent.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.wso2.carbon.identity.claim.metadata.mgt.internal; import org.apache.commons.logging.Log; @@ -27,44 +26,29 @@ import org.wso2.carbon.user.core.claim.ClaimManagerFactory; import org.wso2.carbon.user.core.listener.ClaimManagerListener; import org.wso2.carbon.user.core.service.RealmService; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; -/** - * @scr.component name="identity.claim.metadata.component" immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="claim.manager.listener.service" - * interface="org.wso2.carbon.user.core.listener.ClaimManagerListener" - * cardinality="0..n" policy="dynamic" - * bind="setClaimManagerListener" - * unbind="unsetClaimManagerListener" * - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - */ @SuppressWarnings("unused") +@Component( + name = "identity.claim.metadata.component", + immediate = true) public class IdentityClaimManagementServiceComponent { private static final Log log = LogFactory.getLog(IdentityClaimManagementServiceComponent.class); + @Activate protected void activate(ComponentContext ctxt) { try { IdentityClaimManagementServiceDataHolder.getInstance().setBundleContext(ctxt.getBundleContext()); - ClaimMetadataStoreFactory claimMetadataStoreFactory = new ClaimMetadataStoreFactory(); - ctxt.getBundleContext().registerService(ClaimManagerFactory.class.getName(), claimMetadataStoreFactory, - null); - + ctxt.getBundleContext().registerService(ClaimManagerFactory.class.getName(), claimMetadataStoreFactory, null); ClaimMetadataManagementService claimManagementService = new ClaimMetadataManagementServiceImpl(); - ctxt.getBundleContext().registerService(ClaimMetadataManagementService.class.getName(), - claimManagementService, null); + ctxt.getBundleContext().registerService(ClaimMetadataManagementService.class.getName(), claimManagementService, null); IdentityClaimManagementServiceDataHolder.getInstance().setClaimManagementService(claimManagementService); if (log.isDebugEnabled()) { log.debug("Identity Claim Management Core bundle is activated"); @@ -74,12 +58,19 @@ protected void activate(ComponentContext ctxt) { } } + @Deactivate protected void deactivate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.debug("Identity Claim Management bundle is deactivated"); } } + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { IdentityClaimManagementServiceDataHolder.getInstance().setRealmService(realmService); if (log.isDebugEnabled()) { @@ -94,6 +85,12 @@ protected void unsetRealmService(RealmService realmService) { } } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { IdentityClaimManagementServiceDataHolder.getInstance().setRegistryService(registryService); if (log.isDebugEnabled()) { @@ -108,8 +105,13 @@ protected void unsetRegistryService(RegistryService registryService) { } } + @Reference( + name = "claim.manager.listener.service", + service = org.wso2.carbon.user.core.listener.ClaimManagerListener.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetClaimManagerListener") public static synchronized void setClaimManagerListener(ClaimManagerListener claimManagerListener) { - IdentityClaimManagementServiceDataHolder.getInstance().setClaimManagerListener(claimManagerListener); if (log.isDebugEnabled()) { log.debug("ClaimManagerListener set in Identity Claim Management bundle"); @@ -117,20 +119,26 @@ public static synchronized void setClaimManagerListener(ClaimManagerListener cla } public static synchronized void unsetClaimManagerListener(ClaimManagerListener claimManagerListener) { - IdentityClaimManagementServiceDataHolder.getInstance().unsetClaimManagerListener(claimManagerListener); if (log.isDebugEnabled()) { log.debug("ClaimManagerListener unset in Identity Claim Management bundle"); } } + @Reference( + name = "identityCoreInitializedEventService", + service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService") protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } } + diff --git a/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/IdentityEventServiceComponent.java b/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/IdentityEventServiceComponent.java index 2692c2bd2472..5a1c19baea27 100644 --- a/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/IdentityEventServiceComponent.java +++ b/components/identity-event/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/IdentityEventServiceComponent.java @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.identity.event.internal; import org.apache.commons.logging.Log; @@ -32,34 +31,19 @@ import org.wso2.carbon.idp.mgt.IdpManager; import org.wso2.carbon.stratos.common.listeners.TenantMgtListener; import org.wso2.carbon.user.core.service.RealmService; - import java.util.ArrayList; import java.util.Collections; import java.util.List; - -/** - * @scr.component name="identity.event.service" - * immediate="true" - * @scr.reference name="realm.service" - * interface="org.wso2.carbon.user.core.service.RealmService"cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="event.handler" - * interface="org.wso2.carbon.identity.event.handler.AbstractEventHandler" - * cardinality="0..n" policy="dynamic" - * bind="registerEventHandler" - * unbind="unRegisterEventHandler" - * @scr.reference name="listener.TenantMgtListener" - * interface="org.wso2.carbon.stratos.common.listeners.TenantMgtListener" - * cardinality="0..n" policy="dynamic" - * bind="registerTenantMgtListener" unbind="unRegisterTenantMgtListener" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - * @scr.reference name="IdentityProviderManager" - * interface="org.wso2.carbon.idp.mgt.IdpManager" cardinality="1..1" - * policy="dynamic" bind="setIdpManager" unbind="unsetIdpManager" - */ - +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; + +@Component( + name = "identity.event.service", + immediate = true) public class IdentityEventServiceComponent { private static Log log = LogFactory.getLog(IdentityEventServiceComponent.class); @@ -71,14 +55,11 @@ public class IdentityEventServiceComponent { // list of all registered event handlers public static List eventHandlerList = new ArrayList<>(); + @Activate protected void activate(ComponentContext context) { - try { - IdentityEventServiceDataHolder.getInstance().setEventMgtService(new IdentityEventServiceImpl(eventHandlerList, - Integer.parseInt(IdentityEventConfigBuilder.getInstance().getThreadPoolSize()))); - - context.getBundleContext().registerService(IdentityEventService.class.getName(), IdentityEventServiceDataHolder - .getInstance().getEventMgtService(), null); + IdentityEventServiceDataHolder.getInstance().setEventMgtService(new IdentityEventServiceImpl(eventHandlerList, Integer.parseInt(IdentityEventConfigBuilder.getInstance().getThreadPoolSize()))); + context.getBundleContext().registerService(IdentityEventService.class.getName(), IdentityEventServiceDataHolder.getInstance().getEventMgtService(), null); } catch (IdentityEventException e) { log.error("Error while initiating IdentityMgtService."); } @@ -87,18 +68,23 @@ protected void activate(ComponentContext context) { } } - + @Deactivate protected void deactivate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Identity Management bundle is de-activated"); } } + @Reference( + name = "event.handler", + service = org.wso2.carbon.identity.event.handler.AbstractEventHandler.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unRegisterEventHandler") protected void registerEventHandler(AbstractEventHandler eventHandler) throws IdentityEventException { String handlerName = eventHandler.getName(); eventHandler.init(IdentityEventConfigBuilder.getInstance().getModuleConfigurations(handlerName)); eventHandlerList.add(eventHandler); - MessageHandlerComparator messageHandlerComparator = new MessageHandlerComparator(null); Collections.sort(eventHandlerList, messageHandlerComparator); } @@ -106,12 +92,24 @@ protected void registerEventHandler(AbstractEventHandler eventHandler) throws Id protected void unRegisterEventHandler(AbstractEventHandler eventHandler) { } + @Reference( + name = "listener.TenantMgtListener", + service = org.wso2.carbon.stratos.common.listeners.TenantMgtListener.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unRegisterTenantMgtListener") protected void registerTenantMgtListener(TenantMgtListener tenantMgtListener) { } protected void unRegisterTenantMgtListener(TenantMgtListener tenantMgtListener) { } + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting the Realm Service"); @@ -131,12 +129,18 @@ public static RealmService getRealmService() { } protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } + @Reference( + name = "identityCoreInitializedEventService", + service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService") protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } @@ -144,7 +148,14 @@ protected void unsetIdpManager(IdpManager idpManager) { IdentityEventServiceDataHolder.getInstance().setIdpManager(null); } + @Reference( + name = "IdentityProviderManager", + service = org.wso2.carbon.idp.mgt.IdpManager.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdpManager") protected void setIdpManager(IdpManager idpManager) { IdentityEventServiceDataHolder.getInstance().setIdpManager(idpManager); } } + diff --git a/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/src/main/java/org/wso2/carbon/identity/notification/mgt/internal/NotificationManagementServiceComponent.java b/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/src/main/java/org/wso2/carbon/identity/notification/mgt/internal/NotificationManagementServiceComponent.java index fb1f581769bc..a665dd04b9e9 100644 --- a/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/src/main/java/org/wso2/carbon/identity/notification/mgt/internal/NotificationManagementServiceComponent.java +++ b/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/src/main/java/org/wso2/carbon/identity/notification/mgt/internal/NotificationManagementServiceComponent.java @@ -15,13 +15,18 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.identity.notification.mgt.internal; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.notification.mgt.NotificationManagementException; import org.wso2.carbon.identity.notification.mgt.NotificationMgtConfigBuilder; import org.wso2.carbon.identity.notification.mgt.NotificationMgtConstants; @@ -33,38 +38,36 @@ import java.util.ArrayList; import java.util.List; -/** - * @scr.reference name="ldap.tenant.manager.listener.service" - * interface="org.wso2.carbon.identity.notification.mgt.NotificationSendingModule" - * cardinality="0..n" policy="dynamic" - * bind="addNotificationSendingModule" - * unbind="removeNotificationSendingModule" - * @scr.component name="carbon.identity.notification.mgt" immediate="true" - */ - @SuppressWarnings("unused") +@Component( + name = "carbon.identity.notification.mgt", + immediate = true) public class NotificationManagementServiceComponent { private static final Log log = LogFactory.getLog(NotificationManagementServiceComponent.class); + /** * Size of the thread pool for distributing events to subscribed modules */ int threadPoolSize = 0; + /** * NotificationSender instance which is exposed as the service. */ private NotificationSender notificationSender; + /** * Notification management configurations */ private NotificationMgtConfigBuilder configBuilder; + /** * Since Message Sending modules are dynamically registered a List is used */ private List notificationSendingModules = new ArrayList(); + @Activate protected void activate(ComponentContext context) { - // Register Notification sender as an OSGI service. Other components can consume the service for sending // messages on a registered event try { // Pass the bundle context to read property file in a case it is not found in default location. @@ -73,22 +76,19 @@ protected void activate(ComponentContext context) { } catch (NotificationManagementException e) { log.error("Error while building Notification Mgt configuration", e); } - // Read the thread pool size from configurations. If not present in configurations use default value. if (configBuilder != null && configBuilder.getThreadPoolSize() != null) { try { threadPoolSize = Integer.parseInt(configBuilder.getThreadPoolSize()); } catch (NumberFormatException e) { if (log.isDebugEnabled()) { - log.debug("Error while parsing thread pool size configuration, " + - "setting default size :" + NotificationMgtConstants.THREAD_POOL_DEFAULT_SIZE); + log.debug("Error while parsing thread pool size configuration, " + "setting default size :" + NotificationMgtConstants.THREAD_POOL_DEFAULT_SIZE); } threadPoolSize = NotificationMgtConstants.THREAD_POOL_DEFAULT_SIZE; } } else { if (log.isDebugEnabled()) { - log.debug("No configuration found for thread pool size, " + - "setting default size :" + NotificationMgtConstants.THREAD_POOL_DEFAULT_SIZE); + log.debug("No configuration found for thread pool size, " + "setting default size :" + NotificationMgtConstants.THREAD_POOL_DEFAULT_SIZE); } threadPoolSize = NotificationMgtConstants.THREAD_POOL_DEFAULT_SIZE; } @@ -97,17 +97,17 @@ protected void activate(ComponentContext context) { } // Register Notification sender as the service class notificationSender = new NotificationSender(notificationSendingModules, threadPoolSize); - context.getBundleContext().registerService(NotificationSender.class.getName(), - notificationSender, null); + context.getBundleContext().registerService(NotificationSender.class.getName(), notificationSender, null); if (log.isDebugEnabled()) { log.debug("Notification Management bundle is activated"); } - // Catch throwable since there may be run time exceptions. + // Catch throwable since there may be run time exceptions. } catch (Throwable e) { log.error("Error while initiating Notification Management component", e); } } + @Deactivate protected void deactivate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Notification Management bundle is deactivated"); @@ -121,8 +121,13 @@ protected void deactivate(ComponentContext context) { * * @param module MessageSendingModule */ + @Reference( + name = "ldap.tenant.manager.listener.service", + service = NotificationSendingModule.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "removeNotificationSendingModule") protected void addNotificationSendingModule(NotificationSendingModule module) throws MessageRemovedException { - ModuleConfiguration moduleConfiguration; if (StringUtils.isEmpty(module.getModuleName())) { if (log.isDebugEnabled()) { @@ -133,7 +138,6 @@ protected void addNotificationSendingModule(NotificationSendingModule module) th if (log.isDebugEnabled()) { log.debug("Registering a message sending module " + module.getModuleName()); } - if (configBuilder != null) { moduleConfiguration = configBuilder.getModuleConfigurations(module.getModuleName()); } else { @@ -159,4 +163,5 @@ protected void removeNotificationSendingModule(NotificationSendingModule module) } notificationSendingModules.remove(module); } -} \ No newline at end of file +} + diff --git a/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java b/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java index 98b07661658a..1134618217bb 100644 --- a/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java +++ b/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.identity.provisioning.internal; import org.apache.commons.logging.Log; @@ -38,31 +37,13 @@ import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.listener.UserOperationEventListener; import org.wso2.carbon.user.core.service.RealmService; - import java.util.Map; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Deactivate; -/** - * @scr.component name= - * "org.wso2.carbon.identity.provision.internal.IdentityProvisionServiceComponent" - * immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="realm.service" interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="provisioning.connector.factory" - * interface="org.wso2.carbon.identity.provisioning.AbstractProvisioningConnectorFactory" - * cardinality="1..n" policy="dynamic" bind="setProvisioningConnectorFactory" - * unbind="unsetProvisioningConnectorFactory" - * @scr.reference name="identity.entitlement.service" - * interface="org.wso2.carbon.identity.entitlement.EntitlementService" - * cardinality="1..n" policy="dynamic" bind="setEntitlementService" - * unbind="unsetEntitlementService" - */ - - +@Component( + name = "null", + immediate = true) public class IdentityProvisionServiceComponent { private static final Log log = LogFactory.getLog(IdentityProvisionServiceComponent.class); @@ -77,6 +58,12 @@ public static RealmService getRealmService() { /** * @param realmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting the Realm Service"); @@ -94,6 +81,12 @@ public static RegistryService getRegistryService() { /** * @param registryService */ + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("Setting the Registry Service"); @@ -111,11 +104,10 @@ public static Map getConnectorFact /** * @param context */ + @Activate protected void activate(ComponentContext context) { - try { ProvisioningServiceDataHolder.getInstance().setBundleContext(context.getBundleContext()); - ProvisioningServiceDataHolder.getInstance().getBundleContext().registerService(UserOperationEventListener.class.getName(), new DefaultInboundUserProvisioningListener(), null); if (log.isDebugEnabled()) { log.debug("Identity Provision Event listener registered successfully"); @@ -136,10 +128,10 @@ protected void activate(ComponentContext context) { } } - /** * @param context */ + @Deactivate protected void deactivate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Identity Provision bundle is de-activated"); @@ -166,14 +158,17 @@ protected void unsetRealmService(RealmService realmService) { ProvisioningServiceDataHolder.getInstance().setRealmService(null); } - + @Reference( + name = "provisioning.connector.factory", + service = org.wso2.carbon.identity.provisioning.AbstractProvisioningConnectorFactory.class, + cardinality = ReferenceCardinality.AT_LEAST_ONE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetProvisioningConnectorFactory") protected void setProvisioningConnectorFactory(AbstractProvisioningConnectorFactory connectorFactory) { - ProvisioningServiceDataHolder.getInstance().getConnectorFactories().put(connectorFactory.getConnectorType(), connectorFactory); if (log.isDebugEnabled()) { log.debug("Added provisioning connector : " + connectorFactory.getConnectorType()); } - ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig(); provisioningConnectorConfig.setName(connectorFactory.getConnectorType()); Property[] property = new Property[connectorFactory.getConfigurationProperties().size()]; @@ -181,13 +176,10 @@ protected void setProvisioningConnectorFactory(AbstractProvisioningConnectorFact ProvisioningConnectorService.getInstance().addProvisioningConnectorConfigs(provisioningConnectorConfig); } - protected void unsetProvisioningConnectorFactory(AbstractProvisioningConnectorFactory connectorFactory) { ProvisioningServiceDataHolder.getInstance().getConnectorFactories().values().remove(connectorFactory); - ProvisioningConnectorConfig provisioningConnectorConfig = ProvisioningConnectorService.getInstance(). - getProvisioningConnectorByName(connectorFactory.getConnectorType()); + ProvisioningConnectorConfig provisioningConnectorConfig = ProvisioningConnectorService.getInstance().getProvisioningConnectorByName(connectorFactory.getConnectorType()); ProvisioningConnectorService.getInstance().removeProvisioningConnectorConfigs(provisioningConnectorConfig); - if (log.isDebugEnabled()) { log.debug("Removed provisioning connector : " + connectorFactory.getConnectorType()); } @@ -196,6 +188,12 @@ protected void unsetProvisioningConnectorFactory(AbstractProvisioningConnectorFa /** * @param entitlementService */ + @Reference( + name = "identity.entitlement.service", + service = org.wso2.carbon.identity.entitlement.EntitlementService.class, + cardinality = ReferenceCardinality.AT_LEAST_ONE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetEntitlementService") protected void setEntitlementService(EntitlementService entitlementService) { if (log.isDebugEnabled()) { log.debug("EntitlementService is set in the Application Authentication Framework bundle"); @@ -207,10 +205,10 @@ protected void setEntitlementService(EntitlementService entitlementService) { * @param entitlementService */ protected void unsetEntitlementService(EntitlementService entitlementService) { - if (log.isDebugEnabled()) { log.debug("EntitlementService is unset in the Application Authentication Framework bundle"); } ProvisioningServiceDataHolder.getInstance().setEntitlementService(null); } } + diff --git a/components/user-mgt/org.wso2.carbon.identity.user.profile/src/main/java/org/wso2/carbon/identity/user/profile/mgt/internal/IdentityUserProfileServiceComponent.java b/components/user-mgt/org.wso2.carbon.identity.user.profile/src/main/java/org/wso2/carbon/identity/user/profile/mgt/internal/IdentityUserProfileServiceComponent.java index 274e870a536a..4bbc3c4ec651 100644 --- a/components/user-mgt/org.wso2.carbon.identity.user.profile/src/main/java/org/wso2/carbon/identity/user/profile/mgt/internal/IdentityUserProfileServiceComponent.java +++ b/components/user-mgt/org.wso2.carbon.identity.user.profile/src/main/java/org/wso2/carbon/identity/user/profile/mgt/internal/IdentityUserProfileServiceComponent.java @@ -15,13 +15,17 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.identity.user.profile.mgt.internal; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil; import org.wso2.carbon.identity.user.profile.mgt.listener.ProfileMgtEventListener; @@ -35,29 +39,20 @@ import java.sql.ResultSet; import java.sql.SQLException; -/** - * @scr.component name="identity.user.profile.mgt.component" immediate="true" - * @scr.reference name="user.realm.default" - * interface="org.wso2.carbon.user.core.UserRealm" - * cardinality="1..1" policy="dynamic" - * bind="setUserRealmDefault" unbind="unsetUserRealmDefault" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - */ +@Component( + name = "identity.user.profile.mgt.component", + immediate = true) public class IdentityUserProfileServiceComponent { private static final Log log = LogFactory.getLog(IdentityUserProfileServiceComponent.class); + @Activate protected void activate(ComponentContext ctxt) { - try { if (log.isDebugEnabled()) { log.debug("User Profile Mgt bundle is activated "); } - - ServiceRegistration userStoreConfigEventSR = ctxt.getBundleContext().registerService( - UserStoreConfigListener.class.getName(), new UserStoreConfigListenerImpl(), null); + ServiceRegistration userStoreConfigEventSR = ctxt.getBundleContext().registerService(UserStoreConfigListener.class.getName(), new UserStoreConfigListenerImpl(), null); if (userStoreConfigEventSR != null) { if (log.isDebugEnabled()) { log.debug("User profile management - UserStoreConfigListener registered."); @@ -65,15 +60,12 @@ protected void activate(ComponentContext ctxt) { } else { log.error("User profile management - UserStoreConfigListener could not be registered."); } - ServiceRegistration profileMgtEventSR = ctxt.getBundleContext().registerService( - UserOperationEventListener.class.getName(), new ProfileMgtEventListener(), null); - + ServiceRegistration profileMgtEventSR = ctxt.getBundleContext().registerService(UserOperationEventListener.class.getName(), new ProfileMgtEventListener(), null); // Check whether the IDN tables exist at the beginning. ServiceHodler.setIsIDNTableExist(isIDNTablesExist()); if (log.isDebugEnabled()) { log.debug("Is IDN_ASSOCIATED_ID table exist: " + ServiceHodler.isIDNTableExist()); } - if (profileMgtEventSR != null) { if (log.isDebugEnabled()) { log.debug("User profile management - ProfileMgtEventListener registered."); @@ -87,8 +79,13 @@ protected void activate(ComponentContext ctxt) { } // the below two methods are kept just to be sure the realm is available. + @Reference( + name = "user.realm.default", + service = org.wso2.carbon.user.core.UserRealm.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetUserRealmDefault") protected void setUserRealmDefault(UserRealm userRealmDefault) { - if (log.isDebugEnabled()) { log.debug("Setting DefaultRealm in User Profile Management"); } @@ -96,20 +93,25 @@ protected void setUserRealmDefault(UserRealm userRealmDefault) { } protected void unsetUserRealmDefault(UserRealm userRealmDefault) { - if (log.isDebugEnabled()) { log.info("Un-setting DefaultRealm in User Profile Management"); } ServiceHodler.setInternalUserStore(null); } + @Reference( + name = "identityCoreInitializedEventService", + service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService") protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } @@ -118,12 +120,10 @@ protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedE * @return True if table exist. */ private boolean isIDNTablesExist() { - try (Connection connection = IdentityDatabaseUtil.getDBConnection()) { - // Try to find whether there is IDN_ASSOCIATED_ID table. DatabaseMetaData metaData = connection.getMetaData(); - try (ResultSet resultSet = metaData.getTables(null, null, "IDN_ASSOCIATED_ID", new String[]{"TABLE"})) { + try (ResultSet resultSet = metaData.getTables(null, null, "IDN_ASSOCIATED_ID", new String[] { "TABLE" })) { if (resultSet.next()) { return true; } @@ -131,7 +131,6 @@ private boolean isIDNTablesExist() { } catch (SQLException e) { return false; } - return false; } } diff --git a/components/user-mgt/org.wso2.carbon.identity.user.registration/src/main/java/org/wso2/carbon/identity/user/registration/internal/UserRegistrationDSComponent.java b/components/user-mgt/org.wso2.carbon.identity.user.registration/src/main/java/org/wso2/carbon/identity/user/registration/internal/UserRegistrationDSComponent.java index 4029bee4b9c9..032f3a900414 100644 --- a/components/user-mgt/org.wso2.carbon.identity.user.registration/src/main/java/org/wso2/carbon/identity/user/registration/internal/UserRegistrationDSComponent.java +++ b/components/user-mgt/org.wso2.carbon.identity.user.registration/src/main/java/org/wso2/carbon/identity/user/registration/internal/UserRegistrationDSComponent.java @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.identity.user.registration.internal; import org.apache.commons.logging.Log; @@ -23,30 +22,34 @@ import org.osgi.service.component.ComponentContext; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; - -/** - * @scr.component name="usermgt.component"" immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - */ +@Component( + name = "usermgt.component", + immediate = true) public class UserRegistrationDSComponent { private static final Log log = LogFactory.getLog(UserRegistrationDSComponent.class); private static RegistryService registryService = null; + private static RealmService realmService = null; public static RegistryService getRegistryService() { return registryService; } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.info("Setting the Registry Service"); @@ -58,6 +61,12 @@ public static RealmService getRealmService() { return realmService; } + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.info("Setting the Realm Service"); @@ -65,10 +74,12 @@ protected void setRealmService(RealmService realmService) { UserRegistrationDSComponent.realmService = realmService; } + @Activate protected void activate(ComponentContext ctxt) { log.debug("UserRegistration bundle is activated "); } + @Deactivate protected void deactivate(ComponentContext ctxt) { log.debug("UserRegistration bundle is deactivated "); } @@ -86,5 +97,5 @@ protected void unsetRealmService(RealmService realmService) { } UserRegistrationDSComponent.realmService = null; } - } + diff --git a/components/user-mgt/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/internal/UserMgtDSComponent.java b/components/user-mgt/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/internal/UserMgtDSComponent.java index 9bd2fc672ef0..c85611eb6789 100644 --- a/components/user-mgt/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/internal/UserMgtDSComponent.java +++ b/components/user-mgt/org.wso2.carbon.user.mgt/src/main/java/org/wso2/carbon/user/mgt/internal/UserMgtDSComponent.java @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.user.mgt.internal; import org.apache.commons.logging.Log; @@ -32,35 +31,31 @@ import org.wso2.carbon.user.mgt.listeners.PermissionAuthorizationListener; import org.wso2.carbon.user.mgt.listeners.UserMgtAuditLogger; import org.wso2.carbon.user.mgt.permission.ManagementPermissionsAdder; - -/** - * @scr.component name="usermgt.component"" immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" - * cardinality="1..1" policy="dynamic" bind="setIdentityCoreInitializedEventService" - * unbind="unsetIdentityCoreInitializedEventService" - */ +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; + +@Component( + name = "usermgt.component", + immediate = true) public class UserMgtDSComponent { + private static final Log log = LogFactory.getLog(UserMgtDSComponent.class); + private static RegistryService registryService = null; + private static RealmService realmService = null; + @Activate protected void activate(ComponentContext ctxt) { log.debug("User Mgt bundle is activated "); - // for new cahing, every thread should has its own populated CC. During the deployment time we assume super tenant PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); carbonContext.setTenantDomain(org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); carbonContext.setTenantId(org.wso2.carbon.base.MultitenantConstants.SUPER_TENANT_ID); - UserMgtInitializer userMgtInitializer = new UserMgtInitializer(); try { userMgtInitializer.start(ctxt.getBundleContext(), registryService); @@ -74,9 +69,7 @@ protected void activate(ComponentContext ctxt) { } // register the Authorization listener to restriction tenant!=0 setting super tenant // specific permissions - ServiceRegistration serviceRegistration = ctxt.getBundleContext().registerService - (AuthorizationManagerListener.class.getName(), - new PermissionAuthorizationListener(), null); + ServiceRegistration serviceRegistration = ctxt.getBundleContext().registerService(AuthorizationManagerListener.class.getName(), new PermissionAuthorizationListener(), null); if (serviceRegistration == null) { log.error("Error while registering PermissionAuthorizationListener."); } else { @@ -84,8 +77,7 @@ protected void activate(ComponentContext ctxt) { log.debug("PermissionAuthorizationListener successfully registered."); } } - serviceRegistration = ctxt.getBundleContext().registerService(UserOperationEventListener.class.getName(), - new UserMgtAuditLogger(), null); + serviceRegistration = ctxt.getBundleContext().registerService(UserOperationEventListener.class.getName(), new UserMgtAuditLogger(), null); if (serviceRegistration == null) { log.error("Error while registering UserMgtAuditLogger."); } else { @@ -95,14 +87,21 @@ protected void activate(ComponentContext ctxt) { } } catch (Throwable e) { log.error(e.getMessage(), e); - // don't throw exception + // don't throw exception } } + @Deactivate protected void deactivate(ComponentContext ctxt) { log.debug("User Mgt bundle is deactivated "); } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.info("Setting the Registry Service"); @@ -117,6 +116,12 @@ protected void unsetRegistryService(RegistryService registryService) { UserMgtDSComponent.registryService = null; } + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.info("Setting the Realm Service"); @@ -131,13 +136,19 @@ protected void unsetRealmService(RealmService realmService) { UserMgtDSComponent.realmService = null; } + @Reference( + name = "identityCoreInitializedEventService", + service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService") protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } @@ -148,5 +159,5 @@ public static RegistryService getRegistryService() { public static RealmService getRealmService() { return realmService; } - } + diff --git a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowMgtServiceComponent.java b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowMgtServiceComponent.java index beb1abae5f74..9150e3935efa 100644 --- a/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowMgtServiceComponent.java +++ b/components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/internal/WorkflowMgtServiceComponent.java @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.identity.workflow.mgt.internal; import org.apache.commons.logging.Log; @@ -23,6 +22,11 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.identity.workflow.mgt.WorkflowManagementService; @@ -35,65 +39,23 @@ import org.wso2.carbon.identity.workflow.mgt.template.AbstractTemplate; import org.wso2.carbon.identity.workflow.mgt.util.WFConstant; import org.wso2.carbon.identity.workflow.mgt.workflow.AbstractWorkflow; -import org.wso2.carbon.user.core.listener.UserOperationEventListener; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="org.wso2.carbon.identity.workflow.mgt" immediate="true" - * @scr.reference name="user.realmservice.default" interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="org.wso2.carbon.identity.workflow.mgt.extension.requesthandler" - * interface="org.wso2.carbon.identity.workflow.mgt.extension.WorkflowRequestHandler" - * cardinality="0..n" policy="dynamic" - * bind="setWorkflowRequestHandler" - * unbind="unsetWorkflowRequestHandler" - * @scr.reference name="org.wso2.carbon.identity.workflow.mgt.template.abtracttemplate" - * interface="org.wso2.carbon.identity.workflow.mgt.template.AbstractTemplate" - * cardinality="0..n" policy="dynamic" - * bind="setTemplate" - * unbind="unsetTemplate" - * @scr.reference name="org.wso2.carbon.identity.workflow.mgt.workflow.abstractworkflow" - * interface="org.wso2.carbon.identity.workflow.mgt.workflow.AbstractWorkflow" - * cardinality="0..n" policy="dynamic" - * bind="setWorkflowImplementation" - * unbind="unsetWorkflowImplementation" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - * @scr.reference name="org.wso2.carbon.utils.contextservice" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="1..1" policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="org.wso2.carbon.identity.workflow.mgt.listener.deleterequest" - * interface="org.wso2.carbon.identity.workflow.mgt.listener.WorkflowListener" - * cardinality="0..n" policy="dynamic" - * bind="setWorkflowRequestDeleteListener" - * unbind="unsetWorkflowRequestDeleteListener" - * @scr.reference name="org.wso2.carbon.identity.workflow.mgt.listener.workflowexecutorlistner" - * interface="org.wso2.carbon.identity.workflow.mgt.listener.WorkflowExecutorManagerListener" - * cardinality="0..n" policy="dynamic" - * bind="setWorkflowExecutorListener" - * unbind="unsetWorkflowExecutorListener" - */ +@Component( + name = "org.wso2.carbon.identity.workflow.mgt", + immediate = true) public class WorkflowMgtServiceComponent { - + @Activate protected void activate(ComponentContext context) { - BundleContext bundleContext = context.getBundleContext(); WorkflowManagementService workflowService = new WorkflowManagementServiceImpl(); - bundleContext.registerService(WorkflowManagementService.class, workflowService, null); WorkflowServiceDataHolder.getInstance().setWorkflowService(workflowService); - - WorkflowServiceDataHolder.getInstance().setBundleContext(bundleContext); - ServiceRegistration serviceRegistration = context.getBundleContext().registerService - (WorkflowListener.class.getName(), new WorkflowAuditLogger(), null); - context.getBundleContext().registerService - (WorkflowExecutorManagerListener.class.getName(), new WorkflowExecutorAuditLogger(), null); + ServiceRegistration serviceRegistration = context.getBundleContext().registerService(WorkflowListener.class.getName(), new WorkflowAuditLogger(), null); + context.getBundleContext().registerService(WorkflowExecutorManagerListener.class.getName(), new WorkflowExecutorAuditLogger(), null); if (serviceRegistration != null) { if (log.isDebugEnabled()) { log.debug("WorkflowAuditLogger registered."); @@ -102,99 +64,127 @@ protected void activate(ComponentContext context) { log.error("Workflow Audit Logger could not be registered."); } if (System.getProperty(WFConstant.KEYSTORE_SYSTEM_PROPERTY_ID) == null) { - System.setProperty(WFConstant.KEYSTORE_SYSTEM_PROPERTY_ID, ServerConfiguration.getInstance() - .getFirstProperty(WFConstant.KEYSTORE_CARBON_CONFIG_PATH)); + System.setProperty(WFConstant.KEYSTORE_SYSTEM_PROPERTY_ID, ServerConfiguration.getInstance().getFirstProperty(WFConstant.KEYSTORE_CARBON_CONFIG_PATH)); } if (System.getProperty(WFConstant.KEYSTORE_PASSWORD_SYSTEM_PROPERTY_ID) == null) { - System.setProperty(WFConstant.KEYSTORE_PASSWORD_SYSTEM_PROPERTY_ID, ServerConfiguration.getInstance() - .getFirstProperty(WFConstant.KEYSTORE_PASSWORD_CARBON_CONFIG_PATH)); + System.setProperty(WFConstant.KEYSTORE_PASSWORD_SYSTEM_PROPERTY_ID, ServerConfiguration.getInstance().getFirstProperty(WFConstant.KEYSTORE_PASSWORD_CARBON_CONFIG_PATH)); } } private static Log log = LogFactory.getLog(WorkflowMgtServiceComponent.class); + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { - WorkflowServiceDataHolder.getInstance().setRealmService(realmService); } protected void unsetRealmService(RealmService realmService) { - WorkflowServiceDataHolder.getInstance().setRealmService(null); } protected void unsetConfigurationContextService(ConfigurationContextService contextService) { - WorkflowServiceDataHolder.getInstance().setConfigurationContextService(null); } + @Reference( + name = "org.wso2.carbon.utils.contextservice", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService contextService) { - WorkflowServiceDataHolder.getInstance().setConfigurationContextService(contextService); } + @Reference( + name = "org.wso2.carbon.identity.workflow.mgt.extension.requesthandler", + service = org.wso2.carbon.identity.workflow.mgt.extension.WorkflowRequestHandler.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetWorkflowRequestHandler") protected void setWorkflowRequestHandler(WorkflowRequestHandler workflowRequestHandler) { - WorkflowServiceDataHolder.getInstance().addWorkflowRequestHandler(workflowRequestHandler); } protected void unsetWorkflowRequestHandler(WorkflowRequestHandler workflowRequestHandler) { - WorkflowServiceDataHolder.getInstance().removeWorkflowRequestHandler(workflowRequestHandler); } + @Reference( + name = "org.wso2.carbon.identity.workflow.mgt.template.abtracttemplate", + service = org.wso2.carbon.identity.workflow.mgt.template.AbstractTemplate.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTemplate") protected void setTemplate(AbstractTemplate template) { - WorkflowServiceDataHolder.getInstance().addTemplate(template); } protected void unsetTemplate(AbstractTemplate template) { - WorkflowServiceDataHolder.getInstance().removeTemplate(template); } + @Reference( + name = "org.wso2.carbon.identity.workflow.mgt.workflow.abstractworkflow", + service = org.wso2.carbon.identity.workflow.mgt.workflow.AbstractWorkflow.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetWorkflowImplementation") protected void setWorkflowImplementation(AbstractWorkflow workflowImplementation) { - WorkflowServiceDataHolder.getInstance().addWorkflowImplementation(workflowImplementation); } protected void unsetWorkflowImplementation(AbstractWorkflow workflowImplementation) { - WorkflowServiceDataHolder.getInstance().removeWorkflowImplementation(workflowImplementation); } - + @Reference( + name = "org.wso2.carbon.identity.workflow.mgt.listener.deleterequest", + service = org.wso2.carbon.identity.workflow.mgt.listener.WorkflowListener.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetWorkflowRequestDeleteListener") protected void setWorkflowRequestDeleteListener(WorkflowListener workflowListener) { - WorkflowServiceDataHolder.getInstance().getWorkflowListenerList() - .add(workflowListener); + WorkflowServiceDataHolder.getInstance().getWorkflowListenerList().add(workflowListener); } protected void unsetWorkflowRequestDeleteListener(WorkflowListener workflowListener) { - WorkflowServiceDataHolder.getInstance().getWorkflowListenerList() - .remove(workflowListener); + WorkflowServiceDataHolder.getInstance().getWorkflowListenerList().remove(workflowListener); } + @Reference( + name = "org.wso2.carbon.identity.workflow.mgt.listener.workflowexecutorlistner", + service = org.wso2.carbon.identity.workflow.mgt.listener.WorkflowExecutorManagerListener.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetWorkflowExecutorListener") protected void setWorkflowExecutorListener(WorkflowExecutorManagerListener workflowListener) { - WorkflowServiceDataHolder.getInstance().getExecutorListenerList() - .add(workflowListener); + WorkflowServiceDataHolder.getInstance().getExecutorListenerList().add(workflowListener); } protected void unsetWorkflowExecutorListener(WorkflowExecutorManagerListener workflowListener) { - WorkflowServiceDataHolder.getInstance().getExecutorListenerList() - .remove(workflowListener); + WorkflowServiceDataHolder.getInstance().getExecutorListenerList().remove(workflowListener); } - - protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } + @Reference( + name = "identityCoreInitializedEventService", + service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService") protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } - - } + From 3383b7acaf04585959c3a44b706c77228525516f Mon Sep 17 00:00:00 2001 From: Pulasthi Mahawithana Date: Wed, 10 Jan 2018 19:35:59 +0530 Subject: [PATCH 2/3] Fix SCR annotations of the classes missed by tool --- .../ApplicationMgtUIServiceComponent.java | 46 +++++++--- ...ApplicationManagementServiceComponent.java | 60 ++++++++----- ...pplicationMgtListenerServiceComponent.java | 24 +++-- .../internal/FrameworkServiceComponent.java | 18 ++-- .../internal/EntitlementServiceComponent.java | 85 +++++++++++------- .../IdentityCoreServiceComponent.java | 79 +++++++++++------ .../internal/IdentityMgtServiceComponent.java | 68 ++++++++++----- ...IdentityProviderMgtUIServiceComponent.java | 35 +++++--- .../IdPManagementServiceComponent.java | 87 ++++++++++++------- .../SecurityDeploymentInterceptor.java | 33 +++++-- .../internal/SecurityMgtServiceComponent.java | 70 ++++++++++----- .../internal/UserStoreConfigComponent.java | 48 ++++++---- .../internal/UserStoreConfigComponent.java | 62 ++++++++----- .../internal/UserStoreCountDSComponent.java | 45 ++++++---- 14 files changed, 505 insertions(+), 255 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/src/main/java/org/wso2/carbon/identity/application/mgt/ui/internal/ApplicationMgtUIServiceComponent.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/src/main/java/org/wso2/carbon/identity/application/mgt/ui/internal/ApplicationMgtUIServiceComponent.java index d9338cd908ef..c1c5cc4ae5c7 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/src/main/java/org/wso2/carbon/identity/application/mgt/ui/internal/ApplicationMgtUIServiceComponent.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/src/main/java/org/wso2/carbon/identity/application/mgt/ui/internal/ApplicationMgtUIServiceComponent.java @@ -21,35 +21,44 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="org.wso2.carbon.identity.application.mgt.ui" immediate="true" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1" - * policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - */ +@Component( + name = "org.wso2.carbon.identity.application.mgt.ui", + immediate = true +) public class ApplicationMgtUIServiceComponent { private static final Log log = LogFactory.getLog(ApplicationMgtUIServiceComponent.class); + @Activate protected void activate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Application Management UI bundle acticated!"); } } + @Deactivate protected void deactivate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Application Management UI bundle is deactivated"); } } + @Reference( + name = "config.context.service", + service = ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService" + ) protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { ApplicationMgtServiceComponentHolder.getInstance().setConfigurationContextService(configurationContextService); if (log.isDebugEnabled()) { @@ -64,14 +73,23 @@ protected void unsetConfigurationContextService(ConfigurationContextService conf } } - protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) + protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } - protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { - /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core + protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } + + } diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationManagementServiceComponent.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationManagementServiceComponent.java index b8732ccb3845..14803936a411 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationManagementServiceComponent.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationManagementServiceComponent.java @@ -25,6 +25,12 @@ import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.application.common.model.ServiceProvider; import org.wso2.carbon.identity.application.mgt.AbstractInboundAuthenticatorConfig; import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; @@ -46,26 +52,10 @@ import java.util.HashMap; import java.util.Map; -/** - * @scr.component name="identity.application.management.component" immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="configuration.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="1..1" policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="application.mgt.authenticator" - * interface="org.wso2.carbon.identity.application.mgt.AbstractInboundAuthenticatorConfig" - * cardinality="0..n" policy="dynamic" bind="setInboundAuthenticatorConfig" - * unbind="unsetInboundAuthenticatorConfig" - */ +@Component( + name = "identity.application.management.component", + immediate = true +) public class ApplicationManagementServiceComponent { private static Log log = LogFactory.getLog(ApplicationManagementServiceComponent.class); private static BundleContext bundleContext; @@ -75,6 +65,7 @@ public static Map getFileBasedSPs() { return fileBasedSPs; } + @Activate protected void activate(ComponentContext context) { try { bundleContext = context.getBundleContext(); @@ -96,12 +87,20 @@ protected void activate(ComponentContext context) { } } + @Deactivate protected void deactivate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Identity ApplicationManagementComponent bundle is deactivated"); } } + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService" + ) protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("RegistryService set in Identity ApplicationManagementComponent bundle"); @@ -116,6 +115,13 @@ protected void unsetRegistryService(RegistryService registryService) { ApplicationManagementServiceComponentHolder.getInstance().setRegistryService(null); } + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting the Realm Service"); @@ -130,6 +136,13 @@ protected void unsetRealmService(RealmService realmService) { ApplicationManagementServiceComponentHolder.getInstance().setRealmService(null); } + @Reference( + name = "configuration.context.service", + service = ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService" + ) protected void setConfigurationContextService(ConfigurationContextService configContextService) { if (log.isDebugEnabled()) { log.debug("Setting the Configuration Context Service"); @@ -144,6 +157,13 @@ protected void unsetConfigurationContextService(ConfigurationContextService conf ApplicationManagementServiceComponentHolder.getInstance().setConfigContextService(null); } + @Reference( + name = "application.mgt.authenticator", + service = AbstractInboundAuthenticatorConfig.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetInboundAuthenticatorConfig" + ) protected void setInboundAuthenticatorConfig(AbstractInboundAuthenticatorConfig authenticator) { ApplicationManagementServiceComponentHolder.addInboundAuthenticatorConfig(authenticator); } diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationMgtListenerServiceComponent.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationMgtListenerServiceComponent.java index 6f55fd094a68..f91c3ce0e9b8 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationMgtListenerServiceComponent.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/internal/ApplicationMgtListenerServiceComponent.java @@ -18,6 +18,10 @@ package org.wso2.carbon.identity.application.mgt.internal; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.application.mgt.listener.ApplicationMgtListener; import java.util.ArrayList; @@ -26,19 +30,21 @@ import java.util.Comparator; import java.util.List; -/** - * @scr.component name="org.wso2.carbon.identity.application.mgt.listener" - * immediate="true" - * @scr.reference name="application.mgt.event.listener.service" - * interface="org.wso2.carbon.identity.application.mgt.listener.ApplicationMgtListener" - * cardinality="0..n" policy="dynamic" - * bind="setApplicationMgtListenerService" - * unbind="unsetApplicationMgtListenerService" - */ +@Component( + name = "org.wso2.carbon.identity.application.mgt.listener", + immediate = true +) public class ApplicationMgtListenerServiceComponent { private static List applicationMgtListeners = new ArrayList<>(); + @Reference( + name = "application.mgt.event.listener.service", + service = ApplicationMgtListener.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetApplicationMgtListenerService" + ) protected static synchronized void setApplicationMgtListenerService( ApplicationMgtListener applicationMgtListenerService) { diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java index 0e8fef601707..93871978e8a0 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java @@ -88,7 +88,7 @@ public static RealmService getRealmService() { @Reference( name = "user.realmservice.default", - service = org.wso2.carbon.user.core.service.RealmService.class, + service = RealmService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetRealmService" @@ -106,7 +106,7 @@ public static RegistryService getRegistryService() { @Reference( name = "registry.service", - service = org.wso2.carbon.registry.core.service.RegistryService.class, + service = RegistryService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetRegistryService" @@ -198,7 +198,7 @@ protected void deactivate(ComponentContext ctxt) { @Reference( name = "osgi.httpservice", - service = org.osgi.service.http.HttpService.class, + service = HttpService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetHttpService" @@ -235,7 +235,7 @@ protected void unsetRegistryService(RegistryService registryService) { @Reference( name = "application.authenticator", - service = org.wso2.carbon.identity.application.authentication.framework.ApplicationAuthenticator.class, + service = ApplicationAuthenticator.class, cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetAuthenticator" @@ -304,7 +304,7 @@ protected void unsetAuthenticator(ApplicationAuthenticator authenticator) { @Reference( name = "identity.processor", - service = org.wso2.carbon.identity.application.authentication.framework.inbound.IdentityProcessor.class, + service = IdentityProcessor.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeIdentityProcessor" @@ -331,7 +331,7 @@ protected void removeIdentityProcessor(IdentityProcessor requestProcessor) { @Reference( name = "identity.request.factory", - service = org.wso2.carbon.identity.application.authentication.framework.inbound.HttpIdentityRequestFactory.class, + service = HttpIdentityRequestFactory.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeHttpIdentityRequestFactory" @@ -358,7 +358,7 @@ protected void removeHttpIdentityRequestFactory(HttpIdentityRequestFactory facto @Reference( name = "identity.response.factory", - service = org.wso2.carbon.identity.application.authentication.framework.inbound.HttpIdentityResponseFactory.class, + service = HttpIdentityResponseFactory.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeHttpIdentityResponseFactory" @@ -390,7 +390,7 @@ protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedE @Reference( name = "identityCoreInitializedEventService", - service = org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent.class, + service = IdentityCoreInitializedEvent.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetIdentityCoreInitializedEventService" @@ -402,7 +402,7 @@ protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEve @Reference( name = "identity.authentication.data.publisher", - service = org.wso2.carbon.identity.application.authentication.framework.AuthenticationDataPublisher.class, + service = AuthenticationDataPublisher.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetAuthenticationDataPublisher" diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/internal/EntitlementServiceComponent.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/internal/EntitlementServiceComponent.java index 62b2f82da8b0..1501be1baa44 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/internal/EntitlementServiceComponent.java +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/internal/EntitlementServiceComponent.java @@ -28,6 +28,12 @@ import org.apache.thrift.transport.TServerSocket; import org.apache.thrift.transport.TTransportException; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.identity.core.util.IdentityUtil; import org.wso2.carbon.identity.entitlement.EntitlementUtil; @@ -58,33 +64,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -/** - * @scr.component name="identity.entitlement.component" immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="1..1" policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - * @scr.reference name="org.wso2.carbon.identity.thrift.authentication.internal.ThriftAuthenticationServiceComponent" - * interface="org.wso2.carbon.identity.thrift.authentication.ThriftAuthenticatorService" - * cardinality="1..1" policy="dynamic" bind="setThriftAuthenticationService" unbind="unsetThriftAuthenticationService" - * @scr.reference name="carbon.identity.notification.mgt" - * interface="org.wso2.carbon.identity.notification.mgt.NotificationSender" - * cardinality="1..1" policy="dynamic" bind="setNotificationSender" - * unbind="unsetNotificationSender" - */ - - +@Component( + name = "identity.entitlement.component", + immediate = true) public class EntitlementServiceComponent { /** @@ -140,6 +122,13 @@ public static RegistryService getRegistryService() { * * @param registryService RegistryService */ + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService" + ) protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("RegistryService set in Entitlement bundle"); @@ -175,6 +164,13 @@ public static NotificationSender getNotificationSender() { return EntitlementServiceComponent.notificationSender; } + @Reference( + name = "carbon.identity.notification.mgt", + service = NotificationSender.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetNotificationSender" + ) protected void setNotificationSender(NotificationSender notificationSender) { if (log.isDebugEnabled()) { log.debug("Un-setting notification sender in Entitlement bundle"); @@ -185,6 +181,7 @@ protected void setNotificationSender(NotificationSender notificationSender) { /** * @param ctxt */ + @Activate protected void activate(ComponentContext ctxt) { if (log.isDebugEnabled()) { @@ -313,6 +310,7 @@ protected void activate(ComponentContext ctxt) { /** * @param ctxt */ + @Deactivate protected void deactivate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.debug("Identity Entitlement bundle is deactivated"); @@ -336,6 +334,13 @@ protected void unsetRegistryService(RegistryService registryService) { * * @param realmService RealmService */ + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("DefaultUserRealm set in Entitlement bundle"); @@ -360,6 +365,13 @@ protected void unsetRealmService(RealmService realmService) { * * @param authenticationService ThriftAuthenticatorService */ + @Reference( + name = "org.wso2.carbon.identity.thrift.authentication.internal.ThriftAuthenticationServiceComponent", + service = ThriftAuthenticatorService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetThriftAuthenticationService" + ) protected void setThriftAuthenticationService(ThriftAuthenticatorService authenticationService) { if (log.isDebugEnabled()) { log.debug("ThriftAuthenticatorService set in Entitlement bundle"); @@ -524,18 +536,31 @@ protected void unsetNotificationSender(NotificationSender notificationSender) { this.notificationSender = null; } + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) - protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } - protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } - + @Reference( + name = "config.context.service", + service = ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService" + ) protected void setConfigurationContextService(ConfigurationContextService configCtxtService) { if (log.isDebugEnabled()) { log.debug("ConfigurationContextService set in EntitlementServiceComponent bundle."); diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/IdentityCoreServiceComponent.java b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/IdentityCoreServiceComponent.java index 8bb01b195ac1..e6b22c4ec380 100644 --- a/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/IdentityCoreServiceComponent.java +++ b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/IdentityCoreServiceComponent.java @@ -21,6 +21,12 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.base.api.ServerConfigurationService; import org.wso2.carbon.core.util.KeyStoreManager; @@ -40,31 +46,10 @@ import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="identity.core.component" immediate="true" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1" - * policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="server.configuration.service" - * interface="org.wso2.carbon.base.api.ServerConfigurationService" cardinality="1..1" - * policy="dynamic" bind="setServerConfigurationService" - * unbind="unsetServerConfigurationService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="registry.loader.default" - * interface="org.wso2.carbon.registry.core.service.TenantRegistryLoader" - * cardinality="1..1" policy="dynamic" bind="setTenantRegistryLoader" unbind="unsetTenantRegistryLoader" - * @scr.reference name="is.migration.client" - * interface="org.wso2.carbon.identity.core.migrate.MigrationClient" - * cardinality="0..1" policy="dynamic" bind="setMigrationClient" unbind="unsetMigrationClient" - */ - +@Component( + name = "identity.core.component", + immediate = true +) public class IdentityCoreServiceComponent { private static Log log = LogFactory.getLog(IdentityCoreServiceComponent.class); private static ServerConfigurationService serverConfigurationService = null; @@ -80,6 +65,13 @@ public static ServerConfigurationService getServerConfigurationService() { return IdentityCoreServiceComponent.serverConfigurationService; } + @Reference( + name = "server.configuration.service", + service = ServerConfigurationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetServerConfigurationService" + ) protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Set the ServerConfiguration Service"); @@ -102,6 +94,7 @@ public static BundleContext getBundleContext() { /** * @param ctxt */ + @Activate protected void activate(ComponentContext ctxt) throws MigrationClientException { IdentityTenantUtil.setBundleContext(ctxt.getBundleContext()); if (log.isDebugEnabled()) { @@ -185,6 +178,7 @@ protected void activate(ComponentContext ctxt) throws MigrationClientException { /** * @param ctxt */ + @Deactivate protected void deactivate(ComponentContext ctxt) { IdentityTenantUtil.setBundleContext(null); if (log.isDebugEnabled()) { @@ -192,6 +186,13 @@ protected void deactivate(ComponentContext ctxt) { } } + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService" + ) protected void setRegistryService(RegistryService registryService) { IdentityTenantUtil.setRegistryService(registryService); } @@ -203,6 +204,13 @@ protected void unsetRegistryService(RegistryService registryService) { /** * @param realmService */ + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { IdentityTenantUtil.setRealmService(realmService); } @@ -214,6 +222,13 @@ protected void unsetRealmService(RealmService realmService) { IdentityTenantUtil.setRealmService(null); } + @Reference( + name = "registry.loader.default", + service = TenantRegistryLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTenantRegistryLoader" + ) protected void setTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoader) { if (log.isDebugEnabled()) { log.debug("Tenant Registry Loader is set in the SAML SSO bundle"); @@ -238,6 +253,13 @@ public static ConfigurationContextService getConfigurationContextService() { /** * @param service */ + @Reference( + name = "config.context.service", + service = ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService" + ) protected void setConfigurationContextService(ConfigurationContextService service) { configurationContextService = service; } @@ -253,6 +275,13 @@ protected void unsetConfigurationContextService(ConfigurationContextService serv * * @param client */ + @Reference( + name = "is.migration.client", + service = MigrationClient.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetMigrationClient" + ) protected void setMigrationClient(MigrationClient client) { migrationClient = client; } diff --git a/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/internal/IdentityMgtServiceComponent.java b/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/internal/IdentityMgtServiceComponent.java index a6f984562ca4..5eb882c2c900 100644 --- a/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/internal/IdentityMgtServiceComponent.java +++ b/components/identity-mgt/org.wso2.carbon.identity.mgt/src/main/java/org/wso2/carbon/identity/mgt/internal/IdentityMgtServiceComponent.java @@ -23,6 +23,12 @@ import org.apache.commons.logging.LogFactory; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.identity.core.model.IdentityEventListenerConfig; @@ -55,27 +61,10 @@ import java.util.Dictionary; import java.util.Hashtable; -/** - * @scr.component name="org.wso2.carbon.identity.mgt.internal.IdentityMgtServiceComponent" - * immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="1..1" - * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" - * @scr.reference name="realm.service" - * interface="org.wso2.carbon.user.core.service.RealmService"cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="carbon.identity.notification.mgt" - * interface="org.wso2.carbon.identity.notification.mgt.NotificationSender" - * cardinality="1..1" policy="dynamic" bind="setNotificationSender" - * unbind="unsetNotificationSender" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - * @scr.reference name="registry.search.component" - * interface="org.wso2.carbon.registry.common.AttributeSearchService" - * cardinality="1..1" policy="dynamic" bind="setAttributeSearchService" unbind="unsetAttributeSearchService" - */ - +@Component( + name = "org.wso2.carbon.identity.mgt.internal.IdentityMgtServiceComponent", + immediate = true +) public class IdentityMgtServiceComponent { private static final String DELAY_BETWEEN_RUNS = "TimeConfig.RegistryCleanUpPeriod"; @@ -94,6 +83,13 @@ public static RealmService getRealmService() { return realmService; } + @Reference( + name = "realm.service", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { log.debug("Setting the Realm Service"); IdentityMgtServiceComponent.realmService = realmService; @@ -103,6 +99,13 @@ public static RegistryService getRegistryService() { return registryService; } + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService" + ) protected void setRegistryService(RegistryService registryService) { log.debug("Setting the Registry Service"); IdentityMgtServiceComponent.registryService = registryService; @@ -159,6 +162,7 @@ private static void init() { } + @Activate protected void activate(ComponentContext context) { Dictionary props = new Hashtable(); @@ -205,6 +209,7 @@ protected void activate(ComponentContext context) { registryCleanUpService.activateCleanUp(); } + @Deactivate protected void deactivate(ComponentContext context) { log.debug("Identity Management bundle is de-activated"); } @@ -224,6 +229,13 @@ protected void unsetConfigurationContextService(ConfigurationContextService conf IdentityMgtServiceComponent.configurationContextService = null; } + @Reference( + name = "carbon.identity.notification.mgt", + service = NotificationSender.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetNotificationSender" + ) protected void setNotificationSender(NotificationSender notificationSender) { if (log.isDebugEnabled()) { log.debug("Un-setting notification sender in Entitlement bundle"); @@ -238,6 +250,13 @@ protected void unsetNotificationSender(NotificationSender notificationSender) { this.notificationSender = null; } + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ @@ -252,6 +271,13 @@ public static NotificationSender getNotificationSender() { return IdentityMgtServiceComponent.notificationSender; } + @Reference( + name = "registry.search.component", + service = AttributeSearchService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetAttributeSearchService" + ) protected void setAttributeSearchService(AttributeSearchService searchService) { if (log.isDebugEnabled()) { diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt.ui/src/main/java/org/wso2/carbon/idp/mgt/ui/internal/IdentityProviderMgtUIServiceComponent.java b/components/idp-mgt/org.wso2.carbon.idp.mgt.ui/src/main/java/org/wso2/carbon/idp/mgt/ui/internal/IdentityProviderMgtUIServiceComponent.java index 8f1793bc2a78..4000e4d91d28 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt.ui/src/main/java/org/wso2/carbon/idp/mgt/ui/internal/IdentityProviderMgtUIServiceComponent.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt.ui/src/main/java/org/wso2/carbon/idp/mgt/ui/internal/IdentityProviderMgtUIServiceComponent.java @@ -21,40 +21,51 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; -/** - * @scr.component name="org.wso2.carbon.identity.idp.mgt.ui" immediate="true" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - */ - +@Component( + name = "org.wso2.carbon.identity.idp.mgt.ui", + immediate = true +) public class IdentityProviderMgtUIServiceComponent { private static final Log log = LogFactory.getLog(IdentityProviderMgtUIServiceComponent.class); + @Activate protected void activate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Identity Provider Management UI bundle acticated!"); } } + @Deactivate protected void deactivate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Identity Provider Management UI bundle is deactivated"); } } - protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) + + protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } - protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } - - -} \ No newline at end of file +} diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdPManagementServiceComponent.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdPManagementServiceComponent.java index 13358ecf1c27..7b186be05d1a 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdPManagementServiceComponent.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/internal/IdPManagementServiceComponent.java @@ -26,6 +26,12 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.identity.application.common.model.IdentityProvider; import org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants; @@ -61,33 +67,10 @@ import java.util.Map; import java.util.Set; -/** - * @scr.component name="idp.mgt.dscomponent" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1" - * policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - * @scr.reference name="idp.mgt.event.listener.service" - * interface="org.wso2.carbon.idp.mgt.listener.IdentityProviderMgtListener" - * cardinality="0..n" policy="dynamic" - * bind="setIdentityProviderMgtListenerService" - * unbind="unsetIdentityProviderMgtListenerService" - * @scr.reference name="identity.provider.saml.service.component" - * interface="org.wso2.carbon.idp.mgt.util.MetadataConverter" - * cardinality="0..n" policy="dynamic" - * bind="setMetadataConverterService" - * unbind="unsetMetadataConverterService" - */ +@Component( + name = "idp.mgt.dscomponent", + immediate = true +) public class IdPManagementServiceComponent { private static Log log = LogFactory.getLog(IdPManagementServiceComponent.class); @@ -98,8 +81,13 @@ public class IdPManagementServiceComponent { private static Set sharedIdps = new HashSet(); - - + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService" + ) protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("Registry service in Identity idp-mgt bundle"); @@ -118,6 +106,13 @@ protected void unsetRegistryService(RegistryService registryService) { IdpMgtServiceComponentHolder.getInstance().setRegistryService(null); } + @Reference( + name = "identity.provider.saml.service.component", + service = MetadataConverter.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetMetadataConverterService" + ) protected void setMetadataConverterService(MetadataConverter converter) { if (log.isDebugEnabled()) { log.debug("Metadata converter set in Identity idp-mgt bundle"); @@ -153,6 +148,13 @@ public static RealmService getRealmService() { /** * @param rlmService */ + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService rlmService) { IdpMgtServiceComponentHolder.getInstance().setRealmService(rlmService); } @@ -167,10 +169,18 @@ public static ConfigurationContextService getConfigurationContextService() { /** * @param service */ + @Reference( + name = "config.context.service", + service = ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService" + ) protected void setConfigurationContextService(ConfigurationContextService service) { IdpMgtServiceComponentHolder.getInstance().setConfigurationContextService(service); } + @Activate protected void activate(ComponentContext ctxt) { try { BundleContext bundleCtx = ctxt.getBundleContext(); @@ -314,6 +324,7 @@ private boolean isSharedIdP(IdentityProvider idp) { /** * @param ctxt */ + @Deactivate protected void deactivate(ComponentContext ctxt) { log.debug("Identity Provider Management bundle is deactivated"); } @@ -332,16 +343,30 @@ protected void unsetConfigurationContextService(ConfigurationContextService serv IdpMgtServiceComponentHolder.getInstance().setConfigurationContextService(null); } - protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) + protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } - protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { + protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ } + @Reference( + name = "idp.mgt.event.listener.service", + service = IdentityProviderMgtListener.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityProviderMgtListenerService" + ) protected void setIdentityProviderMgtListenerService( IdentityProviderMgtListener identityProviderMgtListenerService) { diff --git a/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/deployment/SecurityDeploymentInterceptor.java b/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/deployment/SecurityDeploymentInterceptor.java index 68915c821020..c901a2f2f43d 100644 --- a/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/deployment/SecurityDeploymentInterceptor.java +++ b/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/deployment/SecurityDeploymentInterceptor.java @@ -43,6 +43,11 @@ import org.apache.ws.security.handler.WSHandlerConstants; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.CarbonException; import org.wso2.carbon.context.CarbonContext; @@ -101,22 +106,18 @@ * hence should not be added to the axis2.xml directly. If done so, it will throw NPEs, since * the registry & userRealm references are set through the OSGi decalative service framework. * - * @scr.component name="org.wso2.carbon.security.deployment.SecurityDeploymentInterceptor" - * immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" unbind="unsetRealmService" */ +@Component( + name = "org.wso2.carbon.security.deployment.SecurityDeploymentInterceptor", + immediate = true +) public class SecurityDeploymentInterceptor implements AxisObserver { private static final Log log = LogFactory.getLog(SecurityDeploymentInterceptor.class); private static final String NO_POLICY_ID = "NoPolicy"; private static final String APPLY_POLICY_TO_BINDINGS = "applyPolicyToBindings"; - + @Activate protected void activate(ComponentContext ctxt) { BundleContext bundleCtx = ctxt.getBundleContext(); try { @@ -529,10 +530,24 @@ public void removeParameter(Parameter param) throws AxisFault { // This method will not be used } + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService" + ) protected void setRegistryService(RegistryService registryService) { SecurityServiceHolder.setRegistryService(registryService); } + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { SecurityServiceHolder.setRealmService(realmService); } diff --git a/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/internal/SecurityMgtServiceComponent.java b/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/internal/SecurityMgtServiceComponent.java index 71023f008849..502e054d05c3 100644 --- a/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/internal/SecurityMgtServiceComponent.java +++ b/components/security-mgt/org.wso2.carbon.security.mgt/src/main/java/org/wso2/carbon/security/internal/SecurityMgtServiceComponent.java @@ -24,6 +24,12 @@ import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.registry.core.service.RegistryService; @@ -34,29 +40,10 @@ import org.wso2.carbon.utils.Axis2ConfigurationContextObserver; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="security.mgt.service.component" immediate="true" - * @scr.reference name="registry.service" - * interface= - * "org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" policy="dynamic" bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="1..1" - * policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="registry.loader.default" - * interface="org.wso2.carbon.registry.core.service.TenantRegistryLoader" - * cardinality="1..1" policy="dynamic" bind="setTenantRegistryLoader" unbind="unsetTenantRegistryLoader" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - */ +@Component( + name = "security.mgt.service.component", + immediate = true +) public class SecurityMgtServiceComponent { private static String POX_SECURITY_MODULE = "POXSecurityModule"; private static Log log = LogFactory.getLog(SecurityMgtServiceComponent.class); @@ -68,6 +55,7 @@ public static ConfigurationContext getServerConfigurationContext() { return configContextService.getServerConfigContext(); } + @Activate protected void activate(ComponentContext ctxt) { try { ConfigurationContext mainConfigCtx = configContextService.getServerConfigContext(); @@ -95,6 +83,7 @@ protected void activate(ComponentContext ctxt) { } } + @Deactivate protected void deactivate(ComponentContext ctxt) { try { AxisConfiguration serverAxisConfig = @@ -108,6 +97,13 @@ protected void deactivate(ComponentContext ctxt) { } } + @Reference( + name = "config.context.service", + service = ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService" + ) protected void setConfigurationContextService(ConfigurationContextService contextService) { if (log.isDebugEnabled()) { log.debug("Setting the ConfigurationContext"); @@ -116,6 +112,13 @@ protected void setConfigurationContextService(ConfigurationContextService contex SecurityServiceHolder.setConfigurationContextService(contextService); } + @Reference( + name = "registry.service", + service = RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService" + ) protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("Setting the RegistryService"); @@ -124,6 +127,13 @@ protected void setRegistryService(RegistryService registryService) { SecurityServiceHolder.setRegistryService(registryService); } + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting the RealmService"); @@ -156,6 +166,13 @@ protected void unsetRegistryService(RegistryService registryService) { SecurityServiceHolder.setRegistryService(registryService); // TODO: Serious OSGi bug here. FIXME Thilina } + @Reference( + name = "registry.loader.default", + service = TenantRegistryLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTenantRegistryLoader" + ) protected void setTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoader) { if (log.isDebugEnabled()) { log.debug("Tenant Registry Loader is set in the SAML SSO bundle"); @@ -170,6 +187,13 @@ protected void unsetTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoad SecurityServiceHolder.setTenantRegistryLoader(null); } + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/src/main/java/org/wso2/carbon/identity/user/store/configuration/deployer/internal/UserStoreConfigComponent.java b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/src/main/java/org/wso2/carbon/identity/user/store/configuration/deployer/internal/UserStoreConfigComponent.java index a5cfb33f8ac3..004cf83f7c7c 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/src/main/java/org/wso2/carbon/identity/user/store/configuration/deployer/internal/UserStoreConfigComponent.java +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/src/main/java/org/wso2/carbon/identity/user/store/configuration/deployer/internal/UserStoreConfigComponent.java @@ -22,6 +22,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.base.api.ServerConfigurationService; import org.wso2.carbon.identity.user.store.configuration.deployer.util.UserStoreConfigurationConstants; import org.wso2.carbon.user.core.service.RealmService; @@ -31,21 +37,10 @@ import java.io.File; import java.io.IOException; -/** - * @scr.component name="identity.user.store.org.wso2.carbon.identity.user.store.configuration.component" - * immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1" - * policy="dynamic" bind="setRealmService" unbind="unsetRealmService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1" - * policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="server.configuration.service" - * interface="org.wso2.carbon.base.api.ServerConfigurationService" cardinality="1..1" - * policy="dynamic" bind="setServerConfigurationService" - * unbind="unsetServerConfigurationService" - */ +@Component( + name = "identity.user.store.org.wso2.carbon.identity.user.store.configuration.component", + immediate = true +) public class UserStoreConfigComponent { private static Log log = LogFactory.getLog(UserStoreConfigComponent.class); private static RealmService realmService = null; @@ -55,6 +50,13 @@ public static RealmService getRealmService() { return realmService; } + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting the Realm Service"); @@ -66,6 +68,13 @@ public static ServerConfigurationService getServerConfigurationService() { return UserStoreConfigComponent.serverConfigurationService; } + @Reference( + name = "server.configuration.service", + service = ServerConfigurationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetServerConfigurationService" + ) protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Setting the serverConfigurationService"); @@ -76,6 +85,7 @@ protected void setServerConfigurationService(ServerConfigurationService serverCo /** * @param ctxt */ + @Activate protected void activate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.debug("Identity userstore bundle is activated."); @@ -92,6 +102,7 @@ protected void activate(ComponentContext ctxt) { /** * @param ctxt */ + @Deactivate protected void deactivate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.debug("Identity Userstore-Config bundle is deactivated"); @@ -105,6 +116,13 @@ protected void unsetRealmService(RealmService realmService) { UserStoreConfigComponent.realmService = null; } + @Reference( + name = "config.context.service", + service = ConfigurationContextService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService" + ) protected void setConfigurationContextService(ConfigurationContextService contextService) { if (log.isDebugEnabled()) { log.info("Setting the ConfigurationContextService"); diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration/src/main/java/org/wso2/carbon/identity/user/store/configuration/internal/UserStoreConfigComponent.java b/components/user-store/org.wso2.carbon.identity.user.store.configuration/src/main/java/org/wso2/carbon/identity/user/store/configuration/internal/UserStoreConfigComponent.java index 9268fc98f0f8..840f7c34452e 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration/src/main/java/org/wso2/carbon/identity/user/store/configuration/internal/UserStoreConfigComponent.java +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration/src/main/java/org/wso2/carbon/identity/user/store/configuration/internal/UserStoreConfigComponent.java @@ -20,32 +20,22 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.base.api.ServerConfigurationService; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener; import org.wso2.carbon.user.api.RealmConfiguration; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="org.wso2.carbon.identity.user.store.configuration.component" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="server.configuration.service" - * interface="org.wso2.carbon.base.api.ServerConfigurationService" cardinality="1..1" - * policy="dynamic" bind="setServerConfigurationService" - * unbind="unsetServerConfigurationService" - * @scr.reference name="user.store.config.event.listener.service" - * interface="org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener" - * cardinality="0..n" policy="dynamic" - * bind="setUserStoreConfigListenerService" - * unbind="unsetIdentityProviderMgtListerService" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - * - */ +@Component( + name = "org.wso2.carbon.identity.user.store.configuration.component", + immediate = true +) public class UserStoreConfigComponent { private static Log log = LogFactory.getLog(UserStoreConfigComponent.class); private static RealmService realmService = null; @@ -59,6 +49,13 @@ public static RealmService getRealmService() { return realmService; } + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { UserStoreConfigComponent.realmService = realmService; if (log.isDebugEnabled()) { @@ -75,6 +72,13 @@ public static ServerConfigurationService getServerConfigurationService() { return UserStoreConfigComponent.serverConfigurationService; } + @Reference( + name = "server.configuration.service", + service = ServerConfigurationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetServerConfigurationService" + ) protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Set the ServerConfiguration Service"); @@ -86,6 +90,7 @@ protected void setServerConfigurationService(ServerConfigurationService serverCo /** * @param ctxt */ + @Activate protected void activate(ComponentContext ctxt) { if (log.isDebugEnabled()) { @@ -104,6 +109,7 @@ protected void activate(ComponentContext ctxt) { /** * @param ctxt */ + @Deactivate protected void deactivate(ComponentContext ctxt) { if (log.isDebugEnabled()) { log.debug("Identity User Store-Config bundle is deactivated"); @@ -124,6 +130,13 @@ protected void unsetServerConfigurationService(ServerConfigurationService server UserStoreConfigComponent.serverConfigurationService = null; } + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ @@ -134,12 +147,19 @@ protected void unsetIdentityCoreInitializedEventService(IdentityCoreInitializedE is started */ } + @Reference( + name = "user.store.config.event.listener.service", + service = UserStoreConfigListener.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetUserStoreConfigListenerService" + ) protected void setUserStoreConfigListenerService(UserStoreConfigListener userStoreConfigListener) { UserStoreConfigListenersHolder.getInstance().setUserStoreConfigListenerService(userStoreConfigListener); } - protected static void unsetIdentityProviderMgtListerService(UserStoreConfigListener userStoreConfigListener) { + protected static void unsetUserStoreConfigListenerService(UserStoreConfigListener userStoreConfigListener) { UserStoreConfigListenersHolder.getInstance().unsetUserStoreConfigListenerService(userStoreConfigListener); } diff --git a/components/user-store/org.wso2.carbon.identity.user.store.count/src/main/java/org/wso2/carbon/identity/user/store/count/internal/UserStoreCountDSComponent.java b/components/user-store/org.wso2.carbon.identity.user.store.count/src/main/java/org/wso2/carbon/identity/user/store/count/internal/UserStoreCountDSComponent.java index 24f9a71bf8d5..6223310c9df3 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.count/src/main/java/org/wso2/carbon/identity/user/store/count/internal/UserStoreCountDSComponent.java +++ b/components/user-store/org.wso2.carbon.identity.user.store.count/src/main/java/org/wso2/carbon/identity/user/store/count/internal/UserStoreCountDSComponent.java @@ -23,6 +23,10 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.component.annotations.ReferenceCardinality; +import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; import org.wso2.carbon.identity.user.store.count.AbstractCountRetrieverFactory; import org.wso2.carbon.identity.user.store.count.UserStoreCountRetriever; @@ -33,22 +37,10 @@ import org.wso2.carbon.identity.user.store.count.jdbc.internal.InternalCountRetrieverFactory; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="identity.user.store.count.component" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="user.store.count" - * interface="org.wso2.carbon.identity.user.store.count.AbstractCountRetrieverFactory" - * cardinality="0..n" policy="dynamic" bind="setCountRetrieverFactory" - * unbind="unsetCountRetrieverFactory" - * @scr.reference name="identityCoreInitializedEventService" - * interface="org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent" cardinality="1..1" - * policy="dynamic" bind="setIdentityCoreInitializedEventService" unbind="unsetIdentityCoreInitializedEventService" - * - */ - +@Component( + name = "identity.user.store.count.component", + immediate = true +) public class UserStoreCountDSComponent { private static final Log log = LogFactory.getLog(UserStoreCountDSComponent.class); @@ -57,6 +49,13 @@ public static RealmService getRealmService() { return UserStoreCountDataHolder.getInstance().getRealmService(); } + @Reference( + name = "user.realmservice.default", + service = RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService" + ) protected void setRealmService(RealmService realmService) { UserStoreCountDataHolder.getInstance().setRealmService(realmService); @@ -113,6 +112,13 @@ protected void deactivate(ComponentContext ctxt) { UserStoreCountDataHolder.getInstance().setBundleContext(null); } + @Reference( + name = "user.store.count", + service = AbstractCountRetrieverFactory.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetCountRetrieverFactory" + ) protected void setCountRetrieverFactory(AbstractCountRetrieverFactory countRetrieverFactory) { UserStoreCountDataHolder.getInstance().getCountRetrieverFactories() @@ -133,6 +139,13 @@ protected void unsetCountRetrieverFactory(AbstractCountRetrieverFactory countRet } } + @Reference( + name = "identityCoreInitializedEventService", + service = IdentityCoreInitializedEvent.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIdentityCoreInitializedEventService" + ) protected void setIdentityCoreInitializedEventService(IdentityCoreInitializedEvent identityCoreInitializedEvent) { /* reference IdentityCoreInitializedEvent service to guarantee that this component will wait until identity core is started */ From 2fa530bd8a9fb3ac9a9ecac556623ee829d4323c Mon Sep 17 00:00:00 2001 From: Pulasthi Mahawithana Date: Wed, 10 Jan 2018 19:38:14 +0530 Subject: [PATCH 3/3] Fix pom files from #1244 --- .../pom.xml | 4 ++-- .../pom.xml | 5 ----- .../pom.xml | 1 - .../pom.xml | 5 ----- .../pom.xml | 7 +------ .../IdentityProvisionServiceComponent.java | 2 +- .../pom.xml | 9 --------- .../pom.xml | 9 --------- .../pom.xml | 9 --------- pom.xml | 17 ++++++++++++++--- 10 files changed, 18 insertions(+), 50 deletions(-) diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml index 97aba4e86f59..9f96adc33e56 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml @@ -25,9 +25,9 @@ 4.0.0 org.wso2.carbon.identity.application.authentication.endpoint.util - WSO2 Carbon - Identity Application Authentication Endpoint + WSO2 Carbon - Identity Application Authentication Endpoint(Utils) bundle - Identity Application Authentication Endpoint + Identity Application Authentication Endpoint Utilities http://wso2.org diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint/pom.xml b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint/pom.xml index b690cc5c49f1..0a00bf17b418 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint/pom.xml +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint/pom.xml @@ -93,11 +93,6 @@ maven-compiler-plugin - - 1.7 - 1.7 - - 2.3.2 maven-war-plugin diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml index dae2ffbfb6f6..5ead51427979 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml @@ -133,7 +133,6 @@ org.apache.felix maven-scr-plugin - 1.9.0 org.apache.felix diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml index 0bd7f36655fc..3425f4c566d8 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml +++ b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml @@ -129,11 +129,6 @@ maven-compiler-plugin - - 1.7 - 1.7 - - 2.3.2 maven-war-plugin diff --git a/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint/pom.xml b/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint/pom.xml index 7100344337a1..ae4014a000c6 100644 --- a/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint/pom.xml +++ b/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint/pom.xml @@ -139,11 +139,6 @@ maven-compiler-plugin - - 1.7 - 1.7 - - 2.3.2 maven-war-plugin @@ -164,4 +159,4 @@ - \ No newline at end of file + diff --git a/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java b/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java index 1134618217bb..15d2d828d6bd 100644 --- a/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java +++ b/components/provisioning/org.wso2.carbon.identity.provisioning/src/main/java/org/wso2/carbon/identity/provisioning/internal/IdentityProvisionServiceComponent.java @@ -42,7 +42,7 @@ import org.osgi.service.component.annotations.Deactivate; @Component( - name = "null", + name = "org.wso2.carbon.identity.provision.internal.IdentityProvisionServiceComponent", immediate = true) public class IdentityProvisionServiceComponent { diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml index 7afa4896076d..a1c96362e0fc 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml @@ -65,15 +65,6 @@ org.apache.felix maven-scr-plugin - 1.7.2 - - - generate-scr-scrdescriptor - - scr - - - org.apache.felix diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml b/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml index d535f1472cbd..758194913329 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml @@ -69,15 +69,6 @@ org.apache.felix maven-scr-plugin - 1.7.2 - - - generate-scr-scrdescriptor - - scr - - - org.apache.felix diff --git a/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml b/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml index 4aaddea57612..cc035bcba369 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml +++ b/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml @@ -56,15 +56,6 @@ org.apache.felix maven-scr-plugin - 1.7.2 - - - generate-scr-scrdescriptor - - scr - - - org.apache.felix diff --git a/pom.xml b/pom.xml index 4bf899094471..1e23a10e4820 100644 --- a/pom.xml +++ b/pom.xml @@ -1445,6 +1445,15 @@ + + + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + + + UTF-8 @@ -1459,7 +1468,7 @@ [1.7.0, 2.0.0) [1.5.1, 2.0.0) 3.5.100.v20160504-1419 - 1.2.4 + 1.2.8 4.5.2 @@ -1683,6 +1692,8 @@ 1.4 + 3.7.0 + 1.24.0 my-scm-server @@ -1702,7 +1713,7 @@ org.apache.felix maven-scr-plugin - 1.7.2 + ${maven.scr.plugin.version} generate-scr-scrdescriptor @@ -1759,7 +1770,7 @@ maven-compiler-plugin - 2.3.1 + ${maven.compiler.plugin.version} true UTF-8