List of usage examples for java.rmi RemoteException getMessage
public String getMessage()
From source file:org.wso2.carbon.api.analytics.alerts.core.internal.StreamMgtHelper.java
public static String[] getPredefinedStreamIds() { try {/*from www . ja v a 2s. c o m*/ return AlertConfigurationClientHolder.getInstance().getEventStreamManagerAdminServiceClient() .getStreamNames(); } catch (RemoteException e) { log.error(e.getMessage(), e); } return null; }
From source file:org.wso2.carbon.api.analytics.alerts.core.internal.StreamMgtHelper.java
public static StreamDefinition getStreamDefinition(String streamId) { try {/*from w ww. jav a2 s . com*/ EventStreamDefinitionDto dto = AlertConfigurationClientHolder.getInstance() .getEventStreamManagerAdminServiceClient().getStreamDefinitionDto(streamId); StreamDefinition streamDefinition = new StreamDefinition(dto.getName(), dto.getVersion()); if (dto.getMetaData() != null) { for (EventStreamAttributeDto attributeDto : dto.getMetaData()) { Attribute at = convertToDatabridgeAttribute(attributeDto); streamDefinition.addMetaData(at.getName(), at.getType()); } } if (dto.getCorrelationData() != null) { for (EventStreamAttributeDto attributeDto : dto.getCorrelationData()) { Attribute at = convertToDatabridgeAttribute(attributeDto); streamDefinition.addCorrelationData(at.getName(), at.getType()); } } if (dto.getPayloadData() != null) { for (EventStreamAttributeDto attributeDto : dto.getPayloadData()) { Attribute at = convertToDatabridgeAttribute(attributeDto); streamDefinition.addPayloadData(at.getName(), at.getType()); } } return streamDefinition; } catch (RemoteException e) { log.error(e.getMessage(), e); } catch (MalformedStreamDefinitionException e) { log.error(e.getMessage(), e); } return null; }
From source file:org.wso2.carbon.apimgt.hostobjects.AssetStoreHostObject.java
public static void jsFunction_addUser(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws APIManagementException { String username = args[0].toString(); String password = args[1].toString(); APIManagerConfiguration config = HostObjectComponent.getAPIManagerConfiguration(); boolean enabled = Boolean.parseBoolean(config.getFirstProperty(APIConstants.SELF_SIGN_UP_ENABLED)); if (!enabled) { handleException("Self sign up has been disabled on this server"); }/*from w w w . j a va 2 s . com*/ String serverURL = config.getFirstProperty(APIConstants.AUTH_MANAGER_URL); String adminUsername = username; String adminPassword = password; if (serverURL == null || adminUsername == null || adminPassword == null) { handleException("Required parameter missing to connect to the" + " authentication manager"); } String role = config.getFirstProperty(APIConstants.SELF_SIGN_UP_ROLE); if (role == null) { handleException("Subscriber role undefined for self registration"); } boolean isLocalTransport = serverURL.startsWith("local"); String url = serverURL + "UserAdmin"; try { UserAdminStub stub = isLocalTransport ? new UserAdminStub(HostObjectUtils.getConfigContext(), url) : new UserAdminStub(url); CarbonUtils.setBasicAccessSecurityHeaders(adminUsername, adminPassword, true, stub._getServiceClient()); stub.addUser(username, password, new String[] { role }, null, null); } catch (RemoteException e) { handleException(e.getMessage(), e); } catch (Exception e) { handleException("Error while adding the user: " + username, e); } // catch (AddUserUserAdminExceptionException e) { // handleException("Error while adding the user: " + username, e); // } }
From source file:org.wso2.carbon.apimgt.impl.clients.ApplicationManagementServiceClient.java
/** * This method is used to create application according to the given sp and user * * @param serviceProvider Service Provider * @param username UserName of the user * @throws Exception/*from www . ja v a 2 s .com*/ */ public void createApplication(ServiceProvider serviceProvider, String username) throws Exception { try { if (debugEnabled) { log.debug("Registering Service Provider " + serviceProvider.getApplicationName()); } Util.setAuthHeaders(identityApplicationManagementServiceStub._getServiceClient(), username); identityApplicationManagementServiceStub.createApplication(serviceProvider); } catch (RemoteException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage(), e); } catch (IdentityApplicationManagementServiceIdentityApplicationManagementException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage()); } }
From source file:org.wso2.carbon.apimgt.impl.clients.ApplicationManagementServiceClient.java
/** * This method is used to get the application information of a given user * * @param username UserName of the user// www.ja v a 2 s . co m * @return Basic information of the application as an array * @throws Exception */ public ApplicationBasicInfo[] getAllApplicationBasicInfo(String username) throws Exception { try { Util.setAuthHeaders(identityApplicationManagementServiceStub._getServiceClient(), username); return identityApplicationManagementServiceStub.getAllApplicationBasicInfo(); } catch (RemoteException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage()); } catch (IdentityApplicationManagementServiceIdentityApplicationManagementException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage()); } }
From source file:org.wso2.carbon.apimgt.impl.clients.ApplicationManagementServiceClient.java
/** * This method is used to update the application data * * @param serviceProvider Service Provider * @param username UserName of the user * @throws Exception//from ww w .ja va 2s .c om */ public void updateApplicationData(ServiceProvider serviceProvider, String username) throws Exception { try { Util.setAuthHeaders(identityApplicationManagementServiceStub._getServiceClient(), username); identityApplicationManagementServiceStub.updateApplication(serviceProvider); } catch (RemoteException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage()); } catch (IdentityApplicationManagementServiceIdentityApplicationManagementException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage()); } }
From source file:org.wso2.carbon.apimgt.impl.clients.ApplicationManagementServiceClient.java
/** * This method is used to delete a given application * * @param applicationID application id/*from ww w . j ava 2 s . co m*/ * @param username UserName of the user * @throws Exception */ public void deleteApplication(String applicationID, String username) throws Exception { try { Util.setAuthHeaders(identityApplicationManagementServiceStub._getServiceClient(), username); identityApplicationManagementServiceStub.deleteApplication(applicationID); } catch (RemoteException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage(), e); } catch (IdentityApplicationManagementServiceIdentityApplicationManagementException e) { log.error(e.getMessage(), e); throw new Exception(e.getMessage(), e); } }
From source file:org.wso2.carbon.apimgt.rest.api.utils.EntitlementServiceClient.java
/** * @param subject subject to be check with PDP * @param resource resource name to be checked with PDP * @param action action to be check with PDP * @param environment environment to be check with PDP * @return Allow if resource can be accessible * Deny if resource forbidden/*from ww w. j a v a 2s .c o m*/ * Not Applicable if cannot find matched policy */ public String validateAction(String subject, String resource, String action, String[] environment) { String decision = "DENY"; try { decision = entitlementServiceStub.getDecisionByAttributes(subject, resource, action, environment); System.out.println("\nXACML Decision is received : " + decision); String authCookie = (String) entitlementServiceStub._getServiceClient().getServiceContext() .getProperty(HTTPConstants.COOKIE_STRING); System.out.println("\nCookie is received for subsequent communication : " + authCookie); } catch (RemoteException e) { logger.error("Error while connecting PDP " + e.getMessage()); } catch (EntitlementServiceException e) { logger.error("Error while validating XACML policy for given request " + e.getMessage()); } return decision; }
From source file:org.wso2.carbon.appmgt.hostobjects.AssetStoreHostObject.java
public static void jsFunction_addUser(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws AppManagementException { String username = args[0].toString(); String password = args[1].toString(); AppManagerConfiguration config = HostObjectComponent.getAPIManagerConfiguration(); boolean enabled = Boolean.parseBoolean(config.getFirstProperty(AppMConstants.SELF_SIGN_UP_ENABLED)); if (!enabled) { handleException("Self sign up has been disabled on this server"); }//from ww w .ja v a 2s .com String serverURL = config.getFirstProperty(AppMConstants.AUTH_MANAGER_URL); String adminUsername = username; String adminPassword = password; if (serverURL == null || adminUsername == null || adminPassword == null) { handleException("Required parameter missing to connect to the" + " authentication manager"); } String role = config.getFirstProperty(AppMConstants.SELF_SIGN_UP_ROLE); if (role == null) { handleException("Subscriber role undefined for self registration"); } boolean isLocalTransport = serverURL.startsWith("local"); String url = serverURL + "UserAdmin"; try { UserAdminStub stub = isLocalTransport ? new UserAdminStub(HostObjectUtils.getConfigContext(), url) : new UserAdminStub(url); CarbonUtils.setBasicAccessSecurityHeaders(adminUsername, adminPassword, true, stub._getServiceClient()); stub.addUser(username, password, new String[] { role }, null, null); } catch (RemoteException e) { handleException(e.getMessage(), e); } catch (Exception e) { handleException("Error while adding the user: " + username, e); } // catch (AddUserUserAdminExceptionException e) { // handleException("Error while adding the user: " + username, e); // } }
From source file:org.wso2.carbon.appmgt.impl.idp.CarbonIdpManager.java
@Override public List<TrustedIdP> getIdPList(String serviceProvider) throws AppManagementException { List<TrustedIdP> idps = new ArrayList<TrustedIdP>(); if (canAddIdP()) { // return complete list of IdPs since we can add the IdP if non // existing one is selected by the subscriber try {//from w w w . j av a 2 s . c om org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider[] idpDTOs = idpStub .getAllIdPs(); if (idpDTOs != null && idpDTOs.length > 0) { for (org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider dto : idpDTOs) { TrustedIdP idp = new TrustedIdP(); idp.setName(dto.getIdentityProviderName()); idps.add(idp); } } } catch (RemoteException e) { log.error(e); throw new AppManagementException(e.getMessage()); } catch (IdentityProviderMgtServiceIdentityProviderManagementExceptionException e) { log.error(e); throw new AppManagementException(e.getMessage()); } } else { // only returns the set of IdPs which are already added to the SP as // trusted. try { AuthenticationStep[] steps = appMgtStub.getApplication(serviceProvider) .getLocalAndOutBoundAuthenticationConfig().getAuthenticationSteps(); if (steps != null && steps.length > 0) { for (AuthenticationStep step : steps) { if (step.getFederatedIdentityProviders() != null && step.getFederatedIdentityProviders().length > 0) { for (IdentityProvider idp : step.getFederatedIdentityProviders()) { TrustedIdP tIdp = new TrustedIdP(); tIdp.setName(idp.getIdentityProviderName()); idps.add(tIdp); } } } } } catch (RemoteException e) { e.printStackTrace(); throw new AppManagementException(e.getMessage()); } catch (IdentityApplicationManagementServiceIdentityApplicationManagementException e) { e.printStackTrace(); throw new AppManagementException(e.getMessage()); } } return idps; }