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.BusinessLifeCycleManagerImpl.java

public BulkResponse saveAssociations(Collection associations, boolean replace) throws JAXRException {
    BulkResponseImpl bulk = new BulkResponseImpl();
    PublisherAssertion[] sarr = new PublisherAssertion[associations.size()];

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

    Iterator iter = associations.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {

        Association association = (Association) iter.next();
        association.getSourceObject();/*from   w  ww .  j  ava 2 s.  c o  m*/
        PublisherAssertion pa = ScoutJaxrUddiHelper.getPubAssertionFromJAXRAssociation(association);
        sarr[currLoc] = pa;
        currLoc++;

        // Save PublisherAssertion
        PublisherAssertions bd = null;
        try {
            bd = (PublisherAssertions) executeOperation(sarr, "SAVE_ASSOCIATION");
        } catch (RegistryException e) {
            exceptions.add(new SaveException(e));
            bulk.setExceptions(exceptions);
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }
        if (bd != null) {
            List<PublisherAssertion> publisherAssertionList = bd.getPublisherAssertion();
            PublisherAssertion[] keyarr = new PublisherAssertion[publisherAssertionList.size()];
            publisherAssertionList.toArray(keyarr);

            for (int i = 0; keyarr != null && i < keyarr.length; i++) {
                PublisherAssertion result = (PublisherAssertion) keyarr[i];
                KeyedReference keyr = result.getKeyedReference();
                Concept c = new ConceptImpl(getRegistryService().getBusinessLifeCycleManager());
                c.setName(new InternationalStringImpl(keyr.getKeyName()));
                c.setKey(new KeyImpl(keyr.getTModelKey()));
                c.setValue(keyr.getKeyValue());
                association.setAssociationType(c);
                coll.add(association.getKey());
            }
        }
    }
    bulk.setCollection(coll);
    bulk.setExceptions(exceptions);

    return bulk;
}

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

public BulkResponse saveClassificationSchemes(Collection schemes) throws JAXRException {
    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    TModel[] entityarr = new TModel[schemes.size()];

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

    Iterator iter = schemes.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {//from   w ww .j  a  v a  2s .c  o  m
            TModel en = ScoutJaxrUddiHelper
                    .getTModelFromJAXRClassificationScheme((ClassificationScheme) iter.next());
            entityarr[currLoc] = en;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    log.debug("Method:save_classificationscheme: ENlength=" + entityarr.length);
    // Save business
    TModelDetail td = null;
    try {
        td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
    } catch (RegistryException e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        return bulk;
    }

    List<TModel> tmodelList = td.getTModel();
    entityarr = new TModel[tmodelList.size()];
    tmodelList.toArray(entityarr);
    log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
    for (int i = 0; entityarr != null && i < entityarr.length; i++) {
        TModel tm = (TModel) entityarr[i];
        coll.add(new KeyImpl(tm.getTModelKey()));
    }

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

    return bulk;
}

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

public BulkResponse saveConcepts(Collection concepts) throws JAXRException {
    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    TModel[] entityarr = new TModel[concepts.size()];

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

    Iterator iter = concepts.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {/*  www  .j  a  v a2  s  .  co  m*/
            TModel en = ScoutJaxrUddiHelper.getTModelFromJAXRConcept((Concept) iter.next());
            entityarr[currLoc] = en;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    log.debug("Method:save_concept: ENlength=" + entityarr.length);
    // Save business
    TModelDetail td = null;
    try {
        td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
    } catch (RegistryException e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        return bulk;
    }

    List<TModel> tmodelList = td.getTModel();
    entityarr = new TModel[tmodelList.size()];
    tmodelList.toArray(entityarr);

    log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
    for (int i = 0; entityarr != null && i < entityarr.length; i++) {
        TModel tm = (TModel) entityarr[i];
        coll.add(new KeyImpl(tm.getTModelKey()));
    }

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

    return bulk;
}

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

public BulkResponse saveOrganizations(Collection organizations) throws JAXRException {
    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    BusinessEntity[] entityarr = new BusinessEntity[organizations.size()];

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

    Iterator iter = organizations.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {/*from  ww  w  .ja  v  a  2 s  . c om*/
            BusinessEntity en = ScoutJaxrUddiHelper.getBusinessEntityFromJAXROrg((Organization) iter.next());
            entityarr[currLoc] = en;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    log.debug("Method:save_business: ENlength=" + entityarr.length);
    // Save business
    BusinessDetail bd = null;
    try {
        bd = (BusinessDetail) executeOperation(entityarr, "SAVE_ORG");
    } catch (RegistryException e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        bulk.setExceptions(exceptions);
        return bulk;
    }

    List<BusinessEntity> bizEntityList = bd.getBusinessEntity();

    entityarr = new BusinessEntity[bizEntityList.size()];
    bizEntityList.toArray(entityarr);

    log.debug("After Saving Business. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
    for (int i = 0; entityarr != null && i < entityarr.length; i++) {
        BusinessEntity entity = (BusinessEntity) entityarr[i];
        coll.add(new KeyImpl(entity.getBusinessKey()));
    }

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

    return bulk;
}

From source file:org.apache.ws.scout.registry.BusinessLifeCycleManagerImpl.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. j  a va  2  s .  c o m
            BindingTemplate bs = ScoutJaxrUddiHelper.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 (RegistryException 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.BusinessLifeCycleManagerImpl.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 {//from w w  w .j  a  va 2  s . c o  m
            BusinessService bs = ScoutJaxrUddiHelper.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 (RegistryException 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;
}

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

public BulkResponse saveAssociations(Collection associations, boolean replace) throws JAXRException {
    BulkResponseImpl bulk = new BulkResponseImpl();
    PublisherAssertion[] sarr = new PublisherAssertion[associations.size()];

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

    Iterator iter = associations.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {

        Association association = (Association) iter.next();
        association.getSourceObject();//w ww  .  j  a  v  a  2  s . co  m
        PublisherAssertion pa = ScoutJaxrUddiV3Helper.getPubAssertionFromJAXRAssociation(association);
        sarr[currLoc] = pa;
        currLoc++;

        // Save PublisherAssertion
        PublisherAssertions bd = null;
        try {
            bd = (PublisherAssertions) executeOperation(sarr, "SAVE_ASSOCIATION");
        } catch (RegistryV3Exception e) {
            exceptions.add(new SaveException(e));
            bulk.setExceptions(exceptions);
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }
        if (bd != null) {
            List<PublisherAssertion> publisherAssertionList = bd.getPublisherAssertion();
            PublisherAssertion[] keyarr = new PublisherAssertion[publisherAssertionList.size()];
            publisherAssertionList.toArray(keyarr);

            for (int i = 0; keyarr != null && i < keyarr.length; i++) {
                PublisherAssertion result = (PublisherAssertion) keyarr[i];
                KeyedReference keyr = result.getKeyedReference();
                Concept c = new ConceptImpl(getRegistryService().getBusinessLifeCycleManager());
                c.setName(new InternationalStringImpl(keyr.getKeyName()));
                c.setKey(new KeyImpl(keyr.getTModelKey()));
                c.setValue(keyr.getKeyValue());
                association.setAssociationType(c);
                coll.add(association.getKey());
            }
        }
    }
    bulk.setCollection(coll);
    bulk.setExceptions(exceptions);

    return bulk;
}

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

public BulkResponse saveClassificationSchemes(Collection schemes) throws JAXRException {
    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    TModel[] entityarr = new TModel[schemes.size()];

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

    Iterator iter = schemes.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {//from   ww  w  . jav a  2  s.  c om
            TModel en = ScoutJaxrUddiV3Helper
                    .getTModelFromJAXRClassificationScheme((ClassificationScheme) iter.next());
            entityarr[currLoc] = en;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    log.debug("Method:save_classificationscheme: ENlength=" + entityarr.length);
    // Save business
    TModelDetail td = null;
    try {
        td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
    } catch (RegistryV3Exception e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        return bulk;
    }

    List<TModel> tmodelList = td.getTModel();
    entityarr = new TModel[tmodelList.size()];
    tmodelList.toArray(entityarr);
    log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
    for (int i = 0; entityarr != null && i < entityarr.length; i++) {
        TModel tm = (TModel) entityarr[i];
        coll.add(new KeyImpl(tm.getTModelKey()));
    }

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

    return bulk;
}

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

public BulkResponse saveConcepts(Collection concepts) throws JAXRException {
    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    TModel[] entityarr = new TModel[concepts.size()];

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

    Iterator iter = concepts.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {/*w  w  w. j  ava2  s  .  co  m*/
            TModel en = ScoutJaxrUddiV3Helper.getTModelFromJAXRConcept((Concept) iter.next());
            entityarr[currLoc] = en;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    log.debug("Method:save_concept: ENlength=" + entityarr.length);
    // Save business
    TModelDetail td = null;
    try {
        td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
    } catch (RegistryV3Exception e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        return bulk;
    }

    List<TModel> tmodelList = td.getTModel();
    entityarr = new TModel[tmodelList.size()];
    tmodelList.toArray(entityarr);

    log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
    for (int i = 0; entityarr != null && i < entityarr.length; i++) {
        TModel tm = (TModel) entityarr[i];
        coll.add(new KeyImpl(tm.getTModelKey()));
    }

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

    return bulk;
}

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

public BulkResponse saveOrganizations(Collection organizations) throws JAXRException {
    //Now we need to convert the collection into a vector for juddi
    BulkResponseImpl bulk = new BulkResponseImpl();
    BusinessEntity[] entityarr = new BusinessEntity[organizations.size()];

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

    Iterator iter = organizations.iterator();
    int currLoc = 0;
    while (iter.hasNext()) {
        try {/* www .j  a  v a 2s . co  m*/
            BusinessEntity en = ScoutJaxrUddiV3Helper.getBusinessEntityFromJAXROrg((Organization) iter.next());
            entityarr[currLoc] = en;
            currLoc++;
        } catch (ClassCastException ce) {
            throw new UnexpectedObjectException();
        }
    }
    log.debug("Method:save_business: ENlength=" + entityarr.length);
    // Save business
    BusinessDetail bd = null;
    try {
        bd = (BusinessDetail) executeOperation(entityarr, "SAVE_ORG");
    } catch (RegistryV3Exception e) {
        exceptions.add(new SaveException(e.getLocalizedMessage()));
        bulk.setStatus(JAXRResponse.STATUS_FAILURE);
        return bulk;
    }

    List<BusinessEntity> bizEntityList = bd.getBusinessEntity();

    entityarr = new BusinessEntity[bizEntityList.size()];
    bizEntityList.toArray(entityarr);

    log.debug("After Saving Business. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
    for (int i = 0; entityarr != null && i < entityarr.length; i++) {
        BusinessEntity entity = (BusinessEntity) entityarr[i];
        coll.add(new KeyImpl(entity.getBusinessKey()));
    }

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

    return bulk;
}