You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2008/11/03 23:31:19 UTC
svn commit: r710195 - in /webservices/juddi/branches/v3_trunk/juddi-core/src:
main/java/org/apache/juddi/api/datatype/
main/java/org/apache/juddi/api/impl/ main/java/org/apache/juddi/mapping/
main/java/org/apache/juddi/model/ main/java/org/apache/juddi...
Author: jfaath
Date: Mon Nov 3 14:31:18 2008
New Revision: 710195
URL: http://svn.apache.org/viewvc?rev=710195&view=rev
Log:
JUDDI-152: Adding the proprietary publisher API layer. Publishers can now be saved or deleted via the Publish API and retrieved via the Inquiry API.
Added:
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/DeletePublisher.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/GetPublisherDetail.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/ObjectFactory.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/Publisher.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/PublisherDetail.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/SavePublisher.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/PublisherTest.java (with props)
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/publisher1.xml (with props)
Modified:
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/Publisher.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java
webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java
webservices/juddi/branches/v3_trunk/juddi-core/src/test/resources/suite-one.xml
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/DeletePublisher.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/DeletePublisher.java?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/DeletePublisher.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/DeletePublisher.java Mon Nov 3 14:31:18 2008
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2001-2008 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.juddi.api.datatype;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for delete_publisher type. Specific to juddi.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "delete_publisher", propOrder = {
+ "authInfo",
+ "publisherId"
+})
+public class DeletePublisher {
+
+ protected String authInfo;
+ @XmlElement(required = true)
+ protected List<String> publisherId;
+
+ /**
+ * Gets the value of the authInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAuthInfo() {
+ return authInfo;
+ }
+
+ /**
+ * Sets the value of the authInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAuthInfo(String value) {
+ this.authInfo = value;
+ }
+
+ /**
+ * Gets the value of the publisherId property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the businessKey property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPublisherId().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getPublisherId() {
+ if (publisherId == null) {
+ publisherId = new ArrayList<String>();
+ }
+ return this.publisherId;
+ }
+
+}
+
\ No newline at end of file
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/DeletePublisher.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/GetPublisherDetail.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/GetPublisherDetail.java?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/GetPublisherDetail.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/GetPublisherDetail.java Mon Nov 3 14:31:18 2008
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2001-2008 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.juddi.api.datatype;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for get_publisherDetail type. Specific to juddi.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "get_publisherDetail", propOrder = {
+ "authInfo",
+ "publisherId"
+})
+public class GetPublisherDetail {
+
+ protected String authInfo;
+ @XmlElement(required = true)
+ protected List<String> publisherId;
+
+ /**
+ * Gets the value of the authInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAuthInfo() {
+ return authInfo;
+ }
+
+ /**
+ * Sets the value of the authInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAuthInfo(String value) {
+ this.authInfo = value;
+ }
+
+ /**
+ * Gets the value of the publisherId property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the businessKey property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPublisherId().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getPublisherId() {
+ if (publisherId == null) {
+ publisherId = new ArrayList<String>();
+ }
+ return this.publisherId;
+ }
+
+}
+
\ No newline at end of file
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/GetPublisherDetail.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/ObjectFactory.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/ObjectFactory.java?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/ObjectFactory.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/ObjectFactory.java Mon Nov 3 14:31:18 2008
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2001-2008 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.juddi.api.datatype;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ * This object was copied from the UDDI generated package and hand-edited to fit the juddi specific Publisher structures.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _SavePublisher_QNAME = new QName("urn:apache-org:juddi_v3", "save_publisher");
+ private final static QName _DeletePublisher_QNAME = new QName("urn:apache-org:juddi_v3", "delete_publisher");
+ private final static QName _Publisher_QNAME = new QName("urn:apache-org:juddi_v3", "publisher");
+ private final static QName _PublisherDetail_QNAME = new QName("urn:apache-org:juddi_v3", "publisherDetail");
+ private final static QName _GetPublisherDetail_QNAME = new QName("urn:apache-org:juddi_v3", "get_publisherDetail");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.uddi.api_v3
+ *
+ */
+ public ObjectFactory() {
+ }
+
+
+ /**
+ * Create an instance of {@link SavePublisher }
+ *
+ */
+ public SavePublisher createSavePublisher() {
+ return new SavePublisher();
+ }
+
+ /**
+ * Create an instance of {@link DeletePublisher }
+ *
+ */
+ public DeletePublisher createDeletePublisher() {
+ return new DeletePublisher();
+ }
+
+ /**
+ * Create an instance of {@link Publisher }
+ *
+ */
+ public Publisher createPublisher() {
+ return new Publisher();
+ }
+
+ /**
+ * Create an instance of {@link PublisherDetail }
+ *
+ */
+ public PublisherDetail createPublisherDetail() {
+ return new PublisherDetail();
+ }
+
+ /**
+ * Create an instance of {@link GetPublisherDetail }
+ *
+ */
+ public GetPublisherDetail createGetPublisherDetail() {
+ return new GetPublisherDetail();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link SavePublisher }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:apache-org:juddi_v3", name = "save_publisher")
+ public JAXBElement<SavePublisher> createSavePublisher(SavePublisher value) {
+ return new JAXBElement<SavePublisher>(_SavePublisher_QNAME, SavePublisher.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link DeletePublisher }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:apache-org:juddi_v3", name = "delete_publisher")
+ public JAXBElement<DeletePublisher> createDeletePublisher(DeletePublisher value) {
+ return new JAXBElement<DeletePublisher>(_DeletePublisher_QNAME, DeletePublisher.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link Publisher }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:apache-org:juddi_v3", name = "publisher")
+ public JAXBElement<Publisher> createPublisher(Publisher value) {
+ return new JAXBElement<Publisher>(_Publisher_QNAME, Publisher.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link PublisherDetail }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:apache-org:juddi_v3", name = "publisherDetail")
+ public JAXBElement<PublisherDetail> createPublisherDetail(PublisherDetail value) {
+ return new JAXBElement<PublisherDetail>(_PublisherDetail_QNAME, PublisherDetail.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link GetPublisherDetail }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:apache-org:juddi_v3", name = "get_publisherDetail")
+ public JAXBElement<GetPublisherDetail> createGetPublisherDetail(GetPublisherDetail value) {
+ return new JAXBElement<GetPublisherDetail>(_GetPublisherDetail_QNAME, GetPublisherDetail.class, null, value);
+ }
+}
+
\ No newline at end of file
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/ObjectFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/Publisher.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/Publisher.java?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/Publisher.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/Publisher.java Mon Nov 3 14:31:18 2008
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2001-2008 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.juddi.api.datatype;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.w3._2000._09.xmldsig_.SignatureType;
+
+
+/**
+ * <p>Java class for Publisher type. Specific to juddi.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "publisher", propOrder = {
+ "publisherName",
+ "emailAddress",
+ "isAdmin",
+ "isEnabled",
+ "maxBindingsPerService",
+ "maxBusinesses",
+ "maxServicePerBusiness",
+ "maxTModels",
+ "signature"
+})
+public class Publisher {
+
+ @XmlElement(name = "publisherName", namespace = "urn:apache-org:juddi_v3")
+ protected String publisherName;
+ @XmlElement(name = "emailAddress", namespace = "urn:apache-org:juddi_v3")
+ protected String emailAddress;
+ @XmlElement(name = "isAdmin", namespace = "urn:apache-org:juddi_v3")
+ protected String isAdmin;
+ @XmlElement(name = "isEnabled", namespace = "urn:apache-org:juddi_v3")
+ protected String isEnabled;
+ @XmlElement(name = "maxBindingsPerService", namespace = "urn:apache-org:juddi_v3")
+ protected Integer maxBindingsPerService;
+ @XmlElement(name = "maxBusinesses", namespace = "urn:apache-org:juddi_v3")
+ protected Integer maxBusinesses;
+ @XmlElement(name = "maxServicePerBusiness", namespace = "urn:apache-org:juddi_v3")
+ protected Integer maxServicePerBusiness;
+ @XmlElement(name = "maxTModels", namespace = "urn:apache-org:juddi_v3")
+ protected Integer maxTModels;
+ @XmlElement(name = "Signature", namespace = "http://www.w3.org/2000/09/xmldsig#")
+ protected List<SignatureType> signature;
+ @XmlAttribute
+ protected String publisherId;
+
+
+ /**
+ * @return the publisherName
+ */
+ public String getPublisherName() {
+ return publisherName;
+ }
+
+ /**
+ * @param publisherName the publisherName to set
+ */
+ public void setPublisherName(String publisherName) {
+ this.publisherName = publisherName;
+ }
+
+ /**
+ * @return the emailAddress
+ */
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ /**
+ * @param emailAddress the emailAddress to set
+ */
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ /**
+ * @return the isAdmin
+ */
+ public String getIsAdmin() {
+ return isAdmin;
+ }
+
+ /**
+ * @param isAdmin the isAdmin to set
+ */
+ public void setIsAdmin(String isAdmin) {
+ this.isAdmin = isAdmin;
+ }
+
+ /**
+ * @return the isEnabled
+ */
+ public String getIsEnabled() {
+ return isEnabled;
+ }
+
+ /**
+ * @param isEnabled the isEnabled to set
+ */
+ public void setIsEnabled(String isEnabled) {
+ this.isEnabled = isEnabled;
+ }
+
+ /**
+ * @return the maxBindingsPerService
+ */
+ public Integer getMaxBindingsPerService() {
+ return maxBindingsPerService;
+ }
+
+ /**
+ * @param maxBindingsPerService the maxBindingsPerService to set
+ */
+ public void setMaxBindingsPerService(int maxBindingsPerService) {
+ this.maxBindingsPerService = maxBindingsPerService;
+ }
+
+ /**
+ * @return the maxBusinesses
+ */
+ public Integer getMaxBusinesses() {
+ return maxBusinesses;
+ }
+
+ /**
+ * @param maxBusinesses the maxBusinesses to set
+ */
+ public void setMaxBusinesses(int maxBusinesses) {
+ this.maxBusinesses = maxBusinesses;
+ }
+
+ /**
+ * @return the maxServicePerBusiness
+ */
+ public Integer getMaxServicePerBusiness() {
+ return maxServicePerBusiness;
+ }
+
+ /**
+ * @param maxServicePerBusiness the maxServicePerBusiness to set
+ */
+ public void setMaxServicePerBusiness(int maxServicePerBusiness) {
+ this.maxServicePerBusiness = maxServicePerBusiness;
+ }
+
+ /**
+ * @return the maxTModels
+ */
+ public Integer getMaxTModels() {
+ return maxTModels;
+ }
+
+ /**
+ * @param maxTModels the maxTModels to set
+ */
+ public void setMaxTModels(int maxTModels) {
+ this.maxTModels = maxTModels;
+ }
+
+ /**
+ * @return the publisherId
+ */
+ public String getPublisherId() {
+ return publisherId;
+ }
+
+ /**
+ * @param publisherId the publisherId to set
+ */
+ public void setPublisherId(String publisherId) {
+ this.publisherId = publisherId;
+ }
+
+ /**
+ * Gets the value of the signature property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the signature property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getSignature().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link SignatureType }
+ *
+ *
+ */
+ public List<SignatureType> getSignature() {
+ if (signature == null) {
+ signature = new ArrayList<SignatureType>();
+ }
+ return this.signature;
+ }
+
+
+}
+
\ No newline at end of file
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/Publisher.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/PublisherDetail.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/PublisherDetail.java?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/PublisherDetail.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/PublisherDetail.java Mon Nov 3 14:31:18 2008
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2001-2008 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.juddi.api.datatype;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for publisherDetail type. Specific to juddi.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "publisherDetail", propOrder = {
+ "publisher"
+})
+public class PublisherDetail {
+
+ protected List<Publisher> publisher;
+ @XmlAttribute
+ protected Boolean truncated;
+
+ /**
+ * Gets the value of the publisher property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the businessEntity property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPublisher().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Publisher }
+ *
+ *
+ */
+ public List<Publisher> getPublisher() {
+ if (publisher == null) {
+ publisher = new ArrayList<Publisher>();
+ }
+ return this.publisher;
+ }
+
+ /**
+ * Gets the value of the truncated property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isTruncated() {
+ return truncated;
+ }
+
+ /**
+ * Sets the value of the truncated property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setTruncated(Boolean value) {
+ this.truncated = value;
+ }
+
+}
+
\ No newline at end of file
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/PublisherDetail.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/SavePublisher.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/SavePublisher.java?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/SavePublisher.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/SavePublisher.java Mon Nov 3 14:31:18 2008
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2001-2008 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.juddi.api.datatype;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for save_publisher type. Specific to juddi.
+ *
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "save_publisher", propOrder = {
+ "authInfo",
+ "publisher"
+})
+public class SavePublisher {
+
+ protected String authInfo;
+ @XmlElement(required = true)
+ protected List<Publisher> publisher;
+
+ /**
+ * Gets the value of the authInfo property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAuthInfo() {
+ return authInfo;
+ }
+
+ /**
+ * Sets the value of the authInfo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAuthInfo(String value) {
+ this.authInfo = value;
+ }
+
+ /**
+ * Gets the value of the publisher property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the businessEntity property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getPublisher().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Publisher }
+ *
+ *
+ */
+ public List<Publisher> getPublisher() {
+ if (publisher == null) {
+ publisher = new ArrayList<Publisher>();
+ }
+ return this.publisher;
+ }
+
+}
+
\ No newline at end of file
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/datatype/SavePublisher.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java Mon Nov 3 14:31:18 2008
@@ -62,6 +62,9 @@
import org.uddi.api_v3.TModelList;
import org.uddi.v3_service.DispositionReportFaultMessage;
import org.uddi.v3_service.UDDIInquiryPortType;
+import org.apache.juddi.api.datatype.GetPublisherDetail;
+import org.apache.juddi.api.datatype.PublisherDetail;
+
/**
* @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
@@ -100,7 +103,7 @@
// Sort and retrieve the final results with paging taken into account
List<?> queryResults = FetchBindingTemplatesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
- org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+ BindingDetail result = new BindingDetail();
for (Object item : queryResults) {
org.apache.juddi.model.BindingTemplate modelBindingTemplate = (org.apache.juddi.model.BindingTemplate)item;
org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();
@@ -137,7 +140,7 @@
//keysFound = FindBusinessByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);
keysFound = FindBusinessByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
- org.uddi.api_v3.BusinessList result = new org.uddi.api_v3.BusinessList();
+ BusinessList result = new BusinessList();
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchBusinessEntitiesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
@@ -184,7 +187,7 @@
//keysFound = FindServiceByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);
keysFound = FindServiceByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
- org.uddi.api_v3.ServiceList result = new org.uddi.api_v3.ServiceList();
+ ServiceList result = new ServiceList();
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchBusinessServicesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
@@ -226,7 +229,7 @@
//keysFound = FindTModelByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);
keysFound = FindTModelByNameQuery.select(em, findQualifiers, body.getName(), keysFound);
- org.uddi.api_v3.TModelList result = new org.uddi.api_v3.TModelList();
+ TModelList result = new TModelList();
// Sort and retrieve the final results taking paging into account
List<?> queryResults = FetchTModelsQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead());
@@ -260,7 +263,7 @@
EntityTransaction tx = em.getTransaction();
tx.begin();
- org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+ BindingDetail result = new BindingDetail();
List<String> bindingKeyList = body.getBindingKey();
for (String bindingKey : bindingKeyList) {
@@ -294,7 +297,7 @@
EntityTransaction tx = em.getTransaction();
tx.begin();
- org.uddi.api_v3.BusinessDetail result = new org.uddi.api_v3.BusinessDetail();
+ BusinessDetail result = new BusinessDetail();
List<String> businessKeyList = body.getBusinessKey();
for (String businessKey : businessKeyList) {
@@ -334,7 +337,7 @@
EntityTransaction tx = em.getTransaction();
tx.begin();
- org.uddi.api_v3.ServiceDetail result = new org.uddi.api_v3.ServiceDetail();
+ ServiceDetail result = new ServiceDetail();
List<String> serviceKeyList = body.getServiceKey();
for (String serviceKey : serviceKeyList) {
@@ -368,7 +371,7 @@
EntityTransaction tx = em.getTransaction();
tx.begin();
- org.uddi.api_v3.TModelDetail result = new org.uddi.api_v3.TModelDetail();
+ TModelDetail result = new TModelDetail();
List<String> tmodelKeyList = body.getTModelKey();
for (String tmodelKey : tmodelKeyList) {
@@ -391,4 +394,43 @@
return result;
}
+ /*
+ * Retrieves publisher(s) from the persistence layer. This method is specific to jUDDI.
+ */
+ public PublisherDetail getPublisherDetail(GetPublisherDetail body)
+ throws DispositionReportFaultMessage {
+
+ ValidateInquiry.validateGetPublisherDetail(body);
+
+ // TODO: Perform necessary authentication logic
+ String authInfo = body.getAuthInfo();
+
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ PublisherDetail result = new PublisherDetail();
+
+ List<String> publisherIdList = body.getPublisherId();
+ for (String publisherId : publisherIdList) {
+
+ org.apache.juddi.model.Publisher modelPublisher = em.find(org.apache.juddi.model.Publisher.class, publisherId);
+ if (modelPublisher == null) {
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.PublisherNotFound", publisherId));
+ }
+
+ org.apache.juddi.api.datatype.Publisher apiPublisher = new org.apache.juddi.api.datatype.Publisher();
+
+ MappingModelToApi.mapPublisher(modelPublisher, apiPublisher);
+
+ result.getPublisher().add(apiPublisher);
+ }
+
+ tx.commit();
+ em.close();
+
+ return result;
+
+ }
+
}
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java Mon Nov 3 14:31:18 2008
@@ -49,10 +49,12 @@
import org.apache.juddi.mapping.MappingApiToModel;
import org.apache.juddi.util.JPAUtil;
-import org.apache.juddi.error.UDDIErrorHelper;
-import org.apache.juddi.config.ResourceConfig;
import org.apache.juddi.validation.ValidatePublish;
+import org.apache.juddi.api.datatype.PublisherDetail;
+import org.apache.juddi.api.datatype.SavePublisher;
+import org.apache.juddi.api.datatype.DeletePublisher;
+
/**
* @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
*/
@@ -230,7 +232,7 @@
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
- org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+ BindingDetail result = new BindingDetail();
List<org.uddi.api_v3.BindingTemplate> apiBindingTemplateList = body.getBindingTemplate();
for (org.uddi.api_v3.BindingTemplate apiBindingTemplate : apiBindingTemplateList) {
@@ -269,7 +271,7 @@
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
- org.uddi.api_v3.BusinessDetail result = new org.uddi.api_v3.BusinessDetail();
+ BusinessDetail result = new BusinessDetail();
List<org.uddi.api_v3.BusinessEntity> apiBusinessEntityList = body.getBusinessEntity();
for (org.uddi.api_v3.BusinessEntity apiBusinessEntity : apiBusinessEntityList) {
@@ -306,7 +308,7 @@
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
- org.uddi.api_v3.ServiceDetail result = new org.uddi.api_v3.ServiceDetail();
+ ServiceDetail result = new ServiceDetail();
List<org.uddi.api_v3.BusinessService> apiBusinessServiceList = body.getBusinessService();
for (org.uddi.api_v3.BusinessService apiBusinessService : apiBusinessServiceList) {
@@ -336,28 +338,36 @@
public TModelDetail saveTModel(SaveTModel body)
throws DispositionReportFaultMessage {
- org.uddi.api_v3.TModelDetail result = new org.uddi.api_v3.TModelDetail();
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateSaveTModel(em, body);
// TODO: Perform necessary authentication logic
String authInfo = body.getAuthInfo();
+ TModelDetail result = new TModelDetail();
+
List<org.uddi.api_v3.TModel> apiTModelList = body.getTModel();
- Iterator<org.uddi.api_v3.TModel> apiTModelListItr = apiTModelList.iterator();
- while (apiTModelListItr.hasNext()) {
- org.uddi.api_v3.TModel apiTModel = apiTModelListItr.next();
-
- //TODO: Validate the input here
- //TODO: Test if key is null, and if so, apply key-generation strategy
- String tmodelKey = apiTModel.getTModelKey();
+ for (org.uddi.api_v3.TModel apiTModel : apiTModelList) {
org.apache.juddi.model.Tmodel modelTModel = new org.apache.juddi.model.Tmodel();
MappingApiToModel.mapTModel(apiTModel, modelTModel);
- JPAUtil.persistEntity(modelTModel, modelTModel.getTmodelKey());
+ Object existingUddiEntity = em.find(modelTModel.getClass(), modelTModel.getTmodelKey());
+ if (existingUddiEntity != null)
+ em.remove(existingUddiEntity);
+
+ em.persist(modelTModel);
result.getTModel().add(apiTModel);
}
+
+ tx.commit();
+ em.close();
+
return result;
}
@@ -369,4 +379,70 @@
}
+
+ /*
+ * Saves publisher(s) to the persistence layer. This method is specific to jUDDI.
+ */
+ public PublisherDetail savePublisher(SavePublisher body)
+ throws DispositionReportFaultMessage {
+
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateSavePublisher(em, body);
+
+ // TODO: Perform necessary authentication logic
+ String authInfo = body.getAuthInfo();
+
+ PublisherDetail result = new PublisherDetail();
+
+ List<org.apache.juddi.api.datatype.Publisher> apiPublisherList = body.getPublisher();
+ for (org.apache.juddi.api.datatype.Publisher apiPublisher : apiPublisherList) {
+
+ org.apache.juddi.model.Publisher modelPublisher = new org.apache.juddi.model.Publisher();
+
+ MappingApiToModel.mapPublisher(apiPublisher, modelPublisher);
+
+ Object existingUddiEntity = em.find(modelPublisher.getClass(), modelPublisher.getPublisherId());
+ if (existingUddiEntity != null)
+ em.remove(existingUddiEntity);
+
+ em.persist(modelPublisher);
+
+ result.getPublisher().add(apiPublisher);
+ }
+
+ tx.commit();
+ em.close();
+
+ return result;
+ }
+
+ /*
+ * Deletes publisher(s) from the persistence layer. This method is specific to jUDDI.
+ */
+ public void deletePublisher(DeletePublisher body)
+ throws DispositionReportFaultMessage {
+
+ EntityManager em = JPAUtil.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+
+ ValidatePublish.validateDeletePublisher(em, body);
+
+ // TODO: Perform necessary authentication logic
+ String authInfo = body.getAuthInfo();
+
+ List<String> entityKeyList = body.getPublisherId();
+ for (String entityKey : entityKeyList) {
+ Object obj = em.find(org.apache.juddi.model.Publisher.class, entityKey);
+ em.remove(obj);
+ }
+
+ tx.commit();
+ em.close();
+ }
+
+
}
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java Mon Nov 3 14:31:18 2008
@@ -31,6 +31,21 @@
*/
public class MappingApiToModel {
+ public static void mapPublisher(org.apache.juddi.api.datatype.Publisher apiPublisher,
+ org.apache.juddi.model.Publisher modelPublisher)
+ throws DispositionReportFaultMessage {
+
+ modelPublisher.setPublisherId(apiPublisher.getPublisherId());
+ modelPublisher.setPublisherName(apiPublisher.getPublisherName());
+ modelPublisher.setEmailAddress(apiPublisher.getEmailAddress());
+ modelPublisher.setIsAdmin(apiPublisher.getIsAdmin());
+ modelPublisher.setIsEnabled(apiPublisher.getIsEnabled());
+ modelPublisher.setMaxBindingsPerService(apiPublisher.getMaxBindingsPerService());
+ modelPublisher.setMaxBusinesses(apiPublisher.getMaxBusinesses());
+ modelPublisher.setMaxServicesPerBusiness(apiPublisher.getMaxServicePerBusiness());
+ modelPublisher.setMaxTmodels(apiPublisher.getMaxTModels());
+ }
+
public static void mapBusinessEntity(org.uddi.api_v3.BusinessEntity apiBusinessEntity,
org.apache.juddi.model.BusinessEntity modelBusinessEntity)
throws DispositionReportFaultMessage {
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java Mon Nov 3 14:31:18 2008
@@ -30,9 +30,24 @@
*/
public class MappingModelToApi {
+ public static void mapPublisher(org.apache.juddi.model.Publisher modelPublisher,
+ org.apache.juddi.api.datatype.Publisher apiPublisher)
+ throws DispositionReportFaultMessage {
+
+ apiPublisher.setPublisherId(modelPublisher.getPublisherId());
+ apiPublisher.setPublisherName(modelPublisher.getPublisherName());
+ apiPublisher.setEmailAddress(modelPublisher.getEmailAddress());
+ apiPublisher.setIsAdmin(modelPublisher.getIsAdmin());
+ apiPublisher.setIsEnabled(modelPublisher.getIsEnabled());
+ apiPublisher.setMaxBindingsPerService(modelPublisher.getMaxBindingsPerService());
+ apiPublisher.setMaxBusinesses(modelPublisher.getMaxBusinesses());
+ apiPublisher.setMaxServicePerBusiness(modelPublisher.getMaxServicesPerBusiness());
+ apiPublisher.setMaxTModels(modelPublisher.getMaxTmodels());
+ }
+
public static void mapBusinessEntity(org.apache.juddi.model.BusinessEntity modelBusinessEntity,
org.uddi.api_v3.BusinessEntity apiBusinessEntity)
- throws DispositionReportFaultMessage {
+ throws DispositionReportFaultMessage {
apiBusinessEntity.setBusinessKey(modelBusinessEntity.getBusinessKey());
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/Publisher.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/Publisher.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/Publisher.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/Publisher.java Mon Nov 3 14:31:18 2008
@@ -19,6 +19,7 @@
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
+import javax.persistence.Transient;
/**
* @author <a href="mailto:kurt@apache.org">Kurt T Stam</a>
@@ -98,6 +99,16 @@
this.isAdmin = isAdmin;
}
+ @Transient
+ public boolean isAdmin() {
+ boolean ret = false;
+ if (this.isAdmin != null) {
+ if (this.isAdmin.equalsIgnoreCase("true"))
+ ret = true;
+ }
+ return ret;
+ }
+
@Column(name = "is_enabled", length = 5)
public String getIsEnabled() {
return this.isEnabled;
@@ -107,6 +118,16 @@
this.isEnabled = isEnabled;
}
+ @Transient
+ public boolean isEnabled() {
+ boolean ret = false;
+ if (this.isEnabled != null) {
+ if (this.isEnabled.equalsIgnoreCase("true"))
+ ret = true;
+ }
+ return ret;
+ }
+
@Column(name = "max_businesses")
public Integer getMaxBusinesses() {
return this.maxBusinesses;
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java Mon Nov 3 14:31:18 2008
@@ -21,6 +21,7 @@
import java.util.List;
import java.util.Hashtable;
+import org.apache.juddi.api.datatype.GetPublisherDetail;
import org.uddi.api_v3.GetBusinessDetail;
import org.uddi.api_v3.GetServiceDetail;
import org.uddi.api_v3.GetBindingDetail;
@@ -45,6 +46,25 @@
*/
public class ValidateInquiry {
+ public static void validateGetPublisherDetail(GetPublisherDetail body) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ // No null or empty list
+ List<String> publisherIdList = body.getPublisherId();
+ if (publisherIdList == null || publisherIdList.size() == 0)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+
+ HashSet<String> dupCheck = new HashSet<String>();
+ for (String publisherId : publisherIdList) {
+ boolean inserted = dupCheck.add(publisherId);
+ if (!inserted)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", publisherId));
+ }
+ }
+
public static void validateGetBusinessDetail(GetBusinessDetail body) throws DispositionReportFaultMessage {
// No null input
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java Mon Nov 3 14:31:18 2008
@@ -33,6 +33,8 @@
import org.uddi.api_v3.SaveBinding;
import org.uddi.api_v3.SaveTModel;
import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.apache.juddi.api.datatype.SavePublisher;
+import org.apache.juddi.api.datatype.DeletePublisher;
import org.apache.juddi.error.ErrorMessage;
import org.apache.juddi.error.FatalErrorException;
@@ -48,6 +50,30 @@
*/
public class ValidatePublish {
+ public static void validateDeletePublisher(EntityManager em, DeletePublisher body) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ // No null or empty list
+ List<String> entityKeyList = body.getPublisherId();
+ if (entityKeyList == null || entityKeyList.size() == 0)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+
+ HashSet<String> dupCheck = new HashSet<String>();
+ for (String entityKey : entityKeyList) {
+ boolean inserted = dupCheck.add(entityKey);
+ if (!inserted)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+
+ Object obj = em.find(org.apache.juddi.model.Publisher.class, entityKey);
+ if (obj == null)
+ throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.PublisherNotFound", entityKey));
+
+ }
+ }
+
public static void validateDeleteBusiness(EntityManager em, DeleteBusiness body) throws DispositionReportFaultMessage {
// No null input
@@ -167,6 +193,25 @@
}
}
+ public static void validateSavePublisher(EntityManager em, SavePublisher body) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (body == null)
+ throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+
+ // No null or empty list
+ List<org.apache.juddi.api.datatype.Publisher> entityList = body.getPublisher();
+ if (entityList == null || entityList.size() == 0)
+ throw new ValueNotAllowedException(new ErrorMessage("errors.savepublisher.NoInput"));
+
+ // TODO: only an admin can save a publisher
+
+ for (org.apache.juddi.api.datatype.Publisher entity : entityList) {
+ validatePublisher(em, entity);
+ }
+ }
+
+
public static void validateSaveBusiness(EntityManager em, SaveBusiness body) throws DispositionReportFaultMessage {
// No null input
@@ -231,6 +276,19 @@
validateTModel(em, entity);
}
}
+
+ public static void validatePublisher(EntityManager em, org.apache.juddi.api.datatype.Publisher publisher) throws DispositionReportFaultMessage {
+
+ // No null input
+ if (publisher == null)
+ throw new ValueNotAllowedException(new ErrorMessage("errors.publisher.NullInput"));
+
+ String publisherId = publisher.getPublisherId();
+ if (publisherId == null || publisherId.length() == 0)
+ throw new ValueNotAllowedException(new ErrorMessage("errors.publisher.NoPublisherId"));
+
+ }
+
public static void validateBusinessEntity(EntityManager em, org.uddi.api_v3.BusinessEntity businessEntity) throws DispositionReportFaultMessage {
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties Mon Nov 3 14:31:18 2008
@@ -59,6 +59,7 @@
errors.keyunavailable.KeyExists=The key used for the save operation already exists. Another key must be chosen
errors.invalidkey.NoKeys=No keys passed. At least one key must be passed
errors.invalidkey.DuplicateKey=A duplicate key was passed. No duplicates are allowed
+errors.invalidkey.PublisherNotFound=The publisher was not found for the given id
errors.invalidkey.BusinessNotFound=The business entity was not found for the given key
errors.invalidkey.ServiceNotFound=The business service was not found for the given key
errors.invalidkey.BindingTemplatelNotFound=The binding template was not found for the given key
@@ -74,10 +75,13 @@
errors.assertion.AssertionNotFound=The publisher assertion was not found for the given key
#-- Error messages related to entities and other data structures
+errors.savepublisher.NoInput=At least one Publisher must be provided
errors.savebusiness.NoInput=At least one BusinessEntity must be provided
errors.saveservice.NoInput=At least one BusinessService must be provided
errors.savebinding.NoInput=At least one BindingTemplate must be provided
errors.savetmodel.NoInput=At least one tModel must be provided
+errors.publisher.NullInput=The Publisher structure cannot be blank
+errors.publisher.NoPublisherId=A valid publisher Id was not specified
errors.businessentity.NullInput=The businessEntity structure cannot be blank
errors.businessservice.NullInput=The businessService structure cannot be blank
errors.bindingtemplate.NullInput=The bindingTemplate structure cannot be blank
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java Mon Nov 3 14:31:18 2008
@@ -21,7 +21,7 @@
public void saveBusiness(String businessFile, String businessKey) {
try {
SaveBusiness sb = new SaveBusiness();
- BusinessEntity beIn = (BusinessEntity)UDDIApiTestHelper.buildEntityFromDoc(businessFile);
+ BusinessEntity beIn = (BusinessEntity)UDDIApiTestHelper.buildEntityFromDoc(businessFile, "org.uddi.api_v3");
sb.getBusinessEntity().add(beIn);
publish.saveBusiness(sb);
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java Mon Nov 3 14:31:18 2008
@@ -26,7 +26,7 @@
try {
// First save the entity
SaveService ss = new SaveService();
- org.uddi.api_v3.BusinessService bsIn = (org.uddi.api_v3.BusinessService)UDDIApiTestHelper.buildEntityFromDoc(serviceFile);
+ org.uddi.api_v3.BusinessService bsIn = (org.uddi.api_v3.BusinessService)UDDIApiTestHelper.buildEntityFromDoc(serviceFile, "org.uddi.api_v3");
ss.getBusinessService().add(bsIn);
publish.saveService(ss);
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/PublisherTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/PublisherTest.java?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/PublisherTest.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/PublisherTest.java Mon Nov 3 14:31:18 2008
@@ -0,0 +1,70 @@
+package org.apache.juddi.test;
+
+import java.util.List;
+import javax.xml.bind.JAXBException;
+
+import org.apache.juddi.api.impl.UDDIPublicationImpl;
+import org.apache.juddi.api.impl.UDDIInquiryImpl;
+import org.testng.Assert;
+import org.testng.annotations.*;
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.juddi.api.datatype.*;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+
+public class PublisherTest {
+ private UDDIPublicationImpl publish = new UDDIPublicationImpl();
+ private UDDIInquiryImpl inquiry = new UDDIInquiryImpl();
+
+ @Parameters({ "publisherFile", "publisherId" })
+ @Test
+ public void savePublisher(String publisherFile, String publisherId) {
+ try {
+ SavePublisher sp = new SavePublisher();
+ Publisher pubIn = (Publisher)UDDIApiTestHelper.buildEntityFromDoc(publisherFile, "org.apache.juddi.api.datatype");
+ sp.getPublisher().add(pubIn);
+ publish.savePublisher(sp);
+
+ // Now get the entity and check the values
+ GetPublisherDetail gp = new GetPublisherDetail();
+ gp.getPublisherId().add(publisherId);
+ PublisherDetail pd = inquiry.getPublisherDetail(gp);
+ List<Publisher> pubOutList = pd.getPublisher();
+ Publisher pubOut = pubOutList.get(0);
+
+ assertEquals(pubIn.getPublisherId(), pubOut.getPublisherId());
+ assertEquals(pubIn.getPublisherName(), pubOut.getPublisherName());
+ assertEquals(pubIn.getEmailAddress(), pubOut.getEmailAddress());
+ assertEquals(pubIn.getIsAdmin(), pubOut.getIsAdmin());
+ assertEquals(pubIn.getIsEnabled(), pubOut.getIsEnabled());
+ assertEquals(pubIn.getMaxBindingsPerService(), pubOut.getMaxBindingsPerService());
+ assertEquals(pubIn.getMaxBusinesses(), pubOut.getMaxBusinesses());
+ assertEquals(pubIn.getMaxServicePerBusiness(), pubOut.getMaxServicePerBusiness());
+ assertEquals(pubIn.getMaxTModels(), pubOut.getMaxTModels());
+
+ }
+ catch(DispositionReportFaultMessage dr) {
+ Assert.fail("No exception should be thrown", dr);
+ }
+ catch(JAXBException je) {
+ Assert.fail("No exception should be thrown", je);
+ }
+
+ }
+
+ @Parameters({ "publisherId" })
+ @Test
+ public void deletePublisher(String publisherId) {
+ try {
+ // Delete the entity and make sure it is removed
+ DeletePublisher dp = new DeletePublisher();
+ dp.getPublisherId().add(publisherId);
+ publish.deletePublisher(dp);
+ }
+ catch(DispositionReportFaultMessage dr) {
+ Assert.fail("No exception should be thrown", dr);
+ }
+
+ }
+
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/PublisherTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java Mon Nov 3 14:31:18 2008
@@ -16,15 +16,16 @@
public class UDDIApiTestHelper {
- public static Object buildEntityFromDoc(String fileName) throws JAXBException {
- JAXBContext jc = JAXBContext.newInstance("org.uddi.api_v3");
+
+ public static Object buildEntityFromDoc(String fileName, String thePackage) throws JAXBException {
+ JAXBContext jc = JAXBContext.newInstance(thePackage);
Unmarshaller unmarshaller = jc.createUnmarshaller();
Object obj = ((JAXBElement)unmarshaller.unmarshal(new File(fileName))).getValue();
return obj;
}
-
- public static void outputEntity(Object obj) throws JAXBException {
- JAXBContext jc = JAXBContext.newInstance("org.uddi.api_v3");
+
+ public static void outputEntity(Object obj, String thePackage) throws JAXBException {
+ JAXBContext jc = JAXBContext.newInstance(thePackage);
Marshaller marshaller = jc.createMarshaller();
marshaller.marshal( new JAXBElement<Object>(new javax.xml.namespace.QName("uri","local"), Object.class, obj), System.out);
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/publisher1.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/publisher1.xml?rev=710195&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/publisher1.xml (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/publisher1.xml Mon Nov 3 14:31:18 2008
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<publisher xmlns="urn:apache-org:juddi_v3" publisherId="admin">
+ <publisherName>Administrator</publisherName>
+ <emailAddress>admin@juddi.apache.org</emailAddress>
+ <isAdmin>TrUe</isAdmin>
+ <isEnabled>TrUe</isEnabled>
+ <maxBindingsPerService>199</maxBindingsPerService>
+ <maxBusinesses>100</maxBusinesses>
+ <maxServicePerBusiness>100</maxServicePerBusiness>
+ <maxTModels>100</maxTModels>
+</publisher>
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/publisher1.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/test/resources/suite-one.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/resources/suite-one.xml?rev=710195&r1=710194&r2=710195&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/resources/suite-one.xml (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/resources/suite-one.xml Mon Nov 3 14:31:18 2008
@@ -1,9 +1,20 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="suite-one" verbose="1">
+ <parameter name="publisherFile" value="./src/test/java/org/apache/juddi/test/publisher1.xml" />
<parameter name="businessFile" value="./src/test/java/org/apache/juddi/test/businessEntity1.xml" />
<parameter name="serviceFile" value="./src/test/java/org/apache/juddi/test/businessService1.xml" />
+ <parameter name="publisherId" value="admin" />
<parameter name="businessKey" value="uddi:businessone.com" />
<parameter name="serviceKey" value="uddi:businessone.com:services:serviceone" />
+ <test name="savePublisher">
+ <classes>
+ <class name="org.apache.juddi.test.PublisherTest">
+ <methods>
+ <include name="savePublisher" />
+ </methods>
+ </class>
+ </classes>
+ </test>
<test name="saveBusiness">
<classes>
<class name="org.apache.juddi.test.BusinessEntityTest">
@@ -40,4 +51,13 @@
</class>
</classes>
</test>
+ <test name="deletePublisher">
+ <classes>
+ <class name="org.apache.juddi.test.PublisherTest">
+ <methods>
+ <include name="deletePublisher" />
+ </methods>
+ </class>
+ </classes>
+ </test>
</suite>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org