Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move SCR doclets to annotations #1271

Merged
merged 3 commits into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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 */
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -75,6 +65,7 @@ public static Map<String, ServiceProvider> getFileBasedSPs() {
return fileBasedSPs;
}

@Activate
protected void activate(ComponentContext context) {
try {
bundleContext = context.getBundleContext();
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ApplicationMgtListener> 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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.application.authentication.endpoint.util</artifactId>
<name>WSO2 Carbon - Identity Application Authentication Endpoint</name>
<name>WSO2 Carbon - Identity Application Authentication Endpoint(Utils)</name>
<packaging>bundle</packaging>
<description>Identity Application Authentication Endpoint</description>
<description>Identity Application Authentication Endpoint Utilities</description>
<url>http://wso2.org</url>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<version>2.3.2</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.9.0</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
Loading