Example usage for java.rmi RemoteException RemoteException

List of usage examples for java.rmi RemoteException RemoteException

Introduction

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

Prototype

public RemoteException(String s, Throwable cause) 

Source Link

Document

Constructs a RemoteException with the specified detail message and cause.

Usage

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSItemPK deleteItem(WSDeleteItem wsDeleteItem) throws RemoteException {
    try {//  w  w w  .j  a v  a 2s .c  o  m
        WSItemPK itemPK = wsDeleteItem.getWsItemPK();
        deleteItemWithReport(new WSDeleteItemWithReport(itemPK, wsDeleteItem.getSource(),
                UpdateReportPOJO.OPERATION_TYPE_PHYSICAL_DELETE, "/", //$NON-NLS-1$
                LocalUser.getLocalUser().getUsername(), wsDeleteItem.getInvokeBeforeDeleting(),
                wsDeleteItem.getWithReport(), wsDeleteItem.getOverride()));
        return itemPK;
    } catch (Exception e) {
        e = (e instanceof XtentisException && e.getCause() != null) ? (Exception) e.getCause() : e;
        ConstraintViolationException causeException1 = getCauseExceptionByType(e,
                com.amalto.core.storage.exception.ConstraintViolationException.class);
        if (causeException1 != null) {
            throw new RemoteException(StringUtils.EMPTY,
                    new CoreException(INTEGRITY_CONSTRAINT_CHECK_FAILED_MESSAGE, causeException1));
        }
        BeforeDeletingErrorException causeException2 = getCauseExceptionByType(e,
                com.amalto.core.util.BeforeDeletingErrorException.class);
        if (causeException2 != null) {
            throw new RemoteException(StringUtils.EMPTY,
                    new CoreException(causeException2.getLocalizedMessage(), causeException2));
        }
        throw new RemoteException(e.getLocalizedMessage(), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSInt deleteItems(WSDeleteItems wsDeleteItems) throws RemoteException {
    try {/*from   w  w w.  j a v a 2s .c o m*/
        // TODO Query ids if request for update report
        int numItems = Util.getItemCtrl2Local().deleteItems(
                new DataClusterPOJOPK(wsDeleteItems.getWsDataClusterPK().getPk()),
                wsDeleteItems.getConceptName(), XConverter.WS2VO(wsDeleteItems.getWsWhereItem()),
                wsDeleteItems.getSpellTreshold(), wsDeleteItems.getOverride());
        return new WSInt(numItems);
    } catch (Exception e) {
        if (getCauseExceptionByType(e,
                com.amalto.core.storage.exception.ConstraintViolationException.class) != null) {
            throw new RemoteException(StringUtils.EMPTY,
                    new CoreException(INTEGRITY_CONSTRAINT_CHECK_FAILED_MESSAGE, e.getCause()));
        }
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSDroppedItemPK dropItem(WSDropItem wsDropItem) throws RemoteException {
    try {/*from   w  ww.  ja  va 2  s  . c  o  m*/
        WSItemPK wsItemPK = wsDropItem.getWsItemPK();
        deleteItemWithReport(new WSDeleteItemWithReport(wsItemPK, wsDropItem.getSource(),
                UpdateReportPOJO.OPERATION_TYPE_LOGICAL_DELETE, wsDropItem.getPartPath(),
                LocalUser.getLocalUser().getUsername(), wsDropItem.getInvokeBeforeDeleting(),
                wsDropItem.getWithReport(), wsDropItem.getOverride()));
        return new WSDroppedItemPK(wsItemPK, wsDropItem.getPartPath()); // TODO Revision
    } catch (Exception e) {
        ConstraintViolationException causeException = getCauseExceptionByType(e,
                com.amalto.core.storage.exception.ConstraintViolationException.class);
        if (causeException != null) {
            throw new RemoteException(StringUtils.EMPTY,
                    new CoreException(INTEGRITY_CONSTRAINT_CHECK_FAILED_MESSAGE, causeException));
        }
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSStringArray runQuery(WSRunQuery wsRunQuery) throws RemoteException {
    try {/*from   w  w  w . ja v a2  s .co  m*/
        DataClusterPOJOPK dcpk = (wsRunQuery.getWsDataClusterPK() == null) ? null
                : new DataClusterPOJOPK(wsRunQuery.getWsDataClusterPK().getPk());
        Collection<String> result = Util.getItemCtrl2Local().runQuery(dcpk, wsRunQuery.getQuery(),
                wsRunQuery.getParameters());
        // stored procedure may modify the db, so we need to clear the cache
        Util.getXmlServerCtrlLocal().clearCache();
        return new WSStringArray(result.toArray(new String[result.size()]));
    } catch (Exception e) {
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSStoredProcedurePK deleteStoredProcedure(WSDeleteStoredProcedure wsStoredProcedureDelete)
        throws RemoteException {
    try {//from w w w  .ja va2s.c o m
        StoredProcedure ctrl = Util.getStoredProcedureCtrlLocal();
        StoredProcedurePOJOPK pk = ctrl.removeStoredProcedure(
                new StoredProcedurePOJOPK(wsStoredProcedureDelete.getWsStoredProcedurePK().getPk()));
        return new WSStoredProcedurePK(pk.getIds()[0]);
    } catch (Exception e) {
        throw new RemoteException(e.getLocalizedMessage(), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSStringArray executeStoredProcedure(WSExecuteStoredProcedure wsExecuteStoredProcedure)
        throws RemoteException {
    try {//w w  w  . ja va 2s.c o  m
        StoredProcedure ctrl = Util.getStoredProcedureCtrlLocal();
        DataClusterPOJOPK dcpk = null;
        if (wsExecuteStoredProcedure.getWsDataClusterPK() != null) {
            dcpk = new DataClusterPOJOPK(wsExecuteStoredProcedure.getWsDataClusterPK().getPk());
        }
        Collection<String> collection = ctrl.execute(
                new StoredProcedurePOJOPK(wsExecuteStoredProcedure.getWsStoredProcedurePK().getPk()), dcpk,
                wsExecuteStoredProcedure.getParameters());
        if (collection == null) {
            return null;
        }
        String[] documents = new String[collection.size()];
        int i = 0;
        for (String s : collection) {
            documents[i++] = s;
        }
        return new WSStringArray(documents);
    } catch (Exception e) {
        throw new RemoteException(e.getLocalizedMessage(), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSStoredProcedure getStoredProcedure(WSGetStoredProcedure wsGetStoredProcedure) throws RemoteException {
    try {// w  ww . ja v  a2 s .  c o m
        StoredProcedure ctrl = Util.getStoredProcedureCtrlLocal();
        StoredProcedurePOJO pojo = ctrl.getStoredProcedure(
                new StoredProcedurePOJOPK(wsGetStoredProcedure.getWsStoredProcedurePK().getPk()));
        return XConverter.POJO2WS(pojo);
    } catch (Exception e) {
        throw new RemoteException(e.getLocalizedMessage(), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSBoolean existsStoredProcedure(WSExistsStoredProcedure wsExistsStoredProcedure) throws RemoteException {
    try {//  w  w w .  j  a  va2 s. c  om
        StoredProcedure ctrl = Util.getStoredProcedureCtrlLocal();
        StoredProcedurePOJO pojo = ctrl.existsStoredProcedure(
                new StoredProcedurePOJOPK(wsExistsStoredProcedure.getWsStoredProcedurePK().getPk()));
        return new WSBoolean(pojo != null);
    } catch (Exception e) {
        throw new RemoteException(e.getLocalizedMessage(), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSStoredProcedurePKArray getStoredProcedurePKs(WSRegexStoredProcedure regex) throws RemoteException {
    try {/* w w w .j  a  v a 2s  .  com*/
        StoredProcedure ctrl = Util.getStoredProcedureCtrlLocal();
        Collection<StoredProcedurePOJOPK> collection = ctrl.getStoredProcedurePKs(regex.getRegex());
        if (collection == null) {
            return null;
        }
        WSStoredProcedurePK[] pks = new WSStoredProcedurePK[collection.size()];
        int i = 0;
        for (StoredProcedurePOJOPK o : collection) {
            pks[i++] = new WSStoredProcedurePK(o.getIds()[0]);
        }
        return new WSStoredProcedurePKArray(pks);
    } catch (Exception e) {
        throw new RemoteException(e.getLocalizedMessage(), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSStoredProcedurePK putStoredProcedure(WSPutStoredProcedure wsStoredProcedure) throws RemoteException {
    try {//from   ww  w.  j ava 2  s  .  c om
        StoredProcedure ctrl = Util.getStoredProcedureCtrlLocal();
        StoredProcedurePOJOPK pk = ctrl
                .putStoredProcedure(XConverter.WS2POJO(wsStoredProcedure.getWsStoredProcedure()));
        return new WSStoredProcedurePK(pk.getIds()[0]);
    } catch (Exception e) {
        throw new RemoteException(e.getLocalizedMessage(), e);
    }
}