ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r797311 [2/3] - in /webservices/scout/branches/v1.1: jaxr-api/src/main/java/javax/xml/registry/ jaxr-api/src/main/java/javax/xml/registry/infomodel/ scout/src/main/java/org/apache/ws/scout/registry/ scout/src/main/java/org/apache/ws/scout/r...
Date Fri, 24 Jul 2009 02:45:34 GMT
Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java (original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/LifeCycleManagerImpl.java Fri Jul 24 02:45:33 2009
@@ -1,493 +1,493 @@
-/**
- *
- * Copyright 2004 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.ws.scout.registry;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-
-import javax.activation.DataHandler;
-import javax.xml.registry.BulkResponse;
-import javax.xml.registry.InvalidRequestException;
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.LifeCycleManager;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.UnsupportedCapabilityException;
-import javax.xml.registry.infomodel.Association;
-import javax.xml.registry.infomodel.Classification;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.Concept;
-import javax.xml.registry.infomodel.EmailAddress;
-import javax.xml.registry.infomodel.ExternalIdentifier;
-import javax.xml.registry.infomodel.ExternalLink;
-import javax.xml.registry.infomodel.ExtrinsicObject;
-import javax.xml.registry.infomodel.InternationalString;
-import javax.xml.registry.infomodel.Key;
-import javax.xml.registry.infomodel.LocalizedString;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.PersonName;
-import javax.xml.registry.infomodel.PostalAddress;
-import javax.xml.registry.infomodel.RegistryObject;
-import javax.xml.registry.infomodel.RegistryPackage;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.ServiceBinding;
-import javax.xml.registry.infomodel.Slot;
-import javax.xml.registry.infomodel.SpecificationLink;
-import javax.xml.registry.infomodel.TelephoneNumber;
-import javax.xml.registry.infomodel.User;
-
-import org.apache.ws.scout.model.uddi.v2.BusinessDetail;
-import org.apache.ws.scout.model.uddi.v2.BusinessInfo;
-import org.apache.ws.scout.model.uddi.v2.Description;
-import org.apache.ws.scout.model.uddi.v2.Name;
-import org.apache.ws.scout.model.uddi.v2.ServiceInfo;
-import org.apache.ws.scout.registry.infomodel.AssociationImpl;
-import org.apache.ws.scout.registry.infomodel.ClassificationImpl;
-import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
-import org.apache.ws.scout.registry.infomodel.ConceptImpl;
-import org.apache.ws.scout.registry.infomodel.EmailAddressImpl;
-import org.apache.ws.scout.registry.infomodel.ExternalIdentifierImpl;
-import org.apache.ws.scout.registry.infomodel.ExternalLinkImpl;
-import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
-import org.apache.ws.scout.registry.infomodel.KeyImpl;
-import org.apache.ws.scout.registry.infomodel.LocalizedStringImpl;
-import org.apache.ws.scout.registry.infomodel.OrganizationImpl;
-import org.apache.ws.scout.registry.infomodel.PersonNameImpl;
-import org.apache.ws.scout.registry.infomodel.PostalAddressImpl;
-import org.apache.ws.scout.registry.infomodel.ServiceBindingImpl;
-import org.apache.ws.scout.registry.infomodel.ServiceImpl;
-import org.apache.ws.scout.registry.infomodel.SlotImpl;
-import org.apache.ws.scout.registry.infomodel.SpecificationLinkImpl;
-import org.apache.ws.scout.registry.infomodel.TelephoneNumberImpl;
-import org.apache.ws.scout.registry.infomodel.UserImpl;
-import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
-
-/**
- * Implements JAXR LifeCycleManager Interface
- * For futher details, look into the JAXR API Javadoc.
- *
- * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
- * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- */
-public abstract class LifeCycleManagerImpl implements LifeCycleManager {
-    protected final RegistryServiceImpl registry;
-
-    public LifeCycleManagerImpl(RegistryService registry) {
-        this.registry = (RegistryServiceImpl) registry;
-    }
-
-    public RegistryService getRegistryService() {
-        return registry;
-    }
-
-    public Object createObject(String interfaceName) throws JAXRException {
-        // we don't use reflection so that we can work in environments where
-        // we may not have permission to do so
-        if (LifeCycleManager.ASSOCIATION.equals(interfaceName)) {
-            return new AssociationImpl(this);
-        }
-        else if (LifeCycleManager.AUDITABLE_EVENT.equals(interfaceName)) {
-            throw new UnsupportedCapabilityException();
-        }
-        else if (LifeCycleManager.CLASSIFICATION.equals(interfaceName)) {
-            return new ClassificationImpl(this);
-        }
-        else if (LifeCycleManager.CLASSIFICATION_SCHEME.equals(interfaceName)) {
-            return new ClassificationSchemeImpl(this);
-        }
-        else if (LifeCycleManager.CONCEPT.equals(interfaceName)) {
-            return new ConceptImpl(this);
-        }
-        else if (LifeCycleManager.EMAIL_ADDRESS.equals(interfaceName)) {
-            return new EmailAddressImpl();
-        }
-        else if (LifeCycleManager.EXTERNAL_IDENTIFIER.equals(interfaceName)) {
-            return new ExternalIdentifierImpl(this);
-        }
-        else if (LifeCycleManager.EXTERNAL_LINK.equals(interfaceName)) {
-            return new ExternalLinkImpl(this);
-        }
-        else if (LifeCycleManager.EXTRINSIC_OBJECT.equals(interfaceName)) {
-            throw new UnsupportedCapabilityException();
-        }
-        else if (LifeCycleManager.INTERNATIONAL_STRING.equals(interfaceName)) {
-            return new InternationalStringImpl();
-        }
-        else if (LifeCycleManager.KEY.equals(interfaceName)) {
-            return new KeyImpl();
-        }
-        else if (LifeCycleManager.LOCALIZED_STRING.equals(interfaceName)) {
-            return new LocalizedStringImpl();
-        }
-        else if (LifeCycleManager.ORGANIZATION.equals(interfaceName)) {
-            return new OrganizationImpl(this);
-        }
-        else if (LifeCycleManager.PERSON_NAME.equals(interfaceName)) {
-            return new PersonNameImpl();
-        }
-        else if (LifeCycleManager.POSTAL_ADDRESS.equals(interfaceName)) {
-            return new PostalAddressImpl(registry.getDefaultPostalScheme());
-        }
-        else if (LifeCycleManager.REGISTRY_ENTRY.equals(interfaceName)) {
-            throw new UnsupportedCapabilityException();
-        }
-        else if (LifeCycleManager.REGISTRY_PACKAGE.equals(interfaceName)) {
-            throw new UnsupportedCapabilityException();
-        }
-        else if (LifeCycleManager.SERVICE.equals(interfaceName)) {
-            return new ServiceImpl(this);
-        }
-        else if (LifeCycleManager.SERVICE_BINDING.equals(interfaceName)) {
-            return new ServiceBindingImpl(this);
-        }
-        else if (LifeCycleManager.SLOT.equals(interfaceName)) {
-            return new SlotImpl();
-        }
-        else if (LifeCycleManager.SPECIFICATION_LINK.equals(interfaceName)) {
-            return new SpecificationLinkImpl(this);
-        }
-        else if (LifeCycleManager.TELEPHONE_NUMBER.equals(interfaceName)) {
-            return new TelephoneNumberImpl();
-        }
-        else if (LifeCycleManager.USER.equals(interfaceName)) {
-            return new UserImpl(this);
-        }
-        else if (LifeCycleManager.VERSIONABLE.equals(interfaceName)) {
-            throw new UnsupportedCapabilityException();
-        }
-        else {
-            throw new InvalidRequestException("Unknown interface: " + interfaceName);
-        }
-    }
-
-    public Association createAssociation(RegistryObject targetObject, Concept associationType) throws JAXRException {
-        Association assoc = (Association) this.createObject(LifeCycleManager.ASSOCIATION);
-        assoc.setTargetObject(targetObject);
-        assoc.setAssociationType(associationType);
-        return assoc;
-    }
-
-    public Classification createClassification(Concept concept) throws JAXRException, InvalidRequestException {
-        if (concept.getClassificationScheme() == null) {
-            throw new InvalidRequestException("Concept is not under classification scheme");
-        }
-        Classification classify = (Classification) this.createObject(LifeCycleManager.CLASSIFICATION);
-        classify.setConcept(concept);
-        return classify;
-    }
-
-    public Classification createClassification(ClassificationScheme scheme,
-                                               InternationalString name,
-                                               String value) throws JAXRException {
-        Classification cl = (Classification) this.createObject(LifeCycleManager.CLASSIFICATION);
-        cl.setClassificationScheme(scheme);
-        cl.setName(name);
-        cl.setValue(value);
-
-        ((ClassificationImpl) cl).setExternal(true);
-
-        return cl;
-    }
-
-    public Classification createClassification(ClassificationScheme scheme,
-                                               String name, String value)
-            throws JAXRException {
-        return createClassification(scheme, this.createInternationalString(name), value);
-    }
-
-    public ClassificationScheme createClassificationScheme(Concept concept) throws JAXRException, InvalidRequestException {
-        //Check if the passed concept has a classificationscheme or has a parent concept
-        if (concept.getParentConcept() != null || concept.getClassificationScheme() != null) {
-            throw new InvalidRequestException("Concept has classificationscheme or has a parent");
-        }
-
-
-        ClassificationScheme cs = new ClassificationSchemeImpl(this);
-        cs.addChildConcept(concept);
-        return cs;
-    }
-
-    public ClassificationScheme createClassificationScheme(InternationalString name,
-                                                           InternationalString des)
-            throws JAXRException, InvalidRequestException {
-        ClassificationScheme cs = new ClassificationSchemeImpl(this);
-        cs.setName(name);
-        cs.setDescription(des);
-        return cs;
-    }
-
-    public ClassificationScheme createClassificationScheme(String name, String desc)
-            throws JAXRException, InvalidRequestException {
-        return createClassificationScheme(this.createInternationalString(name),
-                this.createInternationalString(desc));
-    }
-
-    public Concept createConcept(RegistryObject parent, InternationalString name, String value)
-            throws JAXRException {
-        ConceptImpl concept = new ConceptImpl(this);
-        concept.setClassificationScheme((ClassificationScheme) parent);
-        concept.setParent(parent);
-        concept.setName(name);
-        concept.setValue(value);
-        return concept;
-    }
-
-    public Concept createConcept(RegistryObject parent, String name, String value) throws JAXRException {
-        return createConcept(parent, this.createInternationalString(name), value);
-    }
-
-    public EmailAddress createEmailAddress(String address) throws JAXRException {
-        return new EmailAddressImpl(address);
-    }
-
-    public EmailAddress createEmailAddress(String address, String type) throws JAXRException {
-        return new EmailAddressImpl(address, type);
-    }
-
-    public ExternalIdentifier createExternalIdentifier(ClassificationScheme ids,
-                                                       InternationalString name,
-                                                       String value) throws JAXRException {
-        return new ExternalIdentifierImpl(this, ids, name, value);
-    }
-
-    public ExternalIdentifier createExternalIdentifier(ClassificationScheme ids,
-                                                       String name, String value) throws JAXRException {
-        return createExternalIdentifier(ids, this.createInternationalString(name), value);
-    }
-
-    public ExternalLink createExternalLink(String uri, InternationalString desc) throws JAXRException {
-        ExternalLink ext = new ExternalLinkImpl(this);
-        ext.setExternalURI(uri);
-        ext.setDescription(desc);
-        return ext;
-    }
-
-    public ExternalLink createExternalLink(String uri, String desc) throws JAXRException {
-        return createExternalLink(uri, createInternationalString(desc));
-    }
-
-    public InternationalString createInternationalString() throws JAXRException {
-        return new InternationalStringImpl();
-    }
-
-    public InternationalString createInternationalString(String value) throws JAXRException {
-        return new InternationalStringImpl(Locale.getDefault(), value, LocalizedString.DEFAULT_CHARSET_NAME);
-    }
-
-    public InternationalString createInternationalString(Locale locale, String value) throws JAXRException {
-        return new InternationalStringImpl(locale, value, LocalizedString.DEFAULT_CHARSET_NAME);
-    }
-
-    public Key createKey(String id) {
-        return new KeyImpl(id);
-    }
-
-    public LocalizedString createLocalizedString(Locale locale, String value) throws JAXRException {
-        return new LocalizedStringImpl(locale, value, LocalizedString.DEFAULT_CHARSET_NAME);
-    }
-
-    public LocalizedString createLocalizedString(Locale locale, String value, String charsetName) throws JAXRException {
-        return new LocalizedStringImpl(locale, value, charsetName);
-    }
-
-    public Organization createOrganization(InternationalString name) throws JAXRException {
-        Organization org = (Organization) this.createObject(LifeCycleManager.ORGANIZATION);
-        org.setName(name);
-        return org;
-    }
-
-    public Organization createOrganization(String name) throws JAXRException {
-        Organization org = (Organization) this.createObject(LifeCycleManager.ORGANIZATION);
-        org.setName(this.createInternationalString(name));
-        return org;
-    }
-
-    public PersonName createPersonName(String fullName) throws JAXRException {
-        PersonName pn = (PersonName) this.createObject(LifeCycleManager.PERSON_NAME);
-        pn.setFullName(fullName);
-        return pn;
-    }
-
-    public PostalAddress createPostalAddress(String streetNumber,
-                                             String street,
-                                             String city,
-                                             String stateOrProvince,
-                                             String country,
-                                             String postalCode, String type) throws JAXRException {
-        PostalAddress post = new PostalAddressImpl();
-        post.setStreetNumber(streetNumber);
-        post.setStreet(street);
-        post.setCity(city);
-        post.setStateOrProvince(stateOrProvince);
-        post.setCountry(country);
-        post.setPostalCode(postalCode);
-        post.setType(type);
-        return post;
-    }
-
-    public Service createService(InternationalString name) throws JAXRException {
-        Service ser = (Service) this.createObject(LifeCycleManager.SERVICE);
-        ser.setName(name);
-        return ser;
-    }
-
-    public Service createService(String name) throws JAXRException {
-        return createService(this.createInternationalString(name));
-    }
-
-    public ServiceBinding createServiceBinding() throws JAXRException {
-        return (ServiceBinding) this.createObject(LifeCycleManager.SERVICE_BINDING);
-    }
-
-    public Slot createSlot(String name, String value, String slotType) throws JAXRException {
-        Collection<String> col = new ArrayList<String>();
-        col.add(value);
-        Slot slot = (Slot) this.createObject(LifeCycleManager.SLOT);
-        slot.setName(name);
-        slot.setValues(col);
-        slot.setSlotType(slotType);
-        return slot;
-    }
-
-    public Slot createSlot(String name, Collection<String> values, String slotType) throws JAXRException {
-        Slot slot = (Slot) this.createObject(LifeCycleManager.SLOT);
-        slot.setName(name);
-        slot.setValues(values);
-        slot.setSlotType(slotType);
-        return slot;
-    }
-
-    public SpecificationLink createSpecificationLink() throws JAXRException {
-        return (SpecificationLink) this.createObject(LifeCycleManager.SPECIFICATION_LINK);
-    }
-
-    public TelephoneNumber createTelephoneNumber() throws JAXRException {
-        return (TelephoneNumber) this.createObject(LifeCycleManager.TELEPHONE_NUMBER);
-    }
-
-    public User createUser() throws JAXRException {
-        return (User) this.createObject(LifeCycleManager.USER);
-    }
-
-    /**
-     * aves one or more Objects to the registry. An object may be a
-     * RegistryObject  subclass instance. If an object is not in the registry,
-     * it is created in the registry.  If it already exists in the registry
-     * and has been modified, then its  state is updated (replaced) in the
-     * registry
-     *
-     * @param objects
-     * @return a BulkResponse containing the Collection of keys for those objects
-     *         that were saved successfully and any SaveException that was encountered
-     *         in case of partial commit
-     * @throws JAXRException
-     */
-
-    public abstract BulkResponse saveObjects(Collection objects) throws JAXRException;
-
-    /**
-     * Deletes one or more previously submitted objects from the registry
-     * using the object keys and a specified objectType attribute.
-     *
-     * @param keys
-     * @param objectType
-     * @return
-     * @throws JAXRException
-     */
-    public abstract BulkResponse deleteObjects(Collection<Key> keys, String objectType) throws JAXRException;
-
-
-    /*************************************************************************
-     * Level 1 Features
-     ************************************************************************/
-
-    /**
-     * @param repositoryItem
-     * @return
-     * @throws JAXRException
-     */
-    public ExtrinsicObject createExtrinsicObject(DataHandler repositoryItem) throws JAXRException {
-        throw new UnsupportedCapabilityException();
-    }
-
-    public PersonName createPersonName(String firstName, String middleName, String lastName) throws JAXRException {
-        throw new UnsupportedCapabilityException();
-    }
-
-    public RegistryPackage createRegistryPackage(InternationalString name) throws JAXRException {
-        throw new UnsupportedCapabilityException();
-    }
-
-    public RegistryPackage createRegistryPackage(String name) throws JAXRException {
-        throw new UnsupportedCapabilityException();
-    }
-
-    public BulkResponse deprecateObjects(Collection<Key> keys) throws JAXRException {
-        throw new UnsupportedCapabilityException();
-    }
-
-    public BulkResponse unDeprecateObjects(Collection<Key> keys) throws JAXRException {
-        throw new UnsupportedCapabilityException();
-    }
-
-    public BulkResponse deleteObjects(Collection<Key> keys) throws JAXRException {
-        throw new UnsupportedCapabilityException();
-    }
-
-    Organization createOrganization(BusinessInfo bizInfo) throws JAXRException {
-        String key = bizInfo.getBusinessKey();
-        List<Name> names = bizInfo.getName(); 
-        
-        List<Description> descriptions = bizInfo.getDescription();
-        List<ServiceInfo> serviceInfos = bizInfo.getServiceInfos().getServiceInfo();
-        
-        OrganizationImpl org = new OrganizationImpl(this);
-        org.setKey(createKey(key));
-        if (names != null && names.size() > 0) {
-            org.setName(createInternationalString(names.get(0).getValue()));
-        }
-        if (descriptions != null && descriptions.size() > 0) {
-            org.setDescription(createInternationalString(descriptions.get(0).getValue()));
-        }
-        if (serviceInfos != null && serviceInfos.size() > 0) {
-            List<Service> services = new ArrayList<Service>(serviceInfos.size());
-            for (int i = 0; i < serviceInfos.size(); i++) {
-                ServiceInfo serviceInfo = serviceInfos.get(i);
-                services.add(createService(serviceInfo));
-            }
-            org.addServices(services);
-        }
-
-        return org;
-    }
-
-    Organization createOrganization(BusinessDetail bizDetail) throws JAXRException {
-        return ScoutUddiJaxrHelper.getOrganization(bizDetail, this);
-    }
-
-    Service createService(ServiceInfo serviceInfo) throws JAXRException {
-        String key = serviceInfo.getServiceKey();
-        List<Name> names = serviceInfo.getName();
-        ServiceImpl service = new ServiceImpl(this);
-        service.setKey(createKey(key));
-        if (names != null && names.size() > 0) {
-            service.setName(createInternationalString(names.get(0).getValue()));
-        }
-        return service;
-    }
-}
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout.registry;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Locale;
+
+import javax.activation.DataHandler;
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.InvalidRequestException;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.UnsupportedCapabilityException;
+import javax.xml.registry.infomodel.Association;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.ExternalIdentifier;
+import javax.xml.registry.infomodel.ExternalLink;
+import javax.xml.registry.infomodel.ExtrinsicObject;
+import javax.xml.registry.infomodel.InternationalString;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.LocalizedString;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PersonName;
+import javax.xml.registry.infomodel.PostalAddress;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.RegistryPackage;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.Slot;
+import javax.xml.registry.infomodel.SpecificationLink;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+
+import org.apache.ws.scout.model.uddi.v2.BusinessDetail;
+import org.apache.ws.scout.model.uddi.v2.BusinessInfo;
+import org.apache.ws.scout.model.uddi.v2.Description;
+import org.apache.ws.scout.model.uddi.v2.Name;
+import org.apache.ws.scout.model.uddi.v2.ServiceInfo;
+import org.apache.ws.scout.registry.infomodel.AssociationImpl;
+import org.apache.ws.scout.registry.infomodel.ClassificationImpl;
+import org.apache.ws.scout.registry.infomodel.ClassificationSchemeImpl;
+import org.apache.ws.scout.registry.infomodel.ConceptImpl;
+import org.apache.ws.scout.registry.infomodel.EmailAddressImpl;
+import org.apache.ws.scout.registry.infomodel.ExternalIdentifierImpl;
+import org.apache.ws.scout.registry.infomodel.ExternalLinkImpl;
+import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
+import org.apache.ws.scout.registry.infomodel.KeyImpl;
+import org.apache.ws.scout.registry.infomodel.LocalizedStringImpl;
+import org.apache.ws.scout.registry.infomodel.OrganizationImpl;
+import org.apache.ws.scout.registry.infomodel.PersonNameImpl;
+import org.apache.ws.scout.registry.infomodel.PostalAddressImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceBindingImpl;
+import org.apache.ws.scout.registry.infomodel.ServiceImpl;
+import org.apache.ws.scout.registry.infomodel.SlotImpl;
+import org.apache.ws.scout.registry.infomodel.SpecificationLinkImpl;
+import org.apache.ws.scout.registry.infomodel.TelephoneNumberImpl;
+import org.apache.ws.scout.registry.infomodel.UserImpl;
+import org.apache.ws.scout.util.ScoutUddiJaxrHelper;
+
+/**
+ * Implements JAXR LifeCycleManager Interface
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ */
+public abstract class LifeCycleManagerImpl implements LifeCycleManager {
+    protected final RegistryServiceImpl registry;
+
+    public LifeCycleManagerImpl(RegistryService registry) {
+        this.registry = (RegistryServiceImpl) registry;
+    }
+
+    public RegistryService getRegistryService() {
+        return registry;
+    }
+
+    public Object createObject(String interfaceName) throws JAXRException {
+        // we don't use reflection so that we can work in environments where
+        // we may not have permission to do so
+        if (LifeCycleManager.ASSOCIATION.equals(interfaceName)) {
+            return new AssociationImpl(this);
+        }
+        else if (LifeCycleManager.AUDITABLE_EVENT.equals(interfaceName)) {
+            throw new UnsupportedCapabilityException();
+        }
+        else if (LifeCycleManager.CLASSIFICATION.equals(interfaceName)) {
+            return new ClassificationImpl(this);
+        }
+        else if (LifeCycleManager.CLASSIFICATION_SCHEME.equals(interfaceName)) {
+            return new ClassificationSchemeImpl(this);
+        }
+        else if (LifeCycleManager.CONCEPT.equals(interfaceName)) {
+            return new ConceptImpl(this);
+        }
+        else if (LifeCycleManager.EMAIL_ADDRESS.equals(interfaceName)) {
+            return new EmailAddressImpl();
+        }
+        else if (LifeCycleManager.EXTERNAL_IDENTIFIER.equals(interfaceName)) {
+            return new ExternalIdentifierImpl(this);
+        }
+        else if (LifeCycleManager.EXTERNAL_LINK.equals(interfaceName)) {
+            return new ExternalLinkImpl(this);
+        }
+        else if (LifeCycleManager.EXTRINSIC_OBJECT.equals(interfaceName)) {
+            throw new UnsupportedCapabilityException();
+        }
+        else if (LifeCycleManager.INTERNATIONAL_STRING.equals(interfaceName)) {
+            return new InternationalStringImpl();
+        }
+        else if (LifeCycleManager.KEY.equals(interfaceName)) {
+            return new KeyImpl();
+        }
+        else if (LifeCycleManager.LOCALIZED_STRING.equals(interfaceName)) {
+            return new LocalizedStringImpl();
+        }
+        else if (LifeCycleManager.ORGANIZATION.equals(interfaceName)) {
+            return new OrganizationImpl(this);
+        }
+        else if (LifeCycleManager.PERSON_NAME.equals(interfaceName)) {
+            return new PersonNameImpl();
+        }
+        else if (LifeCycleManager.POSTAL_ADDRESS.equals(interfaceName)) {
+            return new PostalAddressImpl(registry.getDefaultPostalScheme());
+        }
+        else if (LifeCycleManager.REGISTRY_ENTRY.equals(interfaceName)) {
+            throw new UnsupportedCapabilityException();
+        }
+        else if (LifeCycleManager.REGISTRY_PACKAGE.equals(interfaceName)) {
+            throw new UnsupportedCapabilityException();
+        }
+        else if (LifeCycleManager.SERVICE.equals(interfaceName)) {
+            return new ServiceImpl(this);
+        }
+        else if (LifeCycleManager.SERVICE_BINDING.equals(interfaceName)) {
+            return new ServiceBindingImpl(this);
+        }
+        else if (LifeCycleManager.SLOT.equals(interfaceName)) {
+            return new SlotImpl();
+        }
+        else if (LifeCycleManager.SPECIFICATION_LINK.equals(interfaceName)) {
+            return new SpecificationLinkImpl(this);
+        }
+        else if (LifeCycleManager.TELEPHONE_NUMBER.equals(interfaceName)) {
+            return new TelephoneNumberImpl();
+        }
+        else if (LifeCycleManager.USER.equals(interfaceName)) {
+            return new UserImpl(this);
+        }
+        else if (LifeCycleManager.VERSIONABLE.equals(interfaceName)) {
+            throw new UnsupportedCapabilityException();
+        }
+        else {
+            throw new InvalidRequestException("Unknown interface: " + interfaceName);
+        }
+    }
+
+    public Association createAssociation(RegistryObject targetObject, Concept associationType) throws JAXRException {
+        Association assoc = (Association) this.createObject(LifeCycleManager.ASSOCIATION);
+        assoc.setTargetObject(targetObject);
+        assoc.setAssociationType(associationType);
+        return assoc;
+    }
+
+    public Classification createClassification(Concept concept) throws JAXRException, InvalidRequestException {
+        if (concept.getClassificationScheme() == null) {
+            throw new InvalidRequestException("Concept is not under classification scheme");
+        }
+        Classification classify = (Classification) this.createObject(LifeCycleManager.CLASSIFICATION);
+        classify.setConcept(concept);
+        return classify;
+    }
+
+    public Classification createClassification(ClassificationScheme scheme,
+                                               InternationalString name,
+                                               String value) throws JAXRException {
+        Classification cl = (Classification) this.createObject(LifeCycleManager.CLASSIFICATION);
+        cl.setClassificationScheme(scheme);
+        cl.setName(name);
+        cl.setValue(value);
+
+        ((ClassificationImpl) cl).setExternal(true);
+
+        return cl;
+    }
+
+    public Classification createClassification(ClassificationScheme scheme,
+                                               String name, String value)
+            throws JAXRException {
+        return createClassification(scheme, this.createInternationalString(name), value);
+    }
+
+    public ClassificationScheme createClassificationScheme(Concept concept) throws JAXRException, InvalidRequestException {
+        //Check if the passed concept has a classificationscheme or has a parent concept
+        if (concept.getParentConcept() != null || concept.getClassificationScheme() != null) {
+            throw new InvalidRequestException("Concept has classificationscheme or has a parent");
+        }
+
+
+        ClassificationScheme cs = new ClassificationSchemeImpl(this);
+        cs.addChildConcept(concept);
+        return cs;
+    }
+
+    public ClassificationScheme createClassificationScheme(InternationalString name,
+                                                           InternationalString des)
+            throws JAXRException, InvalidRequestException {
+        ClassificationScheme cs = new ClassificationSchemeImpl(this);
+        cs.setName(name);
+        cs.setDescription(des);
+        return cs;
+    }
+
+    public ClassificationScheme createClassificationScheme(String name, String desc)
+            throws JAXRException, InvalidRequestException {
+        return createClassificationScheme(this.createInternationalString(name),
+                this.createInternationalString(desc));
+    }
+
+    public Concept createConcept(RegistryObject parent, InternationalString name, String value)
+            throws JAXRException {
+        ConceptImpl concept = new ConceptImpl(this);
+        concept.setClassificationScheme((ClassificationScheme) parent);
+        concept.setParent(parent);
+        concept.setName(name);
+        concept.setValue(value);
+        return concept;
+    }
+
+    public Concept createConcept(RegistryObject parent, String name, String value) throws JAXRException {
+        return createConcept(parent, this.createInternationalString(name), value);
+    }
+
+    public EmailAddress createEmailAddress(String address) throws JAXRException {
+        return new EmailAddressImpl(address);
+    }
+
+    public EmailAddress createEmailAddress(String address, String type) throws JAXRException {
+        return new EmailAddressImpl(address, type);
+    }
+
+    public ExternalIdentifier createExternalIdentifier(ClassificationScheme ids,
+                                                       InternationalString name,
+                                                       String value) throws JAXRException {
+        return new ExternalIdentifierImpl(this, ids, name, value);
+    }
+
+    public ExternalIdentifier createExternalIdentifier(ClassificationScheme ids,
+                                                       String name, String value) throws JAXRException {
+        return createExternalIdentifier(ids, this.createInternationalString(name), value);
+    }
+
+    public ExternalLink createExternalLink(String uri, InternationalString desc) throws JAXRException {
+        ExternalLink ext = new ExternalLinkImpl(this);
+        ext.setExternalURI(uri);
+        ext.setDescription(desc);
+        return ext;
+    }
+
+    public ExternalLink createExternalLink(String uri, String desc) throws JAXRException {
+        return createExternalLink(uri, createInternationalString(desc));
+    }
+
+    public InternationalString createInternationalString() throws JAXRException {
+        return new InternationalStringImpl();
+    }
+
+    public InternationalString createInternationalString(String value) throws JAXRException {
+        return new InternationalStringImpl(Locale.getDefault(), value, LocalizedString.DEFAULT_CHARSET_NAME);
+    }
+
+    public InternationalString createInternationalString(Locale locale, String value) throws JAXRException {
+        return new InternationalStringImpl(locale, value, LocalizedString.DEFAULT_CHARSET_NAME);
+    }
+
+    public Key createKey(String id) {
+        return new KeyImpl(id);
+    }
+
+    public LocalizedString createLocalizedString(Locale locale, String value) throws JAXRException {
+        return new LocalizedStringImpl(locale, value, LocalizedString.DEFAULT_CHARSET_NAME);
+    }
+
+    public LocalizedString createLocalizedString(Locale locale, String value, String charsetName) throws JAXRException {
+        return new LocalizedStringImpl(locale, value, charsetName);
+    }
+
+    public Organization createOrganization(InternationalString name) throws JAXRException {
+        Organization org = (Organization) this.createObject(LifeCycleManager.ORGANIZATION);
+        org.setName(name);
+        return org;
+    }
+
+    public Organization createOrganization(String name) throws JAXRException {
+        Organization org = (Organization) this.createObject(LifeCycleManager.ORGANIZATION);
+        org.setName(this.createInternationalString(name));
+        return org;
+    }
+
+    public PersonName createPersonName(String fullName) throws JAXRException {
+        PersonName pn = (PersonName) this.createObject(LifeCycleManager.PERSON_NAME);
+        pn.setFullName(fullName);
+        return pn;
+    }
+
+    public PostalAddress createPostalAddress(String streetNumber,
+                                             String street,
+                                             String city,
+                                             String stateOrProvince,
+                                             String country,
+                                             String postalCode, String type) throws JAXRException {
+        PostalAddress post = new PostalAddressImpl();
+        post.setStreetNumber(streetNumber);
+        post.setStreet(street);
+        post.setCity(city);
+        post.setStateOrProvince(stateOrProvince);
+        post.setCountry(country);
+        post.setPostalCode(postalCode);
+        post.setType(type);
+        return post;
+    }
+
+    public Service createService(InternationalString name) throws JAXRException {
+        Service ser = (Service) this.createObject(LifeCycleManager.SERVICE);
+        ser.setName(name);
+        return ser;
+    }
+
+    public Service createService(String name) throws JAXRException {
+        return createService(this.createInternationalString(name));
+    }
+
+    public ServiceBinding createServiceBinding() throws JAXRException {
+        return (ServiceBinding) this.createObject(LifeCycleManager.SERVICE_BINDING);
+    }
+
+    public Slot createSlot(String name, String value, String slotType) throws JAXRException {
+        Collection<String> col = new ArrayList<String>();
+        col.add(value);
+        Slot slot = (Slot) this.createObject(LifeCycleManager.SLOT);
+        slot.setName(name);
+        slot.setValues(col);
+        slot.setSlotType(slotType);
+        return slot;
+    }
+
+    public Slot createSlot(String name, Collection values, String slotType) throws JAXRException {
+        Slot slot = (Slot) this.createObject(LifeCycleManager.SLOT);
+        slot.setName(name);
+        slot.setValues(values);
+        slot.setSlotType(slotType);
+        return slot;
+    }
+
+    public SpecificationLink createSpecificationLink() throws JAXRException {
+        return (SpecificationLink) this.createObject(LifeCycleManager.SPECIFICATION_LINK);
+    }
+
+    public TelephoneNumber createTelephoneNumber() throws JAXRException {
+        return (TelephoneNumber) this.createObject(LifeCycleManager.TELEPHONE_NUMBER);
+    }
+
+    public User createUser() throws JAXRException {
+        return (User) this.createObject(LifeCycleManager.USER);
+    }
+
+    /**
+     * aves one or more Objects to the registry. An object may be a
+     * RegistryObject  subclass instance. If an object is not in the registry,
+     * it is created in the registry.  If it already exists in the registry
+     * and has been modified, then its  state is updated (replaced) in the
+     * registry
+     *
+     * @param objects
+     * @return a BulkResponse containing the Collection of keys for those objects
+     *         that were saved successfully and any SaveException that was encountered
+     *         in case of partial commit
+     * @throws JAXRException
+     */
+
+    public abstract BulkResponse saveObjects(Collection objects) throws JAXRException;
+
+    /**
+     * Deletes one or more previously submitted objects from the registry
+     * using the object keys and a specified objectType attribute.
+     *
+     * @param keys
+     * @param objectType
+     * @return
+     * @throws JAXRException
+     */
+    public abstract BulkResponse deleteObjects(Collection keys, String objectType) throws JAXRException;
+
+
+    /*************************************************************************
+     * Level 1 Features
+     ************************************************************************/
+
+    /**
+     * @param repositoryItem
+     * @return
+     * @throws JAXRException
+     */
+    public ExtrinsicObject createExtrinsicObject(DataHandler repositoryItem) throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public PersonName createPersonName(String firstName, String middleName, String lastName) throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public RegistryPackage createRegistryPackage(InternationalString name) throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public RegistryPackage createRegistryPackage(String name) throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public BulkResponse deprecateObjects(Collection keys) throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public BulkResponse unDeprecateObjects(Collection keys) throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
+    public BulkResponse deleteObjects(Collection keys) throws JAXRException {
+        throw new UnsupportedCapabilityException();
+    }
+
+    Organization createOrganization(BusinessInfo bizInfo) throws JAXRException {
+        String key = bizInfo.getBusinessKey();
+        List<Name> names = bizInfo.getName(); 
+        
+        List<Description> descriptions = bizInfo.getDescription();
+        List<ServiceInfo> serviceInfos = bizInfo.getServiceInfos().getServiceInfo();
+        
+        OrganizationImpl org = new OrganizationImpl(this);
+        org.setKey(createKey(key));
+        if (names != null && names.size() > 0) {
+            org.setName(createInternationalString(names.get(0).getValue()));
+        }
+        if (descriptions != null && descriptions.size() > 0) {
+            org.setDescription(createInternationalString(descriptions.get(0).getValue()));
+        }
+        if (serviceInfos != null && serviceInfos.size() > 0) {
+            List<Service> services = new ArrayList<Service>(serviceInfos.size());
+            for (int i = 0; i < serviceInfos.size(); i++) {
+                ServiceInfo serviceInfo = serviceInfos.get(i);
+                services.add(createService(serviceInfo));
+            }
+            org.addServices(services);
+        }
+
+        return org;
+    }
+
+    Organization createOrganization(BusinessDetail bizDetail) throws JAXRException {
+        return ScoutUddiJaxrHelper.getOrganization(bizDetail, this);
+    }
+
+    Service createService(ServiceInfo serviceInfo) throws JAXRException {
+        String key = serviceInfo.getServiceKey();
+        List<Name> names = serviceInfo.getName();
+        ServiceImpl service = new ServiceImpl(this);
+        service.setKey(createKey(key));
+        if (names != null && names.size() > 0) {
+            service.setName(createInternationalString(names.get(0).getValue()));
+        }
+        return service;
+    }
+}

Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java (original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ClassificationSchemeImpl.java Fri Jul 24 02:45:33 2009
@@ -58,7 +58,7 @@
         childConcepts.add(concept);
     }
 
-    public void addChildConcepts(Collection<Concept> collection)
+    public void addChildConcepts(Collection collection)
             throws JAXRException
     {
         childConcepts.addAll(collection);

Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ConceptImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ConceptImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ConceptImpl.java (original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ConceptImpl.java Fri Jul 24 02:45:33 2009
@@ -1,175 +1,172 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ws.scout.registry.infomodel;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.LifeCycleManager;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.Concept;
-import javax.xml.registry.infomodel.RegistryObject;
-
-/**
- * Implements JAXR Interface.
- * For futher details, look into the JAXR API Javadoc.
- *
- * @author Anil Saldhana  <anil@apache.org>
- */
-public class ConceptImpl extends RegistryObjectImpl implements Concept
-{
-    private String value = new String();
-
-    private RegistryObject parent = null;
-    private Concept parentconcept = null;
-
-    private ClassificationScheme scheme = null;
-    private Collection<Concept> childconcepts = new ArrayList<Concept>();
-
-    /**
-     * Creates a new instance of ConceptImpl
-     */
-    public ConceptImpl(LifeCycleManager lifeCycleManager)
-    {
-        super(lifeCycleManager);
-    }
-
-    public void addChildConcept(Concept concept)
-    {
-        this.childconcepts.add(concept);
-        ((ConceptImpl)concept).setParentconcept(this);
-    }
-
-    public void addChildConcepts(Collection<Concept> collection)
-    {
-        Iterator iter = collection.iterator();
-        while(iter.hasNext())
-        {
-            Concept c = (Concept)iter.next();
-            ((ConceptImpl)c).setParentconcept(this);
-            childconcepts.add(c);
-        }
-
-    }
-
-    public int getChildConceptCount()
-    {
-        return this.childconcepts.size();
-    }
-
-    public Collection<Concept> getChildrenConcepts()
-    {
-        return this.childconcepts;
-    }
-
-    public ClassificationScheme getClassificationScheme()
-    {
-        return scheme;
-    }
-
-    public Collection<Concept> getDescendantConcepts()
-    {
-        Collection<Concept> coll = new ArrayList<Concept>();
-        Iterator iter = childconcepts.iterator();
-        while(iter != null && iter.hasNext())
-        {
-            ConceptImpl c = (ConceptImpl)iter.next();
-            coll.add(c);
-            coll.addAll(c.getDescendantConcepts());
-        }
-        return coll;
-    }
-
-    public RegistryObject getParent()
-    {
-        return parent;
-    }
-
-    public Concept getParentConcept()
-    {
-        return parentconcept;
-    }
-
-    public String getPath()
-    {
-        return null;
-    }
-
-    public String getValue() throws JAXRException
-    {
-        return value;
-    }
-
-    public void removeChildConcept(Concept c)
-    {
-        ((ConceptImpl)c).setParentconcept(null);
-        childconcepts.remove(c);
-    }
-
-    public void removeChildConcepts(Collection collection)
-    {
-        Iterator iter = collection.iterator();
-        while(iter.hasNext())
-        {
-            Concept c = (Concept)iter.next();
-            ((ConceptImpl)c).setParentconcept(null);
-            childconcepts.add(c);
-        }
-    }
-
-    public void setValue(String str)
-    {
-        value = str;
-    }
-
-    public void setParent(RegistryObject parent)
-    {
-        this.parent = parent;
-    }
-
-    public void setParentconcept(Concept parentconcept)
-    {
-        this.parentconcept = parentconcept;
-        parent = null; //We deal with concept as parent
-    }
-
-    public void setScheme(ClassificationSchemeImpl scheme)
-    {
-        this.scheme = scheme;
-    }
-
-    public void setChildconcepts(Collection<Concept> childconcepts)
-    {
-        this.childconcepts.clear();
-        Iterator iter = childconcepts.iterator();
-        while(iter.hasNext())
-        {
-            Concept c = (Concept)iter.next();
-            ((ConceptImpl)c).setParentconcept(this);
-            childconcepts.add(c);
-        }
-    }
-
-    //Specific API
-    public void setClassificationScheme(ClassificationScheme sc)
-    {
-        scheme = sc;
-        parent = sc;
-    }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.scout.registry.infomodel;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.RegistryObject;
+
+/**
+ * Implements JAXR Interface.
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author Anil Saldhana  <anil@apache.org>
+ */
+public class ConceptImpl extends RegistryObjectImpl implements Concept
+{
+    private String value = new String();
+
+    private RegistryObject parent = null;
+    private Concept parentconcept = null;
+
+    private ClassificationScheme scheme = null;
+    private Collection<Concept> childconcepts = new ArrayList<Concept>();
+
+    /**
+     * Creates a new instance of ConceptImpl
+     */
+    public ConceptImpl(LifeCycleManager lifeCycleManager)
+    {
+        super(lifeCycleManager);
+    }
+
+    public void addChildConcept(Concept concept)
+    {
+        this.childconcepts.add(concept);
+        ((ConceptImpl)concept).setParentconcept(this);
+    }
+
+    public void addChildConcepts(Collection collection)
+    {
+        for (Object c : collection) {
+            ((ConceptImpl) c).setParentconcept(this);
+            childconcepts.add((Concept) c);
+        }
+
+    }
+
+    public int getChildConceptCount()
+    {
+        return this.childconcepts.size();                                                                                                           
+    }
+
+    public Collection<Concept> getChildrenConcepts()
+    {
+        return this.childconcepts;
+    }
+
+    public ClassificationScheme getClassificationScheme()
+    {
+        return scheme;
+    }
+
+    public Collection<Concept> getDescendantConcepts()
+    {
+        Collection<Concept> coll = new ArrayList<Concept>();
+        Iterator iter = childconcepts.iterator();
+        while(iter != null && iter.hasNext())
+        {
+            ConceptImpl c = (ConceptImpl)iter.next();
+            coll.add(c);
+            coll.addAll(c.getDescendantConcepts());
+        }
+        return coll;
+    }
+
+    public RegistryObject getParent()
+    {
+        return parent;
+    }
+
+    public Concept getParentConcept()
+    {
+        return parentconcept;
+    }
+
+    public String getPath()
+    {
+        return null;
+    }
+
+    public String getValue() throws JAXRException
+    {
+        return value;
+    }
+
+    public void removeChildConcept(Concept c)
+    {
+        ((ConceptImpl)c).setParentconcept(null);
+        childconcepts.remove(c);
+    }
+
+    public void removeChildConcepts(Collection collection)
+    {
+        Iterator iter = collection.iterator();
+        while(iter.hasNext())
+        {
+            Concept c = (Concept)iter.next();
+            ((ConceptImpl)c).setParentconcept(null);
+            childconcepts.add(c);
+        }
+    }
+
+    public void setValue(String str)
+    {
+        value = str;
+    }
+
+    public void setParent(RegistryObject parent)
+    {
+        this.parent = parent;
+    }
+
+    public void setParentconcept(Concept parentconcept)
+    {
+        this.parentconcept = parentconcept;
+        parent = null; //We deal with concept as parent
+    }
+
+    public void setScheme(ClassificationSchemeImpl scheme)
+    {
+        this.scheme = scheme;
+    }
+
+    public void setChildconcepts(Collection<Concept> childconcepts)
+    {
+        this.childconcepts.clear();
+        Iterator iter = childconcepts.iterator();
+        while(iter.hasNext())
+        {
+            Concept c = (Concept)iter.next();
+            ((ConceptImpl)c).setParentconcept(this);
+            childconcepts.add(c);
+        }
+    }
+
+    //Specific API
+    public void setClassificationScheme(ClassificationScheme sc)
+    {
+        scheme = sc;
+        parent = sc;
+    }
+}

Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ExtensibleObjectImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ExtensibleObjectImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ExtensibleObjectImpl.java (original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/ExtensibleObjectImpl.java Fri Jul 24 02:45:33 2009
@@ -1,69 +1,68 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ws.scout.registry.infomodel;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.infomodel.ExtensibleObject;
-import javax.xml.registry.infomodel.Slot;
-
-/**
- * Implements JAXR Interface.
- * For futher details, look into the JAXR API Javadoc.
- *
- * @author Anil Saldhana  <anil@apache.org>
- */
-public class ExtensibleObjectImpl implements ExtensibleObject
-{
-    private Map<String,Slot> slots = new HashMap<String,Slot>();
-
-    public void addSlot(Slot slot) throws JAXRException
-    {
-        slots.put(slot.getName(), slot);
-    }
-
-    public void addSlots(Collection slots) throws JAXRException
-    {
-        for (Iterator i = slots.iterator(); i.hasNext();)
-        {
-            addSlot((Slot) i.next());
-        }
-    }
-
-    public Slot getSlot(String slotName)
-    {
-        return (Slot) slots.get(slotName);
-    }
-
-    public Collection<Slot> getSlots()
-    {
-        return slots.values();
-    }
-
-    public void removeSlot(String slotName)
-    {
-        slots.remove(slotName);
-    }
-
-    public void removeSlots(Collection<String> slotNames)
-    {
-        slots.keySet().removeAll(slotNames);
-    }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ws.scout.registry.infomodel;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.infomodel.ExtensibleObject;
+import javax.xml.registry.infomodel.Slot;
+
+/**
+ * Implements JAXR Interface.
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author Anil Saldhana  <anil@apache.org>
+ */
+public class ExtensibleObjectImpl implements ExtensibleObject
+{
+    private Map<String,Slot> slots = new HashMap<String,Slot>();
+
+    public void addSlot(Slot slot) throws JAXRException
+    {
+        slots.put(slot.getName(), slot);
+    }
+
+    public void addSlots(Collection slots) throws JAXRException
+    {
+        for (Object slot : slots) {
+            addSlot((Slot) slot);
+        }
+    }
+
+    public Slot getSlot(String slotName)
+    {
+        return (Slot) slots.get(slotName);
+    }
+
+    public Collection<Slot> getSlots()
+    {
+        return slots.values();
+    }
+
+    public void removeSlot(String slotName)
+    {
+        slots.remove(slotName);
+    }
+
+    public void removeSlots(Collection slotNames)
+    {
+        slots.keySet().removeAll(slotNames);
+    }
+}

Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java?rev=797311&r1=797310&r2=797311&view=diff
==============================================================================
--- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java (original)
+++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/infomodel/OrganizationImpl.java Fri Jul 24 02:45:33 2009
@@ -1,283 +1,281 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ws.scout.registry.infomodel;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.xml.registry.JAXRException;
-import javax.xml.registry.LifeCycleManager;
-import javax.xml.registry.UnsupportedCapabilityException;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.PostalAddress;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.TelephoneNumber;
-import javax.xml.registry.infomodel.User;
-
-/**
- * Organization Interface
- * * Implements JAXR Interface.
- * For futher details, look into the JAXR API Javadoc.
- *
- * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
- * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
- */
-public class OrganizationImpl extends RegistryObjectImpl implements Organization
-{
-    private User primaryContact;
-    private Set<User> users = new HashSet<User>();
-    private Set<TelephoneNumber> telephoneNumbers = new HashSet<TelephoneNumber>();
-    private Collection<Service> services = new ArrayList<Service>();
-
-    public OrganizationImpl(LifeCycleManager lifeCycleManager)
-    {
-        super(lifeCycleManager);
-    }
-
-    public User getPrimaryContact() throws JAXRException
-    {
-        //TODO: How do we fix this? Run JAXRQueryTest and you will hit this problem.
-        //
-        //  gmj : I think I fixed w/ primary contact hack...
-        //
-        //if (primaryContact == null) {
-        //    throw new IllegalStateException("primaryContact is null and the spec says we cannot return a null value");
-        //}
-        return primaryContact;
-    }
-
-    public void setPrimaryContact(User user) throws JAXRException
-    {
-        if (user == null)
-        {
-            throw new IllegalArgumentException("primaryContact must not be null");
-        }
-
-        /*
-         * first check to see if user already exists in user set
-         */
-
-        primaryContact = user;
-
-        if (!users.contains(user)) {
-            addUser(user);
-        }
-    }
-
-    public void addUser(User user) throws JAXRException
-    {
-        doPrimaryContactHack(user);
-
-        users.add(user);
-        ((UserImpl) user).setOrganization(this);
-    }
-
-    /**
-     *
-     *  to solve the getPrimaryContactProblem(), if we have no defined
-     *  primaryContact, we'll designate the first user as such
-     *
-     * @param user
-     */
-    private void doPrimaryContactHack(User user) {
-
-        if (primaryContact == null && users.size() == 0) {
-            primaryContact = user;
-        }
-    }
-
-    public void addUsers(Collection collection) throws JAXRException
-    {
-        // do this by hand to ensure all members are actually instances of User
-        for (Iterator iterator = collection.iterator(); iterator.hasNext();)
-        {
-            User user = (User) iterator.next();
-            addUser(user);
-        }
-    }
-
-    public Collection<User> getUsers() throws JAXRException
-    {
-        return users;
-    }
-
-    public void removeUser(User user) throws JAXRException
-    {
-        if (user != null) {
-            users.remove(user);
-        }
-
-        /*
-         * more primaryContact hakiness - nothing says that you can't
-         * remove the user that is the PC...
-         */
-
-        if (!users.contains(primaryContact)) {
-            primaryContact = null;
-        }
-    }
-
-    public void removeUsers(Collection collection) throws JAXRException
-    {
-        if (collection != null) {
-            users.removeAll(collection);
-        }
-
-        /*
-         * more primaryContact hakiness - nothing says that you can't
-         * remove the user that is the PC...
-         */
-
-        if (!users.contains(primaryContact)) {
-            primaryContact = null;
-        }
-
-    }
-
-    public Collection<TelephoneNumber> getTelephoneNumbers(String phoneType) throws JAXRException
-    {
-        Set<TelephoneNumber> filteredNumbers;
-        if (phoneType == null)
-        {
-            filteredNumbers = telephoneNumbers;
-        } else
-        {
-            filteredNumbers = new HashSet<TelephoneNumber>(telephoneNumbers.size());
-            for (Iterator i = telephoneNumbers.iterator(); i.hasNext();)
-            {
-                TelephoneNumber number = (TelephoneNumber) i.next();
-                if (phoneType.equals(number.getType()))
-                {
-                    filteredNumbers.add(number);
-                }
-            }
-        }
-        return filteredNumbers;
-    }
-
-    public void setTelephoneNumbers(Collection<TelephoneNumber> collection) throws JAXRException
-    {
-        // do this by hand to ensure all members are actually instances of TelephoneNumber
-        Set<TelephoneNumber> numbers = new HashSet<TelephoneNumber>(collection.size());
-        for (Iterator i = collection.iterator(); i.hasNext();)
-        {
-            TelephoneNumber number = (TelephoneNumber) i.next();
-            numbers.add(number);
-        }
-        this.telephoneNumbers = numbers;
-    }
-
-    public void addService(Service service) throws JAXRException
-    {
-        services.add(service);
-
-        /*
-         * we need to tell the service who it's organization is so
-         * we can set the UDDI Business Key...
-         */
-
-        service.setProvidingOrganization(this);
-    }
-
-    public void addServices(Collection collection) throws JAXRException
-    {
-        // do this by hand to ensure all members are actually instances of Service
-        for (Iterator iterator = collection.iterator(); iterator.hasNext();)
-        {
-            Service service = (Service) iterator.next();
-
-            addService(service);
-        }
-    }
-
-    public Collection<Service> getServices() throws JAXRException
-    {
-        return services;
-    }
-
-    public void removeService(Service service) throws JAXRException
-    {
-    	services.remove(service);
-    }
-
-    public void removeServices(Collection collection) throws JAXRException
-    {
-        services.removeAll(collection);
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    // Level 1 features must throw exceptions
-    ///////////////////////////////////////////////////////////////////////////
-
-    public Organization getParentOrganization() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public Collection<Organization> getDescendantOrganizations() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public Organization getRootOrganization() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public void addChildOrganization(Organization organization) throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public void addChildOrganizations(Collection collection) throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public int getChildOrganizationCount() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public Collection<Organization> getChildOrganizations() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public void removeChildOrganization(Organization organization) throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public void removeChildOrganizations(Collection collection) throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public PostalAddress getPostalAddress() throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-
-    public void setPostalAddress(PostalAddress postalAddress) throws JAXRException
-    {
-        throw new UnsupportedCapabilityException("Level 1 feature");
-    }
-}
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.scout.registry.infomodel;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.LifeCycleManager;
+import javax.xml.registry.UnsupportedCapabilityException;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PostalAddress;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+
+/**
+ * Organization Interface
+ * * Implements JAXR Interface.
+ * For futher details, look into the JAXR API Javadoc.
+ *
+ * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
+ */
+public class OrganizationImpl extends RegistryObjectImpl implements Organization
+{
+    private User primaryContact;
+    private Set<User> users = new HashSet<User>();
+    private Set<TelephoneNumber> telephoneNumbers = new HashSet<TelephoneNumber>();
+    private Collection<Service> services = new ArrayList<Service>();
+
+    public OrganizationImpl(LifeCycleManager lifeCycleManager)
+    {
+        super(lifeCycleManager);
+    }
+
+    public User getPrimaryContact() throws JAXRException
+    {
+        //TODO: How do we fix this? Run JAXRQueryTest and you will hit this problem.
+        //
+        //  gmj : I think I fixed w/ primary contact hack...
+        //
+        //if (primaryContact == null) {
+        //    throw new IllegalStateException("primaryContact is null and the spec says we cannot return a null value");
+        //}
+        return primaryContact;
+    }
+
+    public void setPrimaryContact(User user) throws JAXRException
+    {
+        if (user == null)
+        {
+            throw new IllegalArgumentException("primaryContact must not be null");
+        }
+
+        /*
+         * first check to see if user already exists in user set
+         */
+
+        primaryContact = user;
+
+        if (!users.contains(user)) {
+            addUser(user);
+        }
+    }
+
+    public void addUser(User user) throws JAXRException
+    {
+        doPrimaryContactHack(user);
+
+        users.add(user);
+        ((UserImpl) user).setOrganization(this);
+    }
+
+    /**
+     *
+     *  to solve the getPrimaryContactProblem(), if we have no defined
+     *  primaryContact, we'll designate the first user as such
+     *
+     * @param user
+     */
+    private void doPrimaryContactHack(User user) {
+
+        if (primaryContact == null && users.size() == 0) {
+            primaryContact = user;
+        }
+    }
+
+    public void addUsers(Collection collection) throws JAXRException
+    {
+        // do this by hand to ensure all members are actually instances of User
+        for (Iterator iterator = collection.iterator(); iterator.hasNext();)
+        {
+            User user = (User) iterator.next();
+            addUser(user);
+        }
+    }
+
+    public Collection<User> getUsers() throws JAXRException
+    {
+        return users;
+    }
+
+    public void removeUser(User user) throws JAXRException
+    {
+        if (user != null) {
+            users.remove(user);
+        }
+
+        /*
+         * more primaryContact hakiness - nothing says that you can't
+         * remove the user that is the PC...
+         */
+
+        if (!users.contains(primaryContact)) {
+            primaryContact = null;
+        }
+    }
+
+    public void removeUsers(Collection collection) throws JAXRException
+    {
+        if (collection != null) {
+            users.removeAll(collection);
+        }
+
+        /*
+         * more primaryContact hakiness - nothing says that you can't
+         * remove the user that is the PC...
+         */
+
+        if (!users.contains(primaryContact)) {
+            primaryContact = null;
+        }
+
+    }
+
+    public Collection<TelephoneNumber> getTelephoneNumbers(String phoneType) throws JAXRException
+    {
+        Set<TelephoneNumber> filteredNumbers;
+        if (phoneType == null)
+        {
+            filteredNumbers = telephoneNumbers;
+        } else
+        {
+            filteredNumbers = new HashSet<TelephoneNumber>(telephoneNumbers.size());
+            for (Iterator i = telephoneNumbers.iterator(); i.hasNext();)
+            {
+                TelephoneNumber number = (TelephoneNumber) i.next();
+                if (phoneType.equals(number.getType()))
+                {
+                    filteredNumbers.add(number);
+                }
+            }
+        }
+        return filteredNumbers;
+    }
+
+    public void setTelephoneNumbers(Collection collection) throws JAXRException
+    {
+        // do this by hand to ensure all members are actually instances of TelephoneNumber
+        Set<TelephoneNumber> numbers = new HashSet<TelephoneNumber>(collection.size());
+        for (Object number : collection) {
+            numbers.add((TelephoneNumber) number);
+        }
+        this.telephoneNumbers = numbers;
+    }
+
+    public void addService(Service service) throws JAXRException
+    {
+        services.add(service);
+
+        /*
+         * we need to tell the service who it's organization is so
+         * we can set the UDDI Business Key...
+         */
+
+        service.setProvidingOrganization(this);
+    }
+
+    public void addServices(Collection collection) throws JAXRException
+    {
+        // do this by hand to ensure all members are actually instances of Service
+        for (Iterator iterator = collection.iterator(); iterator.hasNext();)
+        {
+            Service service = (Service) iterator.next();
+
+            addService(service);
+        }
+    }
+
+    public Collection<Service> getServices() throws JAXRException
+    {
+        return services;
+    }
+
+    public void removeService(Service service) throws JAXRException
+    {
+    	services.remove(service);
+    }
+
+    public void removeServices(Collection collection) throws JAXRException
+    {
+        services.removeAll(collection);
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Level 1 features must throw exceptions
+    ///////////////////////////////////////////////////////////////////////////
+
+    public Organization getParentOrganization() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public Collection<Organization> getDescendantOrganizations() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public Organization getRootOrganization() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void addChildOrganization(Organization organization) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void addChildOrganizations(Collection collection) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public int getChildOrganizationCount() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public Collection<Organization> getChildOrganizations() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void removeChildOrganization(Organization organization) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void removeChildOrganizations(Collection collection) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public PostalAddress getPostalAddress() throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+
+    public void setPostalAddress(PostalAddress postalAddress) throws JAXRException
+    {
+        throw new UnsupportedCapabilityException("Level 1 feature");
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: scout-dev-help@ws.apache.org


Mime
View raw message