Example usage for java.rmi RemoteException toString

List of usage examples for java.rmi RemoteException toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:edu.clemson.cs.nestbed.server.management.configuration.ProgramProfilingSymbolManagerImpl.java

public void deleteProfilingSymbolWithID(int programSymbolID) throws RemoteException {
    log.info("Request to delete ProgramProfilingSymbol with " + "programSymbolID: " + programSymbolID);

    try {/*w  ww. ja v  a2 s.  c om*/
        List<ProgramProfilingSymbol> list;
        list = new ArrayList<ProgramProfilingSymbol>(progProfSymbols.values());

        for (ProgramProfilingSymbol i : list) {
            if (i.getProgramSymbolID() == programSymbolID) {
                deleteProfilingSymbol(i.getID());
            }
        }
    } catch (RemoteException ex) {
        throw ex;
    } catch (Exception ex) {
        log.error("Exception in deleteProfilingSymbolWithID");

        RemoteException rex = new RemoteException(ex.toString());
        rex.initCause(ex);
        throw rex;
    }
}

From source file:edu.clemson.cs.nestbed.server.management.configuration.ProgramProfilingSymbolManagerImpl.java

public void deleteProfilingSymbolWithProjectDepConfID(int pdcID) throws RemoteException {
    log.info("Request to delete ProgramProfilingSymbol with " + "projectDeploymentConfigurationID: " + pdcID);

    try {/*from w w w  .ja  v a  2s.  c  om*/
        List<ProgramProfilingSymbol> list;
        list = new ArrayList<ProgramProfilingSymbol>(progProfSymbols.values());

        for (ProgramProfilingSymbol i : list) {
            if (i.getProjectDeploymentConfigurationID() == pdcID) {
                deleteProfilingSymbol(i.getID());
            }
        }
    } catch (RemoteException ex) {
        throw ex;
    } catch (Exception ex) {
        log.error("Exception in deleteProfilingSymbolWithID");

        RemoteException rex = new RemoteException(ex.toString());
        rex.initCause(ex);
        throw rex;
    }
}

From source file:net.sf.farrago.namespace.sfdc.SfdcDataServer.java

private String getFields(String objectName) throws SQLException {
    if (objectName.endsWith("_LOV") || objectName.endsWith("_deleted")) {
        return null;
    }/* w  w w.  j  a  v a 2s .c o m*/
    String allFieldNames = null;
    try {
        DescribeSObjectResult describeSObjectResult = getEntityDescribe(objectName);

        // check the name
        if ((describeSObjectResult != null) && describeSObjectResult.getName().equals(objectName)) {
            com.sforce.soap.partner.Field[] fields = describeSObjectResult.getFields();
            for (int i = 0; i < fields.length; i++) {
                if (i == 0) {
                    allFieldNames = fields[i].getName();
                } else {
                    allFieldNames = allFieldNames + "," + fields[i].getName();
                }
            }
        } else {
            throw SfdcResource.instance().InvalidObjectException.ex(objectName);
        }
    } catch (InvalidSObjectFault io) {
        throw SfdcResource.instance().InvalidObjectException.ex(objectName);
    } catch (RemoteException re) {
        throw SfdcResource.instance().QueryException.ex(objectName, re.toString());
    }
    return allFieldNames;
}

From source file:net.sf.farrago.namespace.sfdc.SfdcDataServer.java

private String getTypes(String objectName, FarragoTypeFactory typeFactory) throws SQLException {
    if (objectName.endsWith("_LOV") || objectName.endsWith("_deleted")) {
        return null;
    }/*  w  w  w.  j av a2s.  c  om*/
    String[] fieldNames = null;
    String types = null;
    try {
        DescribeSObjectResult describeSObjectResult = getEntityDescribe(objectName);

        // check the name
        if ((describeSObjectResult != null) && describeSObjectResult.getName().equals(objectName)) {
            com.sforce.soap.partner.Field[] allFields = describeSObjectResult.getFields();
            fieldNames = new String[allFields.length];
            for (int i = 0; i < allFields.length; i++) {
                fieldNames[i] = allFields[i].getName();
                if (i == 0) {
                    types = ((SfdcNameDirectory) getNameDirectory()).toRelType(allFields[i], typeFactory)
                            .toString();
                } else {
                    types = types + "," + ((SfdcNameDirectory) getNameDirectory())
                            .toRelType(allFields[i], typeFactory).toString();
                }
            }
        } else {
            throw SfdcResource.instance().InvalidObjectException.ex(objectName);
        }
    } catch (InvalidSObjectFault io) {
        throw SfdcResource.instance().InvalidObjectException.ex(objectName);
    } catch (RemoteException re) {
        throw SfdcResource.instance().QueryException.ex(objectName, re.toString());
    }
    return types;
}

From source file:net.sf.farrago.namespace.sfdc.SfdcDataServer.java

private RelDataType deriveRowType(FarragoTypeFactory typeFactory, String objectName) throws SQLException {
    String[] fieldNames = null;//from   ww w.j a v a 2 s .co m
    RelDataType[] types = null;
    try {
        if (objectName.endsWith("_deleted")) {
            types = new RelDataType[] {
                    typeFactory.createTypeWithNullability(
                            typeFactory.createSqlType(SqlTypeName.VARCHAR, 25 + this.varcharPrecision), true),
                    typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.TIMESTAMP,
                            SqlTypeName.TIMESTAMP.getDefaultPrecision()), true) };
            fieldNames = new String[] { "Id", "DeleteStamp" };
        } else if (objectName.endsWith("_LOV")) {
            types = new RelDataType[] {
                    typeFactory.createTypeWithNullability(
                            typeFactory.createSqlType(SqlTypeName.VARCHAR, 25 + this.varcharPrecision), true),
                    typeFactory.createTypeWithNullability(typeFactory.createSqlType(SqlTypeName.VARCHAR,
                            SfdcNameDirectory.MAX_PRECISION + this.varcharPrecision), true) };
            fieldNames = new String[] { "Field", "Value" };
        } else {
            DescribeSObjectResult describeSObjectResult = getEntityDescribe(objectName);

            // check the name
            if ((describeSObjectResult != null) && describeSObjectResult.getName().equals(objectName)) {
                com.sforce.soap.partner.Field[] fields = describeSObjectResult.getFields();
                fieldNames = new String[fields.length];
                types = new RelDataType[fields.length];
                for (int i = 0; i < fields.length; i++) {
                    fieldNames[i] = fields[i].getName();
                    types[i] = ((SfdcNameDirectory) getNameDirectory()).toRelType(fields[i], typeFactory);
                }
            } else {
                throw SfdcResource.instance().InvalidObjectException.ex(objectName);
            }
        }
    } catch (InvalidSObjectFault io) {
        throw SfdcResource.instance().InvalidObjectException.ex(objectName);
    } catch (RemoteException re) {
        throw SfdcResource.instance().QueryException.ex(objectName, re.toString());
    }

    return createRowType(typeFactory, types, fieldNames);
}

From source file:net.sf.farrago.namespace.sfdc.SfdcDataServer.java

private void login(String user, String pass, SoapBindingStub bStub) {
    if (bStub != null) {
        this.binding = bStub;
    } else {//from w  ww .  j a va 2s.  c  om
        try {
            if ((this.endpoint != null) && !this.endpoint.trim().equals("")) {
                this.binding = (SoapBindingStub) new ServiceLocatorGzip().getSoap(new URL(this.endpoint));
            } else {
                this.binding = (SoapBindingStub) new ServiceLocatorGzip().getSoap();
            }
        } catch (ServiceException se) {
            throw SfdcResource.instance().SfdcBinding_ServiceException.ex(se.getMessage());
        } catch (Exception ex) {
            log.error("Error logging into SFDC", ex);
            throw SfdcResource.instance().SfdcLoginFault.ex(ex.toString());
        }
    }

    // Set timeout 2 hours
    this.binding.setTimeout(1000 * 60 * 60 * 2);

    LoginResult loginResult = null;
    try {
        /*
         * EncryptDecryptUtil encryptDecryptUtil =
         * EncryptDecryptUtil.getInstance(); // no encryption during test if
         * (encryptDecryptUtil.isEncrypted(pass)) {
         * encryptDecryptUtil.initKeyFromJNDI(); pass =
         * encryptDecryptUtil.decrypt(pass); } if
         * (encryptDecryptUtil.isEncrypted(user)) {
         * encryptDecryptUtil.initKeyFromJNDI(); user =
         * encryptDecryptUtil.decrypt(user); }
         */
        // AppExchange API ClientID
        // CallOptions co = new CallOptions();
        // co.setClient(getClientIdFromJNDI());
        // binding.setHeader(new SforceServiceLocator().getServiceName()
        // .getNamespaceURI(), "CallOptions", co);

        loginResult = this.binding.login(user, pass);
        log.info(SfdcResource.instance().LoggedInMsg.str());
    } catch (LoginFault lf) {
        throw SfdcResource.instance().SfdcLoginFault.ex(lf.getExceptionMessage());
    } catch (UnexpectedErrorFault uef) {
        throw SfdcResource.instance().SfdcLoginFault.ex(uef.getExceptionMessage());
    } catch (RemoteException re) {
        throw SfdcResource.instance().SfdcLoginFault.ex(re.toString());
    } catch (Exception ex) {
        log.error("Error logging into SFDC", ex);
        throw SfdcResource.instance().SfdcLoginFault.ex(ex.toString());
    }

    // set the session header for subsequent call authentication
    binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());

    // Create a new session header object and set the session id to that
    // returned by the login
    SessionHeader sh = new SessionHeader();
    sh.setSessionId(loginResult.getSessionId());
    binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader", sh);
    Date now = new Date();
    nextLoginTime = new Date(now.getTime() + (20 * 60 * 1000));
}

From source file:de.escidoc.core.common.business.fedora.FedoraUtility.java

/**
 * The method retrieves history of a datastream.
 * //from   w  w w  . j a v a  2s . co  m
 * @param pid
 *            Fedora object id
 * @param dsID
 *            ID of the datastream
 * @return history of datastream.
 * @throws FedoraSystemException
 *             Thrown if Fedora request failed.
 */
public Datastream[] getDatastreamHistory(final String pid, final String dsID) throws FedoraSystemException {
    Datastream[] datastreams = null;
    final FedoraAPIM apim = borrowApim();
    try {
        datastreams = apim.getDatastreamHistory(pid, dsID);
    } catch (final RemoteException e) {
        throw new FedoraSystemException(e.toString(), e);
    } finally {
        returnApim(apim);
    }
    return datastreams;
}

From source file:de.escidoc.core.common.business.fedora.FedoraUtility.java

/**
 * Touch the object in Fedora. The object is only modified to new version with 'touched' comment. No further update
 * is done. As last process is the TripleStore synced.
 * /*from www  . ja  v a2s .  c  o  m*/
 * @param pid
 *            Fedora object id.
 * @param syncTripleStore
 *            Set true if the TripleStore is to sync after object modifiing. Set false otherwise.
 * @return modified timestamp of the Fedora Objects
 * @throws FedoraSystemException
 *             Thrown if modifiyObject in Fedora fails.
 * @throws WebserverSystemException
 *             Thrown if sync TripleStore failed.
 */
public String touchObject(final String pid, final boolean syncTripleStore)
        throws FedoraSystemException, WebserverSystemException {

    String timestamp = null;
    final FedoraAPIM apim = borrowApim();
    try {
        timestamp = apim.modifyObject(pid, null, null, null, "touched");
    } catch (final RemoteException e) {
        throw new FedoraSystemException(e.toString(), e);
    } finally {
        returnApim(apim);
        if (syncTripleStore) {
            sync();
        }
    }
    return timestamp;
}

From source file:nz.co.jsrsolutions.ds3.provider.EodDataEodDataProvider.java

public EodDataEodDataProvider(String url, String username, String password, long timeout)
        throws EodDataProviderException {

    this.url = url;
    this.username = username;
    this.password = password;
    this.timeout = timeout;

    try {/*  w w w  .  j  ava  2s.  c o  m*/

        HttpMethodParams methodParams = new HttpMethodParams();
        DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(3, false);
        methodParams.setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);

        eodDataStub = new DataStub(url);
        eodDataStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(timeout);
        eodDataStub._getServiceClient().getOptions().setProperty(HTTPConstants.HTTP_METHOD_PARAMS,
                methodParams);

        DataStub.Login loginRequest = new DataStub.Login();
        loginRequest.setUsername(username);
        loginRequest.setPassword(password);

        // Login
        DataStub.LoginResponse0 loginResponse0 = eodDataStub.login(loginRequest);
        DataStub.LOGINRESPONSE loginResponse = loginResponse0.getLoginResult();

        if (loginResponse == null) {
            throw new EodDataProviderException("Failed to authenticate with EOD Data web service.");
        }

        token = loginResponse.getToken();

        if (token == null || token.isEmpty()) {
            throw new EodDataProviderException("Failed to authenticate with EOD Data web service.");
        }

        logger.info(loginResponse.getMessage());
        logger.info(token);
        logger.info(loginResponse.getDataFormat());
    } catch (org.apache.axis2.AxisFault afe) {

        logger.error(afe.toString());
        EodDataProviderException edpe = new EodDataProviderException("Unable to construct EodDataDataProvider");
        edpe.initCause(afe);

        throw edpe;

    } catch (java.rmi.RemoteException re) {

        logger.error(re.toString());
        EodDataProviderException edpe = new EodDataProviderException("Unable to construct EodDataDataProvider");
        edpe.initCause(re);

        throw edpe;

    }

}

From source file:nz.co.jsrsolutions.ds3.provider.EodDataEodDataProvider.java

public synchronized EXCHANGE[] getExchanges() throws EodDataProviderException {

    try {/*from w  w w.jav  a 2  s .  c  o m*/

        // exchangeList
        DataStub.ExchangeList exchangeListRequest = new DataStub.ExchangeList();
        exchangeListRequest.setToken(token);

        DataStub.ExchangeListResponse exchangeListResponse = eodDataStub.exchangeList(exchangeListRequest);
        DataStub.EXCHANGE[] exchanges = exchangeListResponse.getExchangeListResult().getEXCHANGES()
                .getEXCHANGE();

        for (DataStub.EXCHANGE exchange : exchanges) {

            if (logger.isDebugEnabled()) {

                StringBuffer logMessageBuffer = new StringBuffer();
                logMessageBuffer.append(" [ ");
                logMessageBuffer.append(exchange.getCode());
                logMessageBuffer.append(" ]  [ ");
                logMessageBuffer.append(exchange.getName());
                logMessageBuffer.append(" ] [ ");
                logMessageBuffer.append(exchange.getCountry());
                logMessageBuffer.append(" ]");
                logger.debug(logMessageBuffer.toString());

            }
        }

        // exchangeGet
        //      DataStub.ExchangeGet exchangeGetRequest = new DataStub.ExchangeGet();
        //      exchangeGetRequest.setToken(token);
        //      exchangeGetRequest.setExchange("WCE");

        //      DataStub.ExchangeGetResponse exchangeGetResponse = eodDataStub.exchangeGet(exchangeGetRequest);
        //      DataStub.ArrayOfExchange exchanges = exchangeGetResponse.getExchangeGetResult().getEXCHANGES();
        //      EXCHANGE[] exchanges = exchanges.getEXCHANGE();

        //      logger.debug(exchangeGetResponse.getExchangeGetResult().getMessage());

        return exchanges;

    } catch (java.rmi.RemoteException re) {

        logger.error(re.toString());
        EodDataProviderException edpe = new EodDataProviderException("Unable to get exchanges");
        edpe.initCause(re);

        throw edpe;

    }

}