Add Consumer REST API integration

remotes/1728937285237262521/tmp_refs/heads/master
Dharmakeerthi Lasantha 2 years ago
parent c98237dc6f
commit 22f4da908f

@ -74,6 +74,11 @@
<artifactId>io.entgra.device.mgt.core.identity.jwt.client.extension</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.entgra.device.mgt.core</groupId>
<artifactId>io.entgra.device.mgt.core.apimgt.extension.rest.api</artifactId>
<!-- <scope>provided</scope>-->
</dependency>
</dependencies>
<build>
@ -121,6 +126,7 @@
io.entgra.device.mgt.core.identity.jwt.client.extension.dto,
io.entgra.device.mgt.core.identity.jwt.client.extension.exception,
io.entgra.device.mgt.core.identity.jwt.client.extension.service,
io.entgra.device.mgt.core.apimgt.extension.rest.api,
org.wso2.carbon.registry.core.exceptions;version="[1.0,2)",
org.wso2.carbon.registry.core.service;version="[1.0,2)",
org.wso2.carbon.registry.indexing.service;version="${carbon.registry.imp.pkg.version.range}",

@ -18,6 +18,7 @@
package io.entgra.device.mgt.core.apimgt.application.extension.internal;
import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService;
import org.wso2.carbon.registry.core.service.TenantRegistryLoader;
@ -35,6 +36,7 @@ public class APIApplicationManagerExtensionDataHolder {
private TenantRegistryLoader tenantRegistryLoader;
private TenantIndexingLoader indexLoader;
private JWTClientManagerService jwtClientManagerService;
private ConsumerRESTAPIServices consumerRESTAPIServices;
private APIApplicationManagerExtensionDataHolder() {
}
@ -103,4 +105,12 @@ public class APIApplicationManagerExtensionDataHolder {
public void setJwtClientManagerService(JWTClientManagerService jwtClientManagerService) {
this.jwtClientManagerService = jwtClientManagerService;
}
public ConsumerRESTAPIServices getConsumerRESTAPIServices() {
return consumerRESTAPIServices;
}
public void setConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) {
this.consumerRESTAPIServices = consumerRESTAPIServices;
}
}

@ -17,6 +17,7 @@
*/
package io.entgra.device.mgt.core.apimgt.application.extension.internal;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
@ -48,6 +49,12 @@ import org.wso2.carbon.user.core.service.RealmService;
* policy="dynamic"
* bind="setRealmService"
* unbind="unsetRealmService"
* @scr.reference name="io.entgra.device.mgt.core.apimgt.extension.rest.api"
* interface="io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices"
* cardinality="0..1"
* policy="dynamic"
* bind="setConsumerRESTAPIServices"
* unbind="unsetConsumerRESTAPIServices"
*/
public class APIApplicationManagerExtensionServiceComponent {
@ -113,4 +120,29 @@ public class APIApplicationManagerExtensionServiceComponent {
}
APIApplicationManagerExtensionDataHolder.getInstance().setRealmService(null);
}
/**
* Sets APIM Consumer REST API service.
*
* @param consumerRESTAPIServices An instance of ConsumerRESTAPIServices
*/
protected void setConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) {
if (log.isDebugEnabled()) {
log.debug("Setting Realm Service");
}
APIApplicationManagerExtensionDataHolder.getInstance().setConsumerRESTAPIServices(consumerRESTAPIServices);
}
/**
* Unset APIM Consumer REST API service
*
* @param consumerRESTAPIServices An instance of ConsumerRESTAPIServices
*/
protected void unsetConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) {
if (log.isDebugEnabled()) {
log.debug("Unsetting Realm Service");
}
APIApplicationManagerExtensionDataHolder.getInstance().setConsumerRESTAPIServices(null);
}
}

@ -19,6 +19,7 @@
package io.entgra.device.mgt.core.apimgt.extension.rest.api.internal;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices;
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
public class PublisherRESTAPIDataHolder {
@ -26,6 +27,8 @@ public class PublisherRESTAPIDataHolder {
private APIApplicationServices apiApplicationServices;
private APIManagerConfigurationService apiManagerConfigurationService;
private ConsumerRESTAPIServices consumerRESTAPIServices;
private static PublisherRESTAPIDataHolder thisInstance = new PublisherRESTAPIDataHolder();
private PublisherRESTAPIDataHolder() {
@ -54,4 +57,12 @@ public class PublisherRESTAPIDataHolder {
return apiManagerConfigurationService;
}
public ConsumerRESTAPIServices getConsumerRESTAPIServices() {
return consumerRESTAPIServices;
}
public void setConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) {
this.consumerRESTAPIServices = consumerRESTAPIServices;
}
}

@ -40,7 +40,7 @@ import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
*/
public class PublisherRESTAPIServiceComponent {
private static Log log = LogFactory.getLog(PublisherRESTAPIServiceComponent.class);
private static final Log log = LogFactory.getLog(PublisherRESTAPIServiceComponent.class);
protected void activate(ComponentContext componentContext) {
if (log.isDebugEnabled()) {
@ -55,6 +55,7 @@ public class PublisherRESTAPIServiceComponent {
ConsumerRESTAPIServices consumerRESTAPIServices = new ConsumerRESTAPIServicesImpl();
bundleContext.registerService(ConsumerRESTAPIServices.class.getName(), consumerRESTAPIServices, null);
PublisherRESTAPIDataHolder.getInstance().setConsumerRESTAPIServices(consumerRESTAPIServices);
if (log.isDebugEnabled()) {
log.debug("API Application bundle has been successfully initialized");

Loading…
Cancel
Save