Example usage for javax.xml.registry RegistryException RegistryException

List of usage examples for javax.xml.registry RegistryException RegistryException

Introduction

In this page you can find the example usage for javax.xml.registry RegistryException RegistryException.

Prototype

public RegistryException(Throwable cause) 

Source Link

Document

Constructs a JAXRException object initialized with the given Throwable object.

Usage

From source file:it.cnr.icar.eric.server.persistence.rdb.InternationalStringDAO.java

protected void loadObject(Object obj, ResultSet rs) throws RegistryException {
    throw new RegistryException(ServerResourceBundle.getInstance().getString("message.unimplementedMethod"));
}

From source file:it.cnr.icar.eric.common.security.wss4j.WSS4JSecurityUtilBase.java

/**
 * Convenience method to extract an UUID/URN from a Content ID (CID). CIDs
 * are used for identifying attachments in signed SOAP messages.
 * /*from  w ww .  jav  a2s .c o  m*/
 * @param cid
 *            The attachment's Content-ID.
 * @return The corresponding UUID/URN.
 */
public static String convertContentIdToUUID(String cid) throws RegistryException {
    if (!(cid.charAt(0) == '<' && cid.charAt(cid.length() - 1) == '>')) {
        // error, not a cid URI Scheme id.
        throw new RegistryException(
                CommonResourceBundle.getInstance().getString("message.CIDURIExpected", new Object[] { cid }));
    }

    String uuid = cid.substring(1, cid.length() - 1);
    return uuid;
}

From source file:it.cnr.icar.eric.server.repository.hibernate.SessionContext.java

public void close() throws RegistryException {
    try {/*from  w ww  .  jav a2  s .c  om*/
        //Only close session if new
        if (isNew) {
            if ((session != null) && (session.isOpen())) {
                session.close();
            }
        }
    } catch (Exception e) {
        String msg = ServerResourceBundle.getInstance().getString("message.FailedCloseDatabaseSession");
        log.error(e, e);
        throw new RegistryException(ServerResourceBundle.getInstance().getString("message.seeLogsForDetails",
                new Object[] { msg }));
    }
}

From source file:it.cnr.icar.eric.server.persistence.rdb.SlotDAO.java

/**
 * Returns the SQL fragment string needed by insert or update statements
 * within insert or update method of sub-classes. This is done to avoid code
 * duplication.//  www . jav  a  2 s  .  c  o  m
 */
protected String getSQLStatementFragment(Object obj) throws RegistryException {
    throw new RegistryException(ServerResourceBundle.getInstance().getString("message.methodNotSupported"));
}

From source file:it.cnr.icar.eric.server.persistence.rdb.AffectedObjectDAO.java

/**
 * Returns the SQL fragment string needed by insert or update statements 
 * within insert or update method of sub-classes. This is done to avoid code
 * duplication.//from  w  ww.  j  av a  2 s  . c o  m
 */
protected String getSQLStatementFragment(Object object) throws RegistryException {
    //object must be an ObjectRef for an objects affected by parent event
    ObjectRefType affectedObject = (ObjectRefType) object;

    String stmtFragment = null;

    String id = affectedObject.getId();
    String home = affectedObject.getHome();

    if (home != null) {
        home = "'" + home + "'";
    }

    String eventId = ((AuditableEventType) parent).getId();

    if (action == DAO_ACTION_INSERT) {
        stmtFragment = "INSERT INTO AffectedObject VALUES(" + " '" + id + "', " + home + ", '" + eventId
                + "' ) ";
    } else if (action == DAO_ACTION_UPDATE) {
        throw new RegistryException(
                ServerResourceBundle.getInstance().getString("message.cannotUpdateComposedObject"));
    } else if (action == DAO_ACTION_DELETE) {
        stmtFragment = super.getSQLStatementFragment(object);
    }

    return stmtFragment;
}

From source file:it.cnr.icar.eric.server.persistence.rdb.ObjectRefDAO.java

protected void loadObject(Object obj, ResultSet rs) throws RegistryException {
    try {/*from   w w w .j ava 2  s .  com*/
        if (!(obj instanceof ObjectRefType)) {
            throw new RegistryException(ServerResourceBundle.getInstance()
                    .getString("message.ObjectRefTypeExpected", new Object[] { obj }));
        }

        ObjectRefType ebObjectRefType = (ObjectRefType) obj;

        String id = rs.getString("id");
        ebObjectRefType.setId(id);

        String home = rs.getString("home");
        if (home != null) {
            ebObjectRefType.setHome(home);
        }
    } catch (SQLException e) {
        log.error(ServerResourceBundle.getInstance().getString("message.CaughtException1"), e);
        throw new RegistryException(e);
    }
}

From source file:it.cnr.icar.eric.server.persistence.rdb.UsageParameterDAO.java

/**
 * Does a bulk insert of a Collection of objects that match the type for this persister.
 *
 *///from  w ww . j  a  va2 s  . com
public void insert(String parentId, List<?> usageParams) throws RegistryException {
    Statement stmt = null;

    if (usageParams.size() == 0) {
        return;
    }

    try {
        stmt = context.getConnection().createStatement();

        Iterator<?> iter = usageParams.iterator();

        while (iter.hasNext()) {
            String value = (String) iter.next();

            String str = "INSERT INTO UsageParameter " + "VALUES( " + "'" + value + "', " + "'" + parentId
                    + "' )";
            log.trace("stmt = " + str);
            stmt.addBatch(str);
        }

        if (usageParams.size() > 0) {
            @SuppressWarnings("unused")
            int[] updateCounts = stmt.executeBatch();
        }
    } catch (SQLException e) {
        RegistryException exception = new RegistryException(e);
        throw exception;
    } finally {
        closeStatement(stmt);
    }
}

From source file:it.cnr.icar.eric.server.cms.ContentValidationServiceManager.java

/**
 * Invokes appropriate Content Management Services for the
 * in the <code>RegistryObject</code>.
 *
 * @param ro a <code>RegistryObject</code> value
 * @param ri a <code>RepositoryItem</code> value
 *///w  w w .  ja va  2s .  c o m
public boolean invokeServiceForObject(ServiceInvocationInfo sii, RegistryObjectType ro, RepositoryItem ri,
        ServerRequestContext context) throws RegistryException {
    System.err.println("ContentValidationServiceManager.invokeServiceForObject()");

    //Validation services only apply to Submit/UpdateObjectsRequests
    RegistryRequestType request = context.getCurrentRegistryRequest();
    if (!((request instanceof SubmitObjectsRequest) || (request instanceof UpdateObjectsRequest))) {

        return false;
    }

    try {
        ContentManagementService cms = (ContentManagementService) sii.getConstructor()
                .newInstance((java.lang.Object[]) null);
        @SuppressWarnings("unused")
        ServiceOutput so = null;
        //Note that ri will be null for ExternalLink ro.
        so = cms.invoke(context, new ServiceInput(ro, ri), sii.getService(), sii.getInvocationController(),
                context.getUser());
    } catch (InstantiationException e) {
        throw new RegistryException(e);
    } catch (IllegalAccessException e) {
        throw new RegistryException(e);
    } catch (InvocationTargetException e) {
        throw new RegistryException(e);
    }

    return true;
}

From source file:it.cnr.icar.eric.server.persistence.rdb.RegistryPackageDAO.java

protected void loadObject(Object obj, ResultSet rs) throws RegistryException {
    try {//from  ww  w .  j  a v  a  2  s . c o m
        if (!(obj instanceof RegistryPackageType)) {
            throw new RegistryException(ServerResourceBundle.getInstance()
                    .getString("message.RegistryPackageExpected", new Object[] { obj }));
        }

        @SuppressWarnings("unused")
        RegistryPackageType ebRegistryPackageType = (RegistryPackageType) obj;
        super.loadObject(obj, rs);

    } catch (Exception e) {
        log.error(ServerResourceBundle.getInstance().getString("message.CaughtException"), e);
        throw new RegistryException(e);
    }
}

From source file:it.cnr.icar.eric.server.persistence.rdb.UsageParameterDAO.java

protected void loadObject(Object obj, ResultSet rs) throws RegistryException {
    try {//from  www . java2s.  co m
        if (!(obj instanceof java.lang.String)) {
            throw new RegistryException(ServerResourceBundle.getInstance()
                    .getString("message.javaLangStringExpected", new Object[] { obj }));
        }

        String value = (String) obj;
        value.concat(rs.getString("value"));
    } catch (SQLException e) {
        log.error(ServerResourceBundle.getInstance().getString("message.CaughtException1"), e);
        throw new RegistryException(e);
    }
}