Example usage for javax.xml.registry RegistryException getLocalizedMessage

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

Introduction

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

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

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

public BulkResponse getRegistryObjects(Collection objectKeys, String objectType) throws JAXRException {
    IRegistry registry = (IRegistry) registryService.getRegistry();
    //Convert into a vector of strings
    String[] keys = new String[objectKeys.size()];
    int currLoc = 0;
    for (Key key : (Collection<Key>) objectKeys) {
        keys[currLoc] = key.getId();/*from  w w w.j a  va 2 s  . c  om*/
        currLoc++;
    }
    LinkedHashSet<RegistryObject> col = new LinkedHashSet<RegistryObject>();
    LifeCycleManager lcm = registryService.getLifeCycleManagerImpl();

    if (LifeCycleManager.CLASSIFICATION_SCHEME.equalsIgnoreCase(objectType)) {
        try {
            TModelDetail tmodeldetail = registry.getTModelDetail(keys);
            List<TModel> tmodelList = tmodeldetail.getTModel();

            for (TModel tModel : tmodelList) {
                col.add(ScoutUddiJaxrHelper.getConcept(tModel, lcm));
            }

        } catch (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(objectType)) {
        ConnectionImpl con = ((RegistryServiceImpl) getRegistryService()).getConnection();
        AuthToken auth = this.getAuthToken(con, registry);

        try {
            RegisteredInfo ri = null;
            try {
                ri = registry.getRegisteredInfo(auth.getAuthInfo());
            } catch (RegistryException rve) {
                String username = getUsernameFromCredentials(con.getCredentials());
                if (AuthTokenSingleton.getToken(username) != null) {
                    AuthTokenSingleton.deleteAuthToken(username);
                }
                auth = getAuthToken(con, registry);
                ri = registry.getRegisteredInfo(auth.getAuthInfo());
            }

            if (ri != null) {
                for (String key : keys) {
                    BusinessDetail detail = registry.getBusinessDetail(key);
                    col.add(((BusinessLifeCycleManagerImpl) registryService.getLifeCycleManagerImpl())
                            .createOrganization(detail));
                }

            }
        } catch (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.CONCEPT.equalsIgnoreCase(objectType)) {
        try {
            TModelDetail tmodeldetail = registry.getTModelDetail(keys);
            List<TModel> tmodelList = tmodeldetail.getTModel();

            for (TModel tmodel : tmodelList) {
                col.add(ScoutUddiJaxrHelper.getConcept(tmodel, lcm));
            }

        } catch (RegistryException e) {
            throw new JAXRException(e.getLocalizedMessage());
        }
    } else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) {

        try {
            ServiceDetail serviceDetail = registry.getServiceDetail(keys);

            if (serviceDetail != null) {
                List<BusinessService> bizServiceList = serviceDetail.getBusinessService();

                for (BusinessService businessService : bizServiceList) {

                    Service service = getServiceFromBusinessService(businessService, lcm);

                    col.add(service);
                }
            }
        } catch (RegistryException e) {
            throw new JAXRException(e);
        }
    } else {
        throw new JAXRException("Unsupported type " + objectType + " for getRegistryObjects() in Apache Scout");
    }

    return new BulkResponseImpl(col);

}