Author: alexoree
Date: Fri Nov 8 03:48:19 2013
New Revision: 1539913
URL: http://svn.apache.org/r1539913
Log:
JUDDI-509 Service versioning example added for java client
Added:
juddi/trunk/juddi-examples/service-version/ (with props)
juddi/trunk/juddi-examples/service-version/src/
juddi/trunk/juddi-examples/service-version/src/main/
juddi/trunk/juddi-examples/service-version/src/main/resources/
juddi/trunk/juddi-examples/service-version/src/main/resources/META-INF/
juddi/trunk/juddi-examples/service-version/src/main/resources/META-INF/uddi.xml
- copied, changed from r1538498,
juddi/trunk/juddi-examples/hello-world/src/main/resources/META-INF/hello-world-uddi.xml
Modified:
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
juddi/trunk/juddi-examples/pom.xml
juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
juddi/trunk/uddi-ws/src/main/java/org/uddi/api_v3/OverviewURL.java
Modified:
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java?rev=1539913&r1=1539912&r2=1539913&view=diff
==============================================================================
---
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
(original)
+++
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/UDDIConstants.java
Fri Nov 8 03:48:19 2013
@@ -6,7 +6,14 @@ package org.apache.juddi.v3.client;
* @author <a href="mailto:[email protected]">Alex O'Ree</a>
*/
public interface UDDIConstants {
-
+
+ /**
+ * identifies a tmodel instance info containing some version information
of a service
+ * a juddi extension based on
+ * http://www.ibm.com/developerworks/webservices/library/ws-version/
+ */
+ public static final String VERSION_TMODEL = "urn:uddi:uddi.org:version";
+
public static final int MAX_xml_lang_length = 26;
public static final int MAX_description_length = 255;
public static final int MAX_discoveryURL_length = 4096;
Modified:
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java?rev=1539913&r1=1539912&r2=1539913&view=diff
==============================================================================
---
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
(original)
+++
juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
Fri Nov 8 03:48:19 2013
@@ -21,13 +21,14 @@ import java.lang.reflect.UndeclaredThrow
import java.net.URL;
import java.rmi.RemoteException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.Set;
import javax.wsdl.Definition;
import javax.xml.ws.Holder;
@@ -58,6 +59,7 @@ import org.uddi.api_v3.DeleteBinding;
import org.uddi.api_v3.DeleteBusiness;
import org.uddi.api_v3.DeleteService;
import org.uddi.api_v3.DeleteTModel;
+import org.uddi.api_v3.Description;
import org.uddi.api_v3.DiscardAuthToken;
import org.uddi.api_v3.DispositionReport;
import org.uddi.api_v3.FindRelatedBusinesses;
@@ -67,6 +69,7 @@ import org.uddi.api_v3.GetBindingDetail;
import org.uddi.api_v3.GetBusinessDetail;
import org.uddi.api_v3.GetServiceDetail;
import org.uddi.api_v3.GetTModelDetail;
+import org.uddi.api_v3.InstanceDetails;
import org.uddi.api_v3.KeyedReference;
import org.uddi.api_v3.Name;
import org.uddi.api_v3.OverviewDoc;
@@ -80,6 +83,7 @@ import org.uddi.api_v3.SaveTModel;
import org.uddi.api_v3.ServiceDetail;
import org.uddi.api_v3.TModel;
import org.uddi.api_v3.TModelDetail;
+import org.uddi.api_v3.TModelInstanceInfo;
import org.uddi.api_v3.TModelList;
import org.uddi.sub_v3.DeleteSubscription;
import org.uddi.sub_v3.Subscription;
@@ -88,6 +92,7 @@ import org.uddi.v3_service.DispositionRe
public class UDDIClerk implements Serializable {
private static final long serialVersionUID = -8597375975981358134L;
+
private Log log = LogFactory.getLog(this.getClass());
protected String name;
protected UDDINode uddiNode;
@@ -371,6 +376,10 @@ public class UDDIClerk implements Serial
*/
public BusinessEntity register(BusinessEntity business, Node node) {
+ if (business.getName().get(0)==null){
+ log.error("Unable to register business because no Name elements
have been added.");
+ return null;
+ }
BusinessEntity businessEntity = null;
log.info("Registering business " + business.getName().get(0).getValue()
+ " with key " + business.getBusinessKey());
@@ -968,4 +977,98 @@ public class UDDIClerk implements Serial
tm.setTModelKey(partitionName.toLowerCase());
return tm;
}
+
+ /**
+ * This is a convenience function that will build and return a
TModelInstanceInfo
+ * as described in the following link that will enable you to tag web
services
+ * registered in UDDI with some kind of version information.<Br><Br>
+ * Article source: <a
href="http://www.ibm.com/developerworks/webservices/library/ws-version/">http://www.ibm.com/developerworks/webservices/library/ws-version/</a>
+ * <Br><Br>
+ *
+ * When using this tModel as a tModelInstance, it can be used to describe
a
+ * version associated with either a service interface, a bindingTemplate
+ * service instance. Note: This is a jUDDI specific addon and may not be
+ * present in other registries
+ *
+ * @param version From the article, no specificity is provided on what to
use as a value, but
+ * we recommend that you use the string representation of
major.minor[.build[.revision]].<br>
+ * Example
+ * <ul>
+ * <li>6.1.2.3</li>
+ * <li>1.0</li>
+ * <li>0.1</li>
+ * </ul>
+ * @return TModelInstanceInfo populated as described in the article, plus
some descriptive information
+ */
+ public static TModelInstanceInfo createServiceInterfaceVersion(String
version, String lang) throws IllegalArgumentException {
+ if (version==null)
+ throw new IllegalArgumentException();
+ TModelInstanceInfo tt = new TModelInstanceInfo();
+ tt.setTModelKey(UDDIConstants.VERSION_TMODEL);
+ tt.setInstanceDetails(new InstanceDetails());
+ tt.getInstanceDetails().setInstanceParms(version);
+
+ OverviewDoc doc = new OverviewDoc();
+ doc.setOverviewURL(new
OverviewURL("http://www.ibm.com/developerworks/webservices/library/ws-version/",
"text"));
+ doc.getDescription().add(new Description(
+ "Describes a version associated with either a service
interface, a bindingTemplate service instance.", lang));
+ tt.getDescription().add(new Description("Describes a version
associated with either a service interface, a bindingTemplate service
instance.", lang));
+ tt.getInstanceDetails().getOverviewDoc().add(new OverviewDoc());
+ return tt;
+ }
+
+ /**
+ * This is a convenience function that will filter a list of binding
templates
+ * and return a list of bindings matching the specified version number.
+ *
+ * This implements and expands upon service versioning described in the
+ * following link and will enable you to tag web services
+ * registered in UDDI with some kind of version information.<Br><Br>
+ * Article source: <a
href="http://www.ibm.com/developerworks/webservices/library/ws-version/">http://www.ibm.com/developerworks/webservices/library/ws-version/</a>
+ * <Br><Br>
+ * @see createServiceInterfaceVersion for more information<Br><br>
+ *
+ * This function operates using tModelInstances that are used to describe
a
+ * version associated with either a service interface, a bindingTemplate
+ * service instance. Note: This is a jUDDI specific addon and may not be
+ * present in other registries
+ *
+ * @param version From the article, no specificity is provided on what to
use as a value, but
+ * we recommend that you use the string representation of
major.minor[.build[.revision]].<br>
+ * Example
+ * <ul>
+ * <li>6.1.2.3</li>
+ * <li>1.0</li>
+ * <li>0.1</li>
+ * </ul>
+ * @param version
+ * @param bindingTemplate
+ * @return a list if binding templates where the version equals ignoring
case trimmed equals the version value
+ */
+ public static Set<BindingTemplate> getBindingByVersion(String version,
List<BindingTemplate> bindingTemplate) throws IllegalArgumentException {
+ if (version == null) {
+ throw new IllegalArgumentException();
+ }
+ if (bindingTemplate == null) {
+ throw new IllegalArgumentException();
+ }
+ Set<BindingTemplate> ret = new HashSet<BindingTemplate>();
+ for (int i = 0; i < bindingTemplate.size(); i++) {
+ if (bindingTemplate.get(i).getTModelInstanceDetails() != null) {
+ for (int k = 0; k <
bindingTemplate.get(i).getTModelInstanceDetails().getTModelInstanceInfo().size();
k++) {
+ if
(bindingTemplate.get(i).getTModelInstanceDetails().getTModelInstanceInfo().get(k).getTModelKey().equalsIgnoreCase(UDDIConstants.VERSION_TMODEL))
{
+ if
(bindingTemplate.get(i).getTModelInstanceDetails().getTModelInstanceInfo().get(k).getInstanceDetails()
!= null) {
+ if
(bindingTemplate.get(i).getTModelInstanceDetails().getTModelInstanceInfo().get(k).getInstanceDetails().getInstanceParms()
!= null) {
+ if
(bindingTemplate.get(i).getTModelInstanceDetails().getTModelInstanceInfo().get(k).getInstanceDetails().getInstanceParms().trim().equalsIgnoreCase(version.trim()))
{
+ ret.add(bindingTemplate.get(i));
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return ret;
+ }
}
Modified: juddi/trunk/juddi-examples/pom.xml
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/pom.xml?rev=1539913&r1=1539912&r2=1539913&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/pom.xml (original)
+++ juddi/trunk/juddi-examples/pom.xml Fri Nov 8 03:48:19 2013
@@ -36,5 +36,6 @@
<module>wsdl2uddi-lifecyle</module>
<module>subscription-notification-amqp</module>
<module>more-uddi-samples</module>
+ <module>service-version</module>
</modules>
</project>
\ No newline at end of file
Propchange: juddi/trunk/juddi-examples/service-version/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Nov 8 03:48:19 2013
@@ -0,0 +1 @@
+target
Copied:
juddi/trunk/juddi-examples/service-version/src/main/resources/META-INF/uddi.xml
(from r1538498,
juddi/trunk/juddi-examples/hello-world/src/main/resources/META-INF/hello-world-uddi.xml)
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/service-version/src/main/resources/META-INF/uddi.xml?p2=juddi/trunk/juddi-examples/service-version/src/main/resources/META-INF/uddi.xml&p1=juddi/trunk/juddi-examples/hello-world/src/main/resources/META-INF/hello-world-uddi.xml&r1=1538498&r2=1539913&rev=1539913&view=diff
==============================================================================
---
juddi/trunk/juddi-examples/hello-world/src/main/resources/META-INF/hello-world-uddi.xml
(original)
+++
juddi/trunk/juddi-examples/service-version/src/main/resources/META-INF/uddi.xml
Fri Nov 8 03:48:19 2013
@@ -1,67 +1,36 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<uddi xmlns="urn:juddi-apache-org:v3_client"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="classpath:/xsd/uddi-client.xsd">
<reloadDelay>5000</reloadDelay>
- <client name="example-client">
- <nodes>
- <node>
- <!-- required 'default' node -->
- <name>default</name>
+ <client name="default">
+ <nodes>
+ <node>
+ <!-- required 'default' node -->
+ <name>default</name>
<properties>
<property name="serverName" value="localhost"/>
<property name="serverPort" value="8080"/>
- <!-- for UDDI nodes that use HTTP u/p,
using the following
- <property name="basicAuthUsername"
value="root" />
- <property name="basicAuthPassword"
value="password" />
- <property
name="basicAuthPasswordIsEncrypted" value="false" />
- <property
name="basicAuthPasswordCryptoProvider"
value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
+ <!-- for UDDI nodes that use HTTP u/p, using the following
+ <property name="basicAuthUsername" value="root" />
+ <property name="basicAuthPassword" value="password" />
+ <property name="basicAuthPasswordIsEncrypted"
value="false" />
+ <property name="basicAuthPasswordCryptoProvider"
value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
</properties>
- <description>Main jUDDI node</description>
- <!-- JAX-WS Transport -->
-
<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
-
<custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
-
<inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry?wsdl</inquiryUrl>
-
<publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish?wsdl</publishUrl>
-
<securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security?wsdl</securityUrl>
-
<subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription?wsdl</subscriptionUrl>
-
<subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
-
<juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
- </node>
- </nodes>
- <signature>
- <!-- signing stuff -->
- <signingKeyStorePath>keystore.jks</signingKeyStorePath>
- <signingKeyStoreType>JKS</signingKeyStoreType>
- <signingKeyStoreFilePassword
- isPasswordEncrypted="false"
-
cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyStoreFilePassword>
- <signingKeyPassword
- isPasswordEncrypted="false"
-
cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyPassword>
- <signingKeyAlias>my special key</signingKeyAlias>
-
<canonicalizationMethod>http://www.w3.org/2001/10/xml-exc-c14n#</canonicalizationMethod>
- <signatureMethod>RSA_SHA1</signatureMethod>
-
<XML_DIGSIG_NS>http://www.w3.org/2000/09/xmldsig#</XML_DIGSIG_NS>
- <!-- validation stuff -->
- <trustStorePath>truststore.jks</trustStorePath>
- <trustStoreType>JKS</trustStoreType>
- <trustStorePassword
- isPasswordEncrypted="false"
-
cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</trustStorePassword>
-
- <checkTimestamps>true</checkTimestamps>
- <checkTrust>true</checkTrust>
- <checkRevocationCRL>true</checkRevocationCRL>
- </signature>
- <subscriptionCallbacks>
- <keyDomain>uddi:somebusiness</keyDomain>
- <listenUrl>http://MyHostname:4444/callback</listenUrl>
-
<autoRegisterBindingTemplate>false</autoRegisterBindingTemplate>
-
<autoRegisterBusinessServiceKey>uddi:somebusiness:someservicekey</autoRegisterBusinessServiceKey>
- <signatureBehavior>DoNothing</signatureBehavior>
- <!--valid values are
AbortIfSigned,Sign,DoNothing,SignOnlyIfParentIsntSigned, default is DoNothing-->
- </subscriptionCallbacks>
- <XtoWsdl>
- <IgnoreSSLErrors>false</IgnoreSSLErrors>
- </XtoWsdl>
- </client>
+ <description>Main jUDDI node</description>
+ <!-- JAX-WS Transport -->
+
<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+
<custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer?wsdl</custodyTransferUrl>
+
<inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry?wsdl</inquiryUrl>
+
<publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish?wsdl</publishUrl>
+
<securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security?wsdl</securityUrl>
+
<subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription?wsdl</subscriptionUrl>
+
<subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener?wsdl</subscriptionListenerUrl>
+
<juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+ </node>
+ </nodes>
+ <clerks registerOnStartup="false" >
+ <clerk name="default" node="default" publisher="uddi"
password="uddi"/>
+ </clerks>
+
+
+ </client>
</uddi>
Modified:
juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java?rev=1539913&r1=1539912&r2=1539913&view=diff
==============================================================================
---
juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
(original)
+++
juddi/trunk/juddi-examples/simple-publish/src/main/java/org/apache/juddi/example/publish/SimplePublish.java
Fri Nov 8 03:48:19 2013
@@ -19,117 +19,117 @@ package org.apache.juddi.example.publish
import org.uddi.api_v3.*;
import org.apache.juddi.api_v3.*;
import org.apache.juddi.v3.client.config.UDDIClient;
-import org.apache.juddi.v3.client.config.UDDIClientContainer;
import org.apache.juddi.v3.client.transport.Transport;
import org.uddi.v3_service.UDDISecurityPortType;
import org.uddi.v3_service.UDDIPublicationPortType;
import org.apache.juddi.v3_service.JUDDIApiPortType;
public class SimplePublish {
- private static UDDISecurityPortType security = null;
-
- private static JUDDIApiPortType juddiApi = null;
- private static UDDIPublicationPortType publish = null;
- public SimplePublish() {
+ private static UDDISecurityPortType security = null;
+ private static JUDDIApiPortType juddiApi = null;
+ private static UDDIPublicationPortType publish = null;
+
+ public SimplePublish() {
+ try {
+ // create a client and read the config in the archive;
+ // you can use your config file name
+ UDDIClient uddiClient = new
UDDIClient("META-INF/simple-publish-uddi.xml");
+ // a UddiClient can be a client to multiple UDDI nodes, so
+ // supply the nodeName (defined in your uddi.xml.
+ // The transport can be WS, inVM, RMI etc which is defined in the
uddi.xml
+ Transport transport = uddiClient.getTransport("default");
+ // Now you create a reference to the UDDI API
+ security = transport.getUDDISecurityService();
+ juddiApi = transport.getJUDDIApiService();
+ publish = transport.getUDDIPublishService();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void publish() {
try {
- // create a client and read the config in the archive;
- // you can use your config file name
- UDDIClient uddiClient = new
UDDIClient("META-INF/simple-publish-uddi.xml");
- // a UddiClient can be a client to multiple UDDI nodes, so
- // supply the nodeName (defined in your uddi.xml.
- // The transport can be WS, inVM, RMI etc which is defined in
the uddi.xml
- Transport transport = uddiClient.getTransport("default");
- // Now you create a reference to the UDDI API
- security = transport.getUDDISecurityService();
- juddiApi = transport.getJUDDIApiService();
- publish = transport.getUDDIPublishService();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void publish() {
- try {
- // Setting up the values to get an authentication token
for the 'root' user ('root' user has admin privileges
- // and can save other publishers).
- GetAuthToken getAuthTokenRoot = new GetAuthToken();
- getAuthTokenRoot.setUserID("root");
- getAuthTokenRoot.setCred("");
-
- // Making API call that retrieves the authentication
token for the 'root' user.
- AuthToken rootAuthToken =
security.getAuthToken(getAuthTokenRoot);
- System.out.println ("root AUTHTOKEN = " +
rootAuthToken.getAuthInfo());
-
- // Creating a new publisher that we will use to publish
our entities to.
- Publisher p = new Publisher();
- p.setAuthorizedName("my-publisher");
- p.setPublisherName("My Publisher");
-
- // Adding the publisher to the "save" structure, using
the 'root' user authentication info and saving away.
- SavePublisher sp = new SavePublisher();
- sp.getPublisher().add(p);
- sp.setAuthInfo(rootAuthToken.getAuthInfo());
- juddiApi.savePublisher(sp);
-
- // Our publisher is now saved, so now we want to
retrieve its authentication token
- GetAuthToken getAuthTokenMyPub = new GetAuthToken();
- getAuthTokenMyPub.setUserID("my-publisher");
- getAuthTokenMyPub.setCred("");
- AuthToken myPubAuthToken =
security.getAuthToken(getAuthTokenMyPub);
- System.out.println ("myPub AUTHTOKEN = " +
myPubAuthToken.getAuthInfo());
-
- // Creating the parent business entity that will
contain our service.
- BusinessEntity myBusEntity = new BusinessEntity();
- Name myBusName = new Name();
- myBusName.setValue("My Business");
- myBusEntity.getName().add(myBusName);
-
- // Adding the business entity to the "save" structure,
using our publisher's authentication info and saving away.
- SaveBusiness sb = new SaveBusiness();
- sb.getBusinessEntity().add(myBusEntity);
- sb.setAuthInfo(myPubAuthToken.getAuthInfo());
- BusinessDetail bd = publish.saveBusiness(sb);
- String myBusKey =
bd.getBusinessEntity().get(0).getBusinessKey();
- System.out.println("myBusiness key: " + myBusKey);
-
- // Creating a service to save. Only adding the minimum
data: the parent business key retrieved from saving the business
- // above and a single name.
- BusinessService myService = new BusinessService();
- myService.setBusinessKey(myBusKey);
- Name myServName = new Name();
- myServName.setValue("My Service");
- myService.getName().add(myServName);
-
- // Add binding templates, etc...
- BindingTemplate myBindingTemplate = new
BindingTemplate();
- AccessPoint accessPoint = new AccessPoint();
-
accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
-
accessPoint.setValue("http://example.org/services/myservice?wsdl");
- myBindingTemplate.setAccessPoint(accessPoint);
- BindingTemplates myBindingTemplates = new
BindingTemplates();
-
myBindingTemplates.getBindingTemplate().add(myBindingTemplate);
- myService.setBindingTemplates(myBindingTemplates);
-
- // Adding the service to the "save" structure, using
our publisher's authentication info and saving away.
- SaveService ss = new SaveService();
- ss.getBusinessService().add(myService);
- ss.setAuthInfo(myPubAuthToken.getAuthInfo());
- ServiceDetail sd = publish.saveService(ss);
- String myServKey =
sd.getBusinessService().get(0).getServiceKey();
- System.out.println("myService key: " + myServKey);
-
- // Now you have a publisher saved who in turn published
a business and service via
- // the jUDDI API!
-
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static void main (String args[]) {
- SimplePublish sp = new SimplePublish();
- sp.publish();
- }
+ // Setting up the values to get an authentication token for the
'root' user ('root' user has admin privileges
+ // and can save other publishers).
+ GetAuthToken getAuthTokenRoot = new GetAuthToken();
+ getAuthTokenRoot.setUserID("root");
+ getAuthTokenRoot.setCred("");
+
+ // Making API call that retrieves the authentication token for the
'root' user.
+ AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+ System.out.println("root AUTHTOKEN = " + "******* never log auth
tokens!");
+
+ // Creating a new publisher that we will use to publish our
entities to.
+ //START: Note, this step is optional and only applies to jUDDI
UDDI Servers
+ Publisher p = new Publisher();
+ p.setAuthorizedName("my-publisher");
+ p.setPublisherName("My Publisher");
+
+ // Adding the publisher to the "save" structure, using the 'root'
user authentication info and saving away.
+ SavePublisher sp = new SavePublisher();
+ sp.getPublisher().add(p);
+ sp.setAuthInfo(rootAuthToken.getAuthInfo());
+ juddiApi.savePublisher(sp);
+ //END: Note, this step is optional and only applies to jUDDI UDDI
Servers
+
+ // Our publisher is now saved, so now we want to retrieve its
authentication token
+ GetAuthToken getAuthTokenMyPub = new GetAuthToken();
+ getAuthTokenMyPub.setUserID("my-publisher");
+ getAuthTokenMyPub.setCred("");
+ AuthToken myPubAuthToken =
security.getAuthToken(getAuthTokenMyPub);
+ System.out.println("myPub AUTHTOKEN = " + "******* never log auth
tokens!");
+
+ // Creating the parent business entity that will contain our
service.
+ BusinessEntity myBusEntity = new BusinessEntity();
+ Name myBusName = new Name();
+ myBusName.setValue("My Business");
+ myBusEntity.getName().add(myBusName);
+
+ // Adding the business entity to the "save" structure, using our
publisher's authentication info and saving away.
+ SaveBusiness sb = new SaveBusiness();
+ sb.getBusinessEntity().add(myBusEntity);
+ sb.setAuthInfo(myPubAuthToken.getAuthInfo());
+ BusinessDetail bd = publish.saveBusiness(sb);
+ String myBusKey = bd.getBusinessEntity().get(0).getBusinessKey();
+ System.out.println("myBusiness key: " + myBusKey);
+
+ // Creating a service to save. Only adding the minimum data: the
parent business key retrieved from saving the business
+ // above and a single name.
+ BusinessService myService = new BusinessService();
+ myService.setBusinessKey(myBusKey);
+ Name myServName = new Name();
+ myServName.setValue("My Service");
+ myService.getName().add(myServName);
+
+ // Add binding templates, etc...
+ BindingTemplate myBindingTemplate = new BindingTemplate();
+ AccessPoint accessPoint = new AccessPoint();
+ accessPoint.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
+ accessPoint.setValue("http://example.org/services/myservice?wsdl");
+ myBindingTemplate.setAccessPoint(accessPoint);
+ BindingTemplates myBindingTemplates = new BindingTemplates();
+ myBindingTemplates.getBindingTemplate().add(myBindingTemplate);
+ myService.setBindingTemplates(myBindingTemplates);
+
+ // Adding the service to the "save" structure, using our
publisher's authentication info and saving away.
+ SaveService ss = new SaveService();
+ ss.getBusinessService().add(myService);
+ ss.setAuthInfo(myPubAuthToken.getAuthInfo());
+ ServiceDetail sd = publish.saveService(ss);
+ String myServKey = sd.getBusinessService().get(0).getServiceKey();
+ System.out.println("myService key: " + myServKey);
+
+ // Now you have a publisher saved who in turn published a business
and service via
+ // the jUDDI API!
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String args[]) {
+ SimplePublish sp = new SimplePublish();
+ sp.publish();
+ }
}
Modified: juddi/trunk/uddi-ws/src/main/java/org/uddi/api_v3/OverviewURL.java
URL:
http://svn.apache.org/viewvc/juddi/trunk/uddi-ws/src/main/java/org/uddi/api_v3/OverviewURL.java?rev=1539913&r1=1539912&r2=1539913&view=diff
==============================================================================
--- juddi/trunk/uddi-ws/src/main/java/org/uddi/api_v3/OverviewURL.java
(original)
+++ juddi/trunk/uddi-ws/src/main/java/org/uddi/api_v3/OverviewURL.java Fri Nov
8 03:48:19 2013
@@ -14,8 +14,6 @@
* limitations under the License.
*
*/
-
-
package org.uddi.api_v3;
import java.io.Serializable;
@@ -27,12 +25,16 @@ import javax.xml.bind.annotation.XmlTran
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
-
/**
+ * The overviewURL appears as a child of the overviewDoc, which appears twice
in
+ * the UDDI information model, once with tModel element and once with
+ * tModelInstanceInfo element. There are two conventions established, "text"
and
+ * "wsdlInterface".
* <p>Java class for overviewURL complex type.
- *
- * <p>The following schema fragment specifies the expected content contained
within this class.
- *
+ *
+ * <p>The following schema fragment specifies the expected content contained
+ * within this class.
+ *
* <pre>
* <complexType name="overviewURL">
* <simpleContent>
@@ -42,28 +44,44 @@ import javax.xml.bind.annotation.XmlValu
* </simpleContent>
* </complexType>
* </pre>
- *
- *
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "overviewURL", propOrder = {
"value"
})
-public class OverviewURL implements Serializable{
- @XmlTransient
- private static final long serialVersionUID = 7142971435321837783L;
- @XmlValue
+public class OverviewURL implements Serializable {
+
+ /**
+ * default const
+ */
+ public OverviewURL() {
+ }
+
+ /**
+ * convenience const
+ *
+ * @param val
+ * @param type There are two conventions established, "text" and
+ * "wsdlInterface".
+ */
+ public OverviewURL(String val, String type) {
+ value = val;
+ useType = type;
+ }
+ @XmlTransient
+ private static final long serialVersionUID = 7142971435321837783L;
+ @XmlValue
protected String value;
@XmlAttribute
protected String useType;
/**
* Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
+ *
+ * @return possible object is {@link String }
+ *
*/
public String getValue() {
return value;
@@ -71,23 +89,20 @@ public class OverviewURL implements Seri
/**
* Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
+ *
+ * @param value allowed object is {@link String }
+ *
*/
public void setValue(String value) {
this.value = value;
}
/**
- * Gets the value of the useType property.
- *
- * @return
- * possible object is
- * {@link String }
- *
+ * Gets the value of the useType property. There are two conventions
+ * established, "text" and "wsdlInterface".
+ *
+ * @return possible object is {@link String }
+ *
*/
public String getUseType() {
if (useType == null) {
@@ -99,15 +114,13 @@ public class OverviewURL implements Seri
/**
* Sets the value of the useType property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
+ *
+ * @param value allowed object is {@link String } There are two conventions
+ * established, "text" and "wsdlInterface".
+ *
*/
public void setUseType(String value) {
this.useType = value;
}
-
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]