Example usage for java.rmi RemoteException getMessage

List of usage examples for java.rmi RemoteException getMessage

Introduction

In this page you can find the example usage for java.rmi RemoteException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message, including the message from the cause, if any, of this exception.

Usage

From source file:org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient.java

/**
 *
 * @param applicationID//from  ww w .  ja v  a2  s  . c  om
 * @throws Exception
 */
public void deleteApplication(String applicationID) throws Exception {
    try {
        stub.deleteApplication(applicationID);
    } 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.identity.integration.test.user.mgt.UserImportLoggingTestCase.java

@Test(description = "Method to test the bulk user import error scenario. The test checks for the RemoteException "
        + "which is thrown by the bulkImportUser method", dependsOnMethods = {
                "testBulkUserImportLogFileIsPresent" })
public void testBulkImportWithUserAdminException() throws UserAdminUserAdminException {

    String errorMessage = "";
    File bulkUserFile = new File(BULK_USER_FILE + BULK_USER_IMPORT_ERROR_FILE);

    DataHandler handler = new DataHandler(new FileDataSource(bulkUserFile));
    try {//  ww  w . j  a v a  2  s  .  c  o  m
        userMgtClient.bulkImportUsers(USER_STORE_DOMAIN, BULK_USER_IMPORT_ERROR_FILE, handler, null);
    } catch (RemoteException e) {
        errorMessage = e.getMessage();
        assertEquals(errorMessage, ERROR_MESSAGE);
    }

    if (StringUtils.isNotBlank(errorMessage)) {
        errorMessage = errorMessage.replaceAll(" ", "").replaceAll("\\.", "");
        String[] segments = errorMessage.split(",");

        String errorSegment = segments[1];
        String duplicateUserSegment = segments[2];

        assertEquals(Integer.valueOf(errorSegment.split(":")[1]).intValue(), FAILED_USER_COUNT);
        assertEquals(Integer.valueOf(duplicateUserSegment.split(":")[1]).intValue(), DUPLICATE_USER_COUNT);
    }
}

From source file:org.wso2.identity.scenarios.commons.clients.application.mgt.ApplicationManagementServiceClient.java

/**
 * @param serviceProvider/*from   ww  w  .j  a v  a  2 s  .co m*/
 * @throws Exception
 */
public void createApplicationWithTemplate(ServiceProvider serviceProvider, String templateName)
        throws Exception {
    try {
        if (debugEnabled) {
            log.debug("Registering Service Provider " + serviceProvider.getApplicationName() + " with template "
                    + templateName);
        }
        stub.createApplicationWithTemplate(serviceProvider, templateName);
    } 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.ss.integration.common.clients.RSSManagerClient.java

public void createDatabaseUser(String environmentName, DatabaseUserInfo user) throws AxisFault {

    try {/*from   w w  w  . jav a 2  s.  c om*/
        stub.addDatabaseUser(environmentName, user);
    } catch (RemoteException e) {
        handleException("Fail to create database user" + " : " + e.getMessage(), e);
    } catch (Exception e) {
        handleException("Fail to create database user" + " : " + e.getMessage(), e);
    }

}

From source file:weave.servlets.AdminService.java

public AdminServiceResponse checkSQLConfigExists() {
    try {/*  w ww  .  java  2s .co  m*/
        if (databaseConfigExists())
            return new AdminServiceResponse(true, "Configuration file exists.");
    } catch (RemoteException se) {
        se.printStackTrace();

        File configFile = new File(configManager.getConfigFileName());
        if (configFile.exists())
            return new AdminServiceResponse(false,
                    String.format(
                            "%s is invalid. Please edit the file and fix the problem"
                                    + " or delete it and create a new one through the admin console.\n\n%s",
                            configFile.getName(), se.getMessage()));
    }
    return new AdminServiceResponse(false, "The configuration storage location must be specified.");
}

From source file:xbird.xquery.expr.ext.BDQExpr.java

public XQExpression staticAnalysis(StaticContext statEnv) throws XQueryException {
    if (!_analyzed) {
        this._analyzed = true;

        XQExpression analyzedEndpoint = _endpoint.staticAnalysis(statEnv);
        this._endpoint = analyzedEndpoint;

        // prepare to ship local variables
        final List<ShippedVariable> shippedVars = new ArrayList<ShippedVariable>(4);
        ParametricVariableDetector detector = new ParametricVariableDetector(shippedVars, statEnv);
        detector.visit(_queryExpr, null);

        final XQExpression compiledExpr;
        if (analyzedEndpoint instanceof LiteralExpr) {// distributed compile                 
            LiteralExpr epLiteral = (LiteralExpr) analyzedEndpoint;
            String endpoint = epLiteral.getValue().stringValue();

            final XQEngineClient client = new XQEngineClient(endpoint);
            final CompileRequest request = new CompileRequest(_queryExpr);

            if (LOG.isInfoEnabled()) {
                LOG.info("Invoking remote compilation at [" + endpoint + "]:\n " + _queryExpr);
            }//from   w w  w .j a v  a  2s  . c  o  m

            // invokes remote compilation
            final Object result;
            try {
                result = client.execute(request);
            } catch (RemoteException e) {
                throw new XQueryException(e.getMessage(), e.getCause());
            } finally {
                try {
                    client.close();
                } catch (RemoteException e) {
                    LOG.warn("shutdown failed for `" + endpoint + '\'', e);
                }
            }

            compiledExpr = (XQExpression) result;
            // reset local expression
            if (!shippedVars.isEmpty()) {
                ShippedVariableModifier modifier = new ShippedVariableModifier(shippedVars);
                modifier.visit(compiledExpr, null);
            }

            this._parallel = false;

        } else { // compile locally (some access paths such as index access is disabled) 
            boolean prevState = statEnv.isIndicesAccessible();
            statEnv.setIndicesAccessible(false); //TODO remote compilation for static endpoint
            compiledExpr = _queryExpr.staticAnalysis(statEnv);
            statEnv.setIndicesAccessible(prevState);
        }

        this._queryExpr = compiledExpr;
        this._type = compiledExpr.getType();
        final ThreadedVariable threadedVar = new ThreadedVariable(this);
        statEnv.addThreadedVariable(threadedVar);
        return threadedVar;
    }
    return this;
}

From source file:xbird.xquery.expr.ext.BDQExpr.java

private static Sequence invokeRequest(final String endpoint, final PreparedQueryRequest request)
        throws XQueryException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Invoking remote execution at [" + endpoint + "]:\n " + request.getCompiledExpression());
    }/*from   www.  jav  a  2  s. c  o  m*/
    final XQEngineClient client = new XQEngineClient(endpoint);
    final Object result;
    try {
        result = client.execute(request);
    } catch (RemoteException e) {
        throw new XQueryException(e.getMessage(), e.getCause());
    } finally {
        try {
            client.close();
        } catch (RemoteException e) {
            LOG.warn("shutdown failed for `" + endpoint + '\'', e);
        }
    }
    Sequence resultSeq = (Sequence) result;
    return resultSeq;
}

From source file:xbird.xquery.expr.ext.MapExpr.java

public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
        throws XQueryException {
    final Grid grid = connectToGrid(true);
    final Sequence<? extends Item> result;
    try {//w  w w.  j  ava  2 s  .c om
        result = grid.execute(MapQueryJob.class, this);
    } catch (RemoteException e) {
        throw new XQueryException(e.getMessage(), e);
    }
    return result;
}

From source file:xbird.xquery.expr.ext.MapExpr.java

private static Grid connectToGrid(boolean delegate) {
    boolean delegated = false;
    GridClient grid = new GridClient();
    if (delegate) {
        try {/* w  w  w.java2  s  .c  om*/
            final GridNode delegatedNode = grid.delegate(true);
            if (delegatedNode != null) {
                delegated = true;
                grid = new GridClient(delegatedNode);
            }
        } catch (RemoteException e) {
            LOG.warn(e.getMessage(), e);
        }
        if (LOG.isInfoEnabled()) {
            LOG.info("Connected to the Grid (" + (delegated ? "remote" : "local") + " master): "
                    + grid.getEndpoint());
        }
    }
    return grid;
}

From source file:xbird.xquery.func.ext.RemoteEval.java

public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
        throws XQueryException {
    String endpoint = argv.getItem(0).stringValue();
    String query = argv.getItem(1).stringValue();

    if (LOG.isInfoEnabled()) {
        LOG.info("Invoking remote query at [" + endpoint + "]:\n " + query);
    }//from   w w w . j  a v  a  2 s .c o  m

    XQEngineClient client = new XQEngineClient(endpoint);
    QueryRequest request = new QueryRequest(query, RETURN_TYPE);
    StaticContext statEnv = dynEnv.getStaticContext();
    URI baseUri = statEnv.getBaseURI();
    if (baseUri == null) {
        baseUri = statEnv.getSystemBaseURI();
    }
    request.setBaseUri(baseUri);
    prepareVariablesToShip(request, argv, dynEnv);
    final Object result;
    try {
        result = client.execute(request);
    } catch (RemoteException e) {
        throw new XQueryException(e.getMessage(), e.getCause());
    } finally {
        try {
            client.close();
        } catch (RemoteException e) {
            LOG.warn("shutdown failed for `" + endpoint + '\'', e);
        }
    }
    Sequence resultSeq = (Sequence) result;
    return resultSeq;
}