Example usage for javax.xml.registry DeleteException DeleteException

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

Introduction

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

Prototype

public DeleteException(Throwable cause) 

Source Link

Document

Constructs a JAXRException object initialized with the given Throwable object.

Usage

From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.java

protected BulkResponse deleteOperation(Collection<Key> keys, String op) throws JAXRException {
    if (keys == null)
        throw new JAXRException("Keys provided to " + op + " are null");

    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    String[] keyarr = new String[keys.size()];
    Result[] keyResultArr;/*  w  w w .j av a  2  s.c  o  m*/

    LinkedHashSet<Key> coll = new LinkedHashSet<Key>();
    Collection<Exception> exceptions = new ArrayList<Exception>();

    try {
        Iterator iter = keys.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            Key key = (Key) iter.next();
            keyarr[currLoc] = key.getId();
            currLoc++;
        }
        // Save business
        DispositionReport bd = (DispositionReport) executeOperation(keyarr, op);
        List<Result> resultList = bd.getResult();
        keyResultArr = new Result[resultList.size()];
        resultList.toArray(keyResultArr);

        log.debug("After deleting Business. Obtained vector size:" + keyResultArr != null ? keyResultArr.length
                : 0);
        for (int i = 0; keyResultArr != null && i < keyResultArr.length; i++) {
            Result result = (Result) keyResultArr[i];
            int errno = result.getErrno();
            if (errno == 0) {
                coll.addAll(keys);
            } else {
                ErrInfo errinfo = result.getErrInfo();
                DeleteException de = new DeleteException(errinfo.getErrCode() + ":" + errinfo.getValue());
                bulk.setStatus(JAXRResponse.STATUS_FAILURE);
                exceptions.add(de);
            }
        }
    } catch (RegistryException regExcept) {

        /*
         * jUDDI (and prollie others) throw an exception on any fault in
         * the transaction w/ the registry, so we don't get any partial
         * success
         */
        DeleteException de = new DeleteException(regExcept.getFaultCode() + ":" + regExcept.getFaultString(),
                regExcept);

        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        exceptions.add(de);
    } catch (JAXRException tran) {
        exceptions.add(new JAXRException("Apache JAXR Impl:", tran));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
    }

    bulk.setCollection(coll);
    bulk.setExceptions(exceptions);

    return bulk;
}

From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerV3Impl.java

protected BulkResponse deleteOperation(Collection<Key> keys, String op) throws JAXRException {
    if (keys == null)
        throw new JAXRException("Keys provided to " + op + " are null");

    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    String[] keyarr = new String[keys.size()];
    Result[] keyResultArr;//from   w ww .ja  v  a2s.c om

    LinkedHashSet<Key> coll = new LinkedHashSet<Key>();
    Collection<Exception> exceptions = new ArrayList<Exception>();

    try {
        Iterator iter = keys.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            Key key = (Key) iter.next();
            keyarr[currLoc] = key.getId();
            currLoc++;
        }
        // Delete operation
        DispositionReport bd = (DispositionReport) executeOperation(keyarr, op);
        List<Result> resultList = bd.getResult();
        keyResultArr = new Result[resultList.size()];
        resultList.toArray(keyResultArr);

        log.debug("After deleting Business. Obtained vector size:" + keyResultArr != null ? keyResultArr.length
                : 0);
        for (int i = 0; keyResultArr != null && i < keyResultArr.length; i++) {
            Result result = (Result) keyResultArr[i];
            int errno = result.getErrno();
            if (errno == 0) {
                coll.addAll(keys);
            } else {
                ErrInfo errinfo = result.getErrInfo();
                DeleteException de = new DeleteException(errinfo.getErrCode() + ":" + errinfo.getValue());
                bulk.setStatus(JAXRResponse.STATUS_FAILURE);
                exceptions.add(de);
            }
        }
    } catch (RegistryV3Exception regExcept) {

        /*
         * jUDDI (and prollie others) throw an exception on any fault in
         * the transaction w/ the registry, so we don't get any partial
         * success
         */
        DeleteException de = new DeleteException(regExcept.getFaultCode() + ":" + regExcept.getFaultString(),
                regExcept);

        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        exceptions.add(de);
    } catch (JAXRException tran) {
        exceptions.add(new JAXRException("Apache JAXR Impl:", tran));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
    }

    bulk.setCollection(coll);
    bulk.setExceptions(exceptions);

    return bulk;
}