Add API app registering refactored code

remotes/1725333865317989910/tmp_refs/heads/master
Dharmakeerthi Lasantha 2 years ago committed by pasindu
parent 958f4e43d6
commit 29a8dd5fde

@ -41,6 +41,7 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.App
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Subscription; import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.Subscription;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.ApiApplicationInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.ApiApplicationInfo;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.RegistrationProfile;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException;
import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException;
@ -119,6 +120,40 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
return generateAndRetrieveApplicationKeys(applicationName, tags ,keyType, isAllowedAllDomains, validityTime, tokenInfo); return generateAndRetrieveApplicationKeys(applicationName, tags ,keyType, isAllowedAllDomains, validityTime, tokenInfo);
} }
@Override
public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String tags[],
String keyType, String username,
boolean isAllowedAllDomains,
String validityTime, String password) throws APIManagerException {
ConsumerRESTAPIServices consumerRESTAPIServices =
APIApplicationManagerExtensionDataHolder.getInstance().getConsumerRESTAPIServices();
/*
*/
try {
consumerRESTAPIServices.getAllApplications(null, null, null);
} catch (APIServicesException e) {
e.printStackTrace();
} catch (BadRequestException e) {
e.printStackTrace();
} catch (UnexpectedResponseException e) {
e.printStackTrace();
}
return null;
}
/**
* {@inheritDoc}
*/
@Override @Override
public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String[] tags, public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String[] tags,
String keyType, String username, String keyType, String username,

@ -39,12 +39,8 @@ public class APIApplicationManagerExtensionDataHolder {
private TenantIndexingLoader indexLoader; private TenantIndexingLoader indexLoader;
private JWTClientManagerService jwtClientManagerService; private JWTClientManagerService jwtClientManagerService;
private ConsumerRESTAPIServices consumerRESTAPIServices; private ConsumerRESTAPIServices consumerRESTAPIServices;
<<<<<<< HEAD
private APIApplicationServices apiApplicationServices; private APIApplicationServices apiApplicationServices;
private MetadataManagementService metadataManagementService; private MetadataManagementService metadataManagementService;
=======
>>>>>>> 9fc055cd4f (Add Consumer REST API integration)
private APIApplicationManagerExtensionDataHolder() { private APIApplicationManagerExtensionDataHolder() {
} }
@ -121,7 +117,6 @@ public class APIApplicationManagerExtensionDataHolder {
public void setConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) { public void setConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) {
this.consumerRESTAPIServices = consumerRESTAPIServices; this.consumerRESTAPIServices = consumerRESTAPIServices;
} }
<<<<<<< HEAD
public APIApplicationServices getApiApplicationServices() { public APIApplicationServices getApiApplicationServices() {
return apiApplicationServices; return apiApplicationServices;
@ -138,6 +133,4 @@ public class APIApplicationManagerExtensionDataHolder {
public void setMetadataManagementService(MetadataManagementService metadataManagementService) { public void setMetadataManagementService(MetadataManagementService metadataManagementService) {
this.metadataManagementService = metadataManagementService; this.metadataManagementService = metadataManagementService;
} }
=======
>>>>>>> 9fc055cd4f (Add Consumer REST API integration)
} }

@ -55,12 +55,18 @@ import org.wso2.carbon.user.core.service.RealmService;
* policy="dynamic" * policy="dynamic"
* bind="setRealmService" * bind="setRealmService"
* unbind="unsetRealmService" * unbind="unsetRealmService"
* @scr.reference name="io.entgra.device.mgt.core.apimgt.extension.rest.api" * @scr.reference name="apimgt.extension.ConsumerRESTAPIServices"
* interface="io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices" * interface="io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices"
* cardinality="0..1" * cardinality="0..1"
* policy="dynamic" * policy="dynamic"
* bind="setConsumerRESTAPIServices" * bind="setConsumerRESTAPIServices"
* unbind="unsetConsumerRESTAPIServices" * unbind="unsetConsumerRESTAPIServices"
* @scr.reference name="apimgt.extension.APIApplicationService"
* interface="io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices"
* cardinality="0..1"
* policy="dynamic"
* bind="setAPIApplicationServices"
* unbind="unsetAPIApplicationServices"
*/ */
public class APIApplicationManagerExtensionServiceComponent { public class APIApplicationManagerExtensionServiceComponent {

Loading…
Cancel
Save