use of com.wso2telco.core.pcrservice.exception.PCRException in project core-util by WSO2Telco.
the class UUIDPCRService method updateServiceProviderMap.
private void updateServiceProviderMap(String appId) throws PCRException {
if (DEBUG)
log.debug("Updating Service Provider Map");
try {
OAuthConsumerAppDTO apps = authApplicationData.getApplicationData(appId);
if (DEBUG)
log.debug("Application List recieved");
if (apps == null) {
log.error("Application data not found - updateServiceProviderMap");
throw new PCRException("Null Application list - updateServiceProviderMap");
}
String callbackUrl = apps.getCallbackUrl();
String sector = SectorUtil.getSectorIdFromUrl(callbackUrl);
KeyValueBasedPcrDAOImpl keyValueBasedPcrDAOImpl = new KeyValueBasedPcrDAOImpl();
keyValueBasedPcrDAOImpl.createNewSPEntry(sector, appId, true);
} catch (Exception e) {
log.error("error in retrieving application data - updateServiceProviderMap", e);
throw new PCRException("error in retrieving application data - updateServiceProviderMap");
}
}
use of com.wso2telco.core.pcrservice.exception.PCRException in project core-util by WSO2Telco.
the class OAuthApplicationDataStubFactory method generateStub.
/**
* This is used to create a stub which will be triggered through object pool factory, which will create an
* instance of it.
*
* @return OAuth2TokenValidationServiceStub stub that is used to call an external service.
* @throws PCRException will be thrown when initialization failed.
*/
private OAuthAdminServiceStub generateStub() throws PCRException {
OAuthAdminServiceStub stub;
try {
URL hostURL = new URL(config.getHostUrl());
// ConfigurationContext myConfigContext =
// ConfigurationContextFactory.createConfigurationContextFromFileSystem(
// "repo", CarbonUtils.getCarbonConfigDirPath() + File.separator + "axis2" + File.separator +
// "axis2.xml");
stub = new OAuthAdminServiceStub(null, hostURL.toString());
ServiceClient client = stub._getServiceClient();
client.getServiceContext().getConfigurationContext().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setPreemptiveAuthentication(true);
String username = config.getUsername();
String password = config.getPassword();
auth.setUsername(username);
auth.setPassword(password);
Options options = client.getOptions();
options.setProperty(HTTPConstants.AUTHENTICATE, auth);
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);
client.setOptions(options);
} catch (AxisFault axisFault) {
log.error("Error occurred while creating the OAuth2TokenValidationServiceStub.");
throw new PCRException("Error occurred while creating the OAuth2TokenValidationServiceStub.", axisFault);
} catch (MalformedURLException e) {
log.error("Malformed URL error");
throw new PCRException("Malformed URL error", e);
}
return stub;
}
use of com.wso2telco.core.pcrservice.exception.PCRException in project core-util by WSO2Telco.
the class UUIDPCRGenarator method getExistingPCR.
@Override
public Returnable getExistingPCR(RequestDTO dto) throws PCRException {
try {
UUIDPCRService uuidpcrService = new UUIDPCRService();
uuid = uuidpcrService.getExistingPCR(dto);
} catch (Exception e) {
log.error(ERROR_IN_RECEIVING_A_PCR, e);
throw new PCRException(ERROR_IN_RECEIVING_A_PCR);
}
return new Returnable() {
@Override
public String getID() {
return uuid;
}
};
}
use of com.wso2telco.core.pcrservice.exception.PCRException in project core-util by WSO2Telco.
the class UUIDPCRGenarator method getPCR.
/* (non-Javadoc)
* @see com.wso2telco.core.pcrservice.PCRGeneratable#getPCR(com.wso2telco.core.pcrservice.model.RequestDTO)
*/
@Override
public Returnable getPCR(RequestDTO requestDTO) throws PCRException {
try {
UUIDPCRService uuidpcrService = new UUIDPCRService();
uuid = uuidpcrService.getPcr(requestDTO);
} catch (Exception e) {
log.error(ERROR_IN_RECEIVING_A_PCR, e);
throw new PCRException(ERROR_IN_RECEIVING_A_PCR);
}
return new Returnable() {
@Override
public String getID() {
// TODO Auto-generated method stub
return uuid;
}
};
}
use of com.wso2telco.core.pcrservice.exception.PCRException in project core-util by WSO2Telco.
the class UUIDPCRGenarator method getMsisdnByPcr.
@Override
public Returnable getMsisdnByPcr(String sectorId, String pcr) throws PCRException {
try {
UUIDPCRService uuidpcrService = new UUIDPCRService();
uuid = uuidpcrService.getMsisdnByPcr(sectorId, pcr);
} catch (Exception e) {
log.error(ERROR_IN_RECIEVING_MSISDN, e);
throw new PCRException(ERROR_IN_RECIEVING_MSISDN);
}
return new Returnable() {
@Override
public String getID() {
return uuid;
}
};
}
Aggregations