Example usage for javax.xml.registry SaveException SaveException

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

Introduction

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

Prototype

public SaveException(Throwable cause) 

Source Link

Document

Constructs a JAXRException object initialized with the given Throwable object.

Usage

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

public BulkResponse saveServiceBindings(Collection bindings) throws JAXRException {
    BulkResponseImpl bulk = new BulkResponseImpl();
    BindingTemplate[] sbarr = new BindingTemplate[bindings.size()];

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

    Iterator iter = bindings.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {//from w w  w  .ja  va  2s .  c  o  m
            BindingTemplate bs = ScoutJaxrUddiV3Helper
                    .getBindingTemplateFromJAXRSB((ServiceBinding) iter.next());
            sbarr[currLoc] = bs;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    // Save ServiceBinding
    BindingDetail bd = null;
    try {
        bd = (BindingDetail) executeOperation(sbarr, "SAVE_SERVICE_BINDING");
    } catch (RegistryV3Exception e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        return bulk;
    }

    List<BindingTemplate> bindingTemplateList = bd.getBindingTemplate();
    sbarr = new BindingTemplate[bindingTemplateList.size()];
    bindingTemplateList.toArray(sbarr);

    for (int i = 0; sbarr != null && i < sbarr.length; i++) {
        BindingTemplate bt = (BindingTemplate) sbarr[i];
        coll.add(new KeyImpl(bt.getBindingKey()));
    }
    if (coll.size() > 0) {
        bulk.setCollection(coll);
    }
    bulk.setExceptions(exceptions);

    return bulk;
}

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

public BulkResponse saveServices(Collection services) throws JAXRException {
    BulkResponseImpl bulk = new BulkResponseImpl();
    BusinessService[] sarr = new BusinessService[services.size()];

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

    Iterator iter = services.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {//  w  w w .  j  a  v a  2 s .c om
            BusinessService bs = ScoutJaxrUddiV3Helper.getBusinessServiceFromJAXRService((Service) iter.next());
            sarr[currLoc] = bs;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    // Save Service
    ServiceDetail sd = null;
    try {
        sd = (ServiceDetail) executeOperation(sarr, "SAVE_SERVICE");
    } catch (RegistryV3Exception e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        return bulk;
    }

    List<BusinessService> bizServiceList = sd.getBusinessService();
    sarr = new BusinessService[bizServiceList.size()];
    bizServiceList.toArray(sarr);

    for (int i = 0; sarr != null && i < sarr.length; i++) {
        BusinessService entity = (BusinessService) sarr[i];
        coll.add(new KeyImpl(entity.getServiceKey()));
    }
    bulk.setCollection(coll);
    bulk.setExceptions(exceptions);

    return bulk;
}