Add API app registering refactored code

apim420
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.dto.APIApplicationKey;
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.BadRequestException;
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);
}
@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
public synchronized ApiApplicationKey generateAndRetrieveApplicationKeys(String applicationName, String[] tags,
String keyType, String username,

@ -39,12 +39,8 @@ public class APIApplicationManagerExtensionDataHolder {
private TenantIndexingLoader indexLoader;
private JWTClientManagerService jwtClientManagerService;
private ConsumerRESTAPIServices consumerRESTAPIServices;
<<<<<<< HEAD
private APIApplicationServices apiApplicationServices;
private MetadataManagementService metadataManagementService;
=======
>>>>>>> 9fc055cd4f (Add Consumer REST API integration)
private APIApplicationManagerExtensionDataHolder() {
}
@ -121,7 +117,6 @@ public class APIApplicationManagerExtensionDataHolder {
public void setConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) {
this.consumerRESTAPIServices = consumerRESTAPIServices;
}
<<<<<<< HEAD
public APIApplicationServices getApiApplicationServices() {
return apiApplicationServices;
@ -138,6 +133,4 @@ public class APIApplicationManagerExtensionDataHolder {
public void setMetadataManagementService(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"
* bind="setRealmService"
* 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"
* cardinality="0..1"
* policy="dynamic"
* bind="setConsumerRESTAPIServices"
* 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 {

Loading…
Cancel
Save