http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-core/src/main/java/org/apache/juddi/rmi/JUDDIApiService.java ---------------------------------------------------------------------- diff --git a/juddi-core/src/main/java/org/apache/juddi/rmi/JUDDIApiService.java b/juddi-core/src/main/java/org/apache/juddi/rmi/JUDDIApiService.java index 00081e9..1a922c4 100644 --- a/juddi-core/src/main/java/org/apache/juddi/rmi/JUDDIApiService.java +++ b/juddi-core/src/main/java/org/apache/juddi/rmi/JUDDIApiService.java @@ -34,6 +34,8 @@ import org.apache.juddi.api_v3.DeletePublisher; import org.apache.juddi.api_v3.GetAllPublisherDetail; import org.apache.juddi.api_v3.GetEntityHistoryMessageRequest; import org.apache.juddi.api_v3.GetEntityHistoryMessageResponse; +import org.apache.juddi.api_v3.GetFailedReplicationChangeRecordsMessageRequest; +import org.apache.juddi.api_v3.GetFailedReplicationChangeRecordsMessageResponse; import org.apache.juddi.api_v3.GetPublisherDetail; import org.apache.juddi.api_v3.NodeDetail; import org.apache.juddi.api_v3.NodeList; @@ -181,6 +183,11 @@ public class JUDDIApiService extends UnicastRemoteObject implements JUDDIApiPort } + @Override + public GetFailedReplicationChangeRecordsMessageResponse getFailedReplicationChangeRecords(GetFailedReplicationChangeRecordsMessageRequest body) throws DispositionReportFaultMessage,RemoteException { + return juddiAPI.getFailedReplicationChangeRecords(body); + } +
http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-core/src/test/java/org/apache/juddi/api/impl/API_160_ReplicationTest.java ---------------------------------------------------------------------- diff --git a/juddi-core/src/test/java/org/apache/juddi/api/impl/API_160_ReplicationTest.java b/juddi-core/src/test/java/org/apache/juddi/api/impl/API_160_ReplicationTest.java index 298cf5d..1d8b3c2 100644 --- a/juddi-core/src/test/java/org/apache/juddi/api/impl/API_160_ReplicationTest.java +++ b/juddi-core/src/test/java/org/apache/juddi/api/impl/API_160_ReplicationTest.java @@ -401,4 +401,6 @@ public class API_160_ReplicationTest { Assert.assertNotNull(replicationNodes.getRegistryContact().getContact().getPersonName().get(0)); } + + //alter a binding, service, business, tmodel that isn't owned by the initiator } http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-core/src/test/java/org/apache/juddi/api/runtime/juddiTestimpl.java ---------------------------------------------------------------------- diff --git a/juddi-core/src/test/java/org/apache/juddi/api/runtime/juddiTestimpl.java b/juddi-core/src/test/java/org/apache/juddi/api/runtime/juddiTestimpl.java index dc677ed..9032d34 100644 --- a/juddi-core/src/test/java/org/apache/juddi/api/runtime/juddiTestimpl.java +++ b/juddi-core/src/test/java/org/apache/juddi/api/runtime/juddiTestimpl.java @@ -31,6 +31,8 @@ import org.apache.juddi.api_v3.DeletePublisher; import org.apache.juddi.api_v3.GetAllPublisherDetail; import org.apache.juddi.api_v3.GetEntityHistoryMessageRequest; import org.apache.juddi.api_v3.GetEntityHistoryMessageResponse; +import org.apache.juddi.api_v3.GetFailedReplicationChangeRecordsMessageRequest; +import org.apache.juddi.api_v3.GetFailedReplicationChangeRecordsMessageResponse; import org.apache.juddi.api_v3.GetPublisherDetail; import org.apache.juddi.api_v3.NodeDetail; import org.apache.juddi.api_v3.NodeList; @@ -192,5 +194,11 @@ public class juddiTestimpl implements JUDDIApiPortType { CLIServerTest.sink = true; return null; } + + @Override + public GetFailedReplicationChangeRecordsMessageResponse getFailedReplicationChangeRecords(GetFailedReplicationChangeRecordsMessageRequest body) throws DispositionReportFaultMessage,RemoteException { + CLIServerTest.sink = true; + return null; + } } http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-examples/more-uddi-samples/pom.xml ---------------------------------------------------------------------- diff --git a/juddi-examples/more-uddi-samples/pom.xml b/juddi-examples/more-uddi-samples/pom.xml index 6e7b239..27efbb3 100644 --- a/juddi-examples/more-uddi-samples/pom.xml +++ b/juddi-examples/more-uddi-samples/pom.xml @@ -1,109 +1,115 @@ <?xml version="1.0"?> <!-- - * Copyright 2001-2009 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. - * - */ --> +* Copyright 2001-2009 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. +* +*/ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.juddi.example</groupId> - <artifactId>juddi-examples</artifactId> - <version>3.3.0-SNAPSHOT</version> - </parent> - <groupId>org.apache.juddi</groupId> - <artifactId>juddi-more-samples</artifactId> - <version>3.3.0-SNAPSHOT</version> - <name>jUDDI Even More Examples and Samples</name> - <url>http://maven.apache.org</url> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>juddi-client</artifactId> - <version>${project.parent.version}</version> - </dependency> - <!-- a lorem ipsum generator MIT license--> - <dependency> - <groupId>de.sven-jacobs</groupId> - <artifactId>loremipsum</artifactId> - <version>1.0</version> - </dependency> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.juddi.example</groupId> + <artifactId>juddi-examples</artifactId> + <version>3.3.0-SNAPSHOT</version> + </parent> + <groupId>org.apache.juddi</groupId> + <artifactId>juddi-more-samples</artifactId> + <version>3.3.0-SNAPSHOT</version> + <name>jUDDI Even More Examples and Samples</name> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>juddi-client</artifactId> + <version>${project.parent.version}</version> + </dependency> + <!-- a lorem ipsum generator MIT license--> + <dependency> + <groupId>de.sven-jacobs</groupId> + <artifactId>loremipsum</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>1.2</version> + </dependency> + - </dependencies> - <build> - <plugins> - <!-- examples are not very useful from a maven repo, so don't put it there --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - </build> - <profiles> - <profile> - <id>default</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>interactive</id> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>exec-maven-plugin</artifactId> - <version>1.1.1</version> - <executions> - <execution> - <phase>test</phase> - <goals> - <goal>java</goal> - </goals> - <configuration> - <mainClass>org.apache.juddi.samples.EntryPoint</mainClass> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> + </dependencies> + <build> + <plugins> + <!-- examples are not very useful from a maven repo, so don't put it there --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + <profiles> + <profile> + <id>default</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>interactive</id> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.1.1</version> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.apache.juddi.samples.EntryPoint</mainClass> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project> http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/CompareByTModelInstanceInfoQOS.java ---------------------------------------------------------------------- diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/CompareByTModelInstanceInfoQOS.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/CompareByTModelInstanceInfoQOS.java index e19ae04..de8b0d7 100644 --- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/CompareByTModelInstanceInfoQOS.java +++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/CompareByTModelInstanceInfoQOS.java @@ -37,7 +37,7 @@ import org.uddi.api_v3.TModelInstanceDetails; import org.uddi.api_v3.TModelInstanceInfo; /** - * + * doesn't make changes to a remote server, just creates a few businesses and compares the two by qos parameters * @author Alex O'Ree */ public class CompareByTModelInstanceInfoQOS { http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoint.java ---------------------------------------------------------------------- diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoint.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoint.java index fb7700b..459071f 100644 --- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoint.java +++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoint.java @@ -17,7 +17,6 @@ package org.apache.juddi.samples; import java.util.List; import org.apache.juddi.api_v3.Node; -import static org.apache.juddi.samples.JuddiAdminService.clerkManager; import org.apache.juddi.v3.client.config.UDDIClient; import org.apache.juddi.v3.client.config.UDDINode; import org.apache.juddi.v3.client.transport.Transport; @@ -32,446 +31,62 @@ import org.uddi.v3_service.UDDISecurityPortType; public class EntryPoint { public static void main(String[] args) throws Exception { + + //first menu + //connect to a node and do work on it + //multinode String input = null; do { System.out.println("____________________________"); - System.out.println("Interactive Samples for UDDI"); + System.out.println("jUDDI Interactive Command Line Interface"); System.out.println("____________________________"); - System.out.println(" 1) Login (get an auth token)"); - System.out.println(" 2) Compare Two Binding/tModelInstanceInfo - QOS Example"); - System.out.println(" 3) jUDDI Admin service - Register a Node (quick add of the jUDDI cloud server)"); - System.out.println(" 4) Find Binding by QOS Parameters (Binding/tModelInstanceInfo)"); - System.out.println(" 4.4) Find Business by QOS Parameters (Binding/tModelInstanceInfo)"); - System.out.println(" 5) Find Service by QOS Parameters (Binding/tModelInstanceInfo)"); - System.out.println(" 6) UDDI Create Bulk (makes N business/services"); - System.out.println(" 7) UDDI Custody Transfer (within a single node)"); - System.out.println(" 8) UDDI Digital Signatures - Sign a Business"); - System.out.println(" 9) UDDI Digital Signatures - Sign a Service"); - System.out.println("10) UDDI Digital Signatures - Sign a tModel"); - System.out.println("11) UDDI Digital Signatures - Search for Signed Items"); - System.out.println("12) Find a Binding, lists all bindings for all services"); - System.out.println("13) Find Endpoints of a service (given the key)"); - System.out.println("14) Get the details of a service"); - System.out.println("15) Make a Key Generator tModel"); - System.out.println("16) Create a Business Relationship Between two users and two Businesses"); - System.out.println("17) Subscriptions - Asynchronous, listens for all changes"); - System.out.println("18) Subscriptions - Synchronous"); - System.out.println("19) WSDL2UDDI - Register a service from a WSDL document"); - System.out.println("20) WADL2UDDI - Register a service from a WADL document"); - System.out.println("21) Logout (discard auth token)"); - System.out.println("22) Print auth token"); - System.out.println("23) Print Subscriptions"); - System.out.println("24) Delete a subscription"); - System.out.println("25) Delete all subscriptions"); - System.out.println("26) Subscriptions - Asynchronous, publisher assertion subscriptions"); - System.out.println("27) Replication - do_ping"); - System.out.println("28) Replication - get high watermarks"); - System.out.println("29) Replication - get change records"); - System.out.println("30) Replication - Setup replication between two nodes"); - System.out.println("31) Quick add the jUDDI cloud node to *this's configuration file"); - System.out.println("32) Add a node to *this's configuration file"); - System.out.println("33) Register a *this node to a jUDDI server"); - System.out.println("34) View all registered remote nodes on a jUDDI server"); - System.out.println("35) View all registered nodes for this client"); - System.out.println("36) UnRegister a node on a jUDDI server"); - System.out.println("37) Fetch the replication config from a jUDDI server"); - System.out.println("38) Set the replication config on a remote jUDDI server"); - System.out.println("magic) Sets the replication between two instances of jUDDI on 8080 and 8090"); - System.out.println("rep) Prints the current replication status of a given node"); - System.out.println("39) Digitally sign a UDDI entity from a file."); - - System.out.println("q) quit"); - System.out.print("Selection: "); + System.out.println(" 1) Connect and login to a Node"); + System.out.println(" 2) Multinode and Replication commands"); + System.out.println(" 3) Offline code examples"); + System.out.println(" q) Quit/exit"); + System.out.print("jUDDI Main# "); input = System.console().readLine(); - try { - processInput(input); - } catch (Exception ex) { - ex.printStackTrace(); + if ("1".equals(input)) { + goSingleNode(); + } else if ("2".equals(input)) { + goMultiNode(); + } else if ("3".equals(input)) { + goOfflineExamples(); } - } while (!input.equalsIgnoreCase("q")); + } while (!"q".equalsIgnoreCase(input)); } - private static String authtoken = null; - - private static void processInput(String input) throws Exception { - if (input == null) { - return; - } - if (input.equals("1")) { - UDDISecurityPortType security = null; - UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); - System.out.println(); - System.out.println("Select a node (from *this config)"); - for (int i = 0; i < uddiNodeList.size(); i++) { - System.out.print(i + 1); - System.out.println(") " + uddiNodeList.get(i).getName() + uddiNodeList.get(i).getDescription()); - } - System.out.println("Node #: "); - int index = Integer.parseInt(System.console().readLine()) - 1; - String node = uddiNodeList.get(index).getName(); - Transport transport = clerkManager.getTransport(node); - security = transport.getUDDISecurityService(); - System.out.print("username: "); - String uname = System.console().readLine(); - char passwordArray[] = System.console().readPassword("password: "); - GetAuthToken getAuthTokenRoot = new GetAuthToken(); - getAuthTokenRoot.setUserID(uname); - getAuthTokenRoot.setCred(new String(passwordArray)); - authtoken = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); - System.out.println("Success!"); - } - if (input.equals("2")) { - CompareByTModelInstanceInfoQOS.main(null); - } - if (input.equals("3")) { - new JuddiAdminService().quickRegisterRemoteCloud(authtoken); - } - if (input.equals("4")) { - SearchByQos.doFindBinding(authtoken); - } - if (input.equals("4.5")) { - SearchByQos.doFindBusiness(authtoken); - } - if (input.equals("5")) { - SearchByQos.doFindService(authtoken); - } - if (input.equals("6")) { - System.out.print("businesses: "); - int biz = Integer.parseInt(System.console().readLine()); - System.out.print("servicesPerBusiness: "); - int svc = Integer.parseInt(System.console().readLine()); - new UddiCreatebulk("default").publishBusiness(authtoken, biz, svc); - } - if (input.equals("7")) { - UDDISecurityPortType security = null; - UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - Transport transport = clerkManager.getTransport(); - security = transport.getUDDISecurityService(); - - System.out.print("Transfer from username: "); - String uname = (System.console().readLine()); - char passwordArray[] = System.console().readPassword("password: "); - GetAuthToken getAuthTokenRoot = new GetAuthToken(); - getAuthTokenRoot.setUserID(uname); - getAuthTokenRoot.setCred(new String(passwordArray)); - String authtokenFrom = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); - System.out.println("Success!"); - - System.out.print("Transfer to username: "); - String uname2 = (System.console().readLine()); - char passwordArray2[] = System.console().readPassword("password: "); - getAuthTokenRoot = new GetAuthToken(); - getAuthTokenRoot.setUserID(uname2); - getAuthTokenRoot.setCred(new String(passwordArray2)); - String authtokenFrom2 = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); - System.out.println("Success!"); - System.out.print("business/tModel key to transfer: "); - String key = (System.console().readLine()); - new UddiCustodyTransfer().TransferBusiness(uname, authtokenFrom, uname2, authtokenFrom2, key); - } - if (input.equals("8")) { - System.out.print("Business key to sign: "); - String key = (System.console().readLine()); - new UddiDigitalSignatureBusiness().Fire(authtoken, key); - } - if (input.equals("9")) { - System.out.print("Service key to sign: "); - String key = (System.console().readLine()); - new UddiDigitalSignatureService().Fire(authtoken, key); - } - if (input.equals("10")) { - System.out.print("tModel key to sign: "); - String key = (System.console().readLine()); - new UddiDigitalSignatureTmodel().Fire(authtoken, key); - } - if (input.equals("11")) { - new UddiDigitalSignatureSearch().Fire(authtoken); - } - if (input.equals("12")) { - new UddiFindBinding().Fire(authtoken); - } - if (input.equals("13")) { - System.out.print("Service key to parse the endpoints: "); - String key = (System.console().readLine()); - new UddiFindEndpoints().Fire(authtoken, key); - } - if (input.equals("14")) { - System.out.print("Service key: "); - String key = (System.console().readLine()); - new UddiGetServiceDetails().Fire(authtoken, key); - } - if (input.equals("15")) { - System.out.print("Get FQDN: "); - String key = (System.console().readLine()); - new UddiKeyGenerator().Fire(authtoken, key); - } - if (input.equals("16")) { - UDDISecurityPortType security = null; - UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - Transport transport = clerkManager.getTransport(); - security = transport.getUDDISecurityService(); - - System.out.print("1st Business username: "); - String uname = (System.console().readLine()); - char passwordArray[] = System.console().readPassword("password: "); - GetAuthToken getAuthTokenRoot = new GetAuthToken(); - getAuthTokenRoot.setUserID(uname); - getAuthTokenRoot.setCred(new String(passwordArray)); - String authtokenFrom = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); - System.out.println("Success!"); - - System.out.print(uname + "'s business : "); - String key = (System.console().readLine()); - - System.out.print("2st Business username: "); - String uname2 = (System.console().readLine()); - char passwordArray2[] = System.console().readPassword("password: "); - getAuthTokenRoot = new GetAuthToken(); - getAuthTokenRoot.setUserID(uname2); - getAuthTokenRoot.setCred(new String(passwordArray2)); - String authtokenFrom2 = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); - System.out.println("Success!"); - - System.out.print(uname2 + "'s business : "); - String key2 = (System.console().readLine()); - - System.out.print("relationship (parent-child, peer-peer,or identity) : "); - String relationship = (System.console().readLine()); - new UddiRelatedBusinesses().Fire(key, authtokenFrom, key2, authtokenFrom2, relationship); - } - if (input.equals("17")) { - new UddiSubscribe().Fire(); - - } - if (input.equals("18")) { - System.out.print("Subscription key: "); - String key = (System.console().readLine()); - System.out.println("Fetching results for the past 30 days..."); - new UddiSubscribeValidate().go(authtoken, input); - } - - if (input.equals("19")) { - System.out.print("Path or URL to WSDL file: "); - String url = (System.console().readLine()); - System.out.print("Business key to attach to: "); - String key = (System.console().readLine()); - new WsdlImport().Fire(url, key, authtoken); - } - if (input.equals("20")) { - System.out.print("Path or URL to WADL file: "); - String url = (System.console().readLine()); - System.out.print("Business key to attach to: "); - String key = (System.console().readLine()); - new WadlImport().Fire(url, key, authtoken); - } - if (input.equals("21")) { - UDDISecurityPortType security = null; - UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - Transport transport = clerkManager.getTransport(); - security = transport.getUDDISecurityService(); - - DiscardAuthToken getAuthTokenRoot = new DiscardAuthToken(); - getAuthTokenRoot.setAuthInfo(authtoken); - security.discardAuthToken(getAuthTokenRoot); - System.out.println("Success!"); - } - - if (input.equals("22")) { - System.out.println("Token info: " + authtoken); - } - if (input.equals("23")) { - new UddiSubscriptionManagement().PrintSubscriptions(authtoken); - } - if (input.equals("24")) { - System.out.print("Subscription key: "); - String key2 = (System.console().readLine()); - new UddiSubscriptionManagement().DeleteSubscription(authtoken, key2); - } - if (input.equals("25")) { - new UddiSubscriptionManagement().DeleteAllSubscriptions(authtoken); - } - if (input.equals("26")) { - new UddiSubscribeAssertionStatus().Fire(); - - } - if (input.equals("27")) { - //System.out.println("27) Replication - do_ping"); - System.out.print("URL: "); - String key2 = (System.console().readLine()); - new UddiReplication().DoPing(key2); - - } - if (input.equals("28")) { - //System.out.println("28) Replication - get high watermarks"); - System.out.print("URL: "); - String key2 = (System.console().readLine()); - new UddiReplication().GetHighWatermarks(key2); - - } - if (input.equals("29")) { - //System.out.println("29) Replication - get change records"); - System.out.print("URL: "); - String key2 = (System.console().readLine()); - - System.out.print("Change ID to fetch: "); - String id = (System.console().readLine()); - - System.out.print("Node id of something in the replication graph: "); - String src = (System.console().readLine()); - - new UddiReplication().GetChangeRecords(key2, Long.parseLong(id),src); - - } - if (input.equals("30")) { - // System.out.println("30) Replication - Setup replication between two nodes"); - new JuddiAdminService().setupReplication(); - - } - if (input.equals("31")) { - //System.out.println("31) Quick add the jUDDI cloud node to *this's configuration file"); - new JuddiAdminService().quickRegisterLocalCloud(); - } - if (input.equals("32")) { - // System.out.println("32) Add a node to *this's configuration file"); - UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - UDDINode node = new UDDINode(); - System.out.print("Name (must be unique: "); - node.setClientName(System.console().readLine()); - node.setName(node.getClientName()); - System.out.print("Description: "); - node.setDescription(System.console().readLine()); - - node.setHomeJUDDI(false); - System.out.print("Inquiry URL: "); - node.setInquiryUrl(System.console().readLine()); - - System.out.print("Inquiry REST URL (optional): "); - node.setInquiryRESTUrl(System.console().readLine()); - - System.out.print("jUDDI API URL (optional): "); - node.setJuddiApiUrl(System.console().readLine()); - System.out.print("Custody Transfer URL: "); - node.setCustodyTransferUrl(System.console().readLine()); - System.out.print("Publish URL: "); - node.setPublishUrl(System.console().readLine()); - System.out.print("Replication URL: "); - node.setReplicationUrl(System.console().readLine()); - System.out.print("Security URL: "); - node.setSecurityUrl(System.console().readLine()); - System.out.print("Subscription URL: "); - node.setSubscriptionUrl(System.console().readLine()); - - System.out.print("Subscription Listener URL: "); - node.setSubscriptionListenerUrl(System.console().readLine()); - - System.out.print("Transport (defaults to JAXWS): "); - node.setProxyTransport(System.console().readLine()); - if (node.getProxyTransport() == null || node.getProxyTransport().trim().equalsIgnoreCase("")) { - node.setProxyTransport(org.apache.juddi.v3.client.transport.JAXWSTransport.class.getCanonicalName()); - } - System.out.print("Factory Initial (optional): "); - node.setFactoryInitial(System.console().readLine()); - System.out.print("Factory Naming Provider (optional): "); - node.setFactoryNamingProvider(System.console().readLine()); - System.out.print("Factory URL Packages (optional): "); - node.setFactoryURLPkgs(System.console().readLine()); - - clerkManager.getClientConfig().addUDDINode(node); - clerkManager.getClientConfig().saveConfig(); - System.out.println("Saved."); - } - if (input.equals("33")) { - - //System.out.println("32) Register a *this node to a jUDDI server"); - UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); - System.out.println(); - - System.out.println("Locally defined nodes:"); - for (int i = 0; i < uddiNodeList.size(); i++) { - System.out.println("________________________________________________________________________________"); - System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName()); - System.out.println((i + 1) + ") Node description: " + uddiNodeList.get(i).getDescription()); - System.out.println((i + 1) + ") Transport: " + uddiNodeList.get(i).getProxyTransport()); - System.out.println((i + 1) + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl()); - } - System.out.println("Local Source Node: "); - int index = Integer.parseInt(System.console().readLine()) - 1; - - System.out.println("Remote Destination(s):"); - for (int i = 0; i < uddiNodeList.size(); i++) { - System.out.println("________________________________________________________________________________"); - System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName()); - System.out.println((i + 1) + ") Node description: " + uddiNodeList.get(i).getDescription()); - System.out.println((i + 1) + ") Transport: " + uddiNodeList.get(i).getProxyTransport()); - System.out.println((i + 1) + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl()); - } - System.out.println("Remote Destination Node to publish to: "); - int index2 = Integer.parseInt(System.console().readLine()) - 1; - - new JuddiAdminService().registerLocalNodeToRemoteNode(authtoken, uddiNodeList.get(index), uddiNodeList.get(index2)); + static void goMultiNode() throws Exception { + EntryPoitMultiNode.goMultiNode(); + } - } - if (input.equals("34")) { + static void goSingleNode() throws Exception { + EntryPointSingleNode.goSingleNode(); - // System.out.println("33) View all register remote nodes on a jUDDI server"); - new JuddiAdminService().viewRemoteNodes(authtoken); - } + } - if (input.equals("35")) { - UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); - for (int i = 0; i < uddiNodeList.size(); i++) { - System.out.println("________________________________________________________________________________"); - System.out.println("Client name: " + uddiNodeList.get(i).getClientName()); - System.out.println("Node name: " + uddiNodeList.get(i).getName()); - System.out.println("Node description: " + uddiNodeList.get(i).getDescription()); - System.out.println("Transport: " + uddiNodeList.get(i).getProxyTransport()); - System.out.println(i + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl()); + private static void goOfflineExamples() throws Exception { + String input = null; + do { + System.out.println("____________________________"); + System.out.println("Offline/Code Examples (you'll want to look at the source for some of these"); + System.out.println("____________________________"); + System.out.println(" 1) Compare Two Binding/tModelInstanceInfo - QOS Code Example"); + System.out.println("2) Digitally sign a UDDI entity from a file."); + System.out.println(" q) Quit/exit"); - } + processOffline(input); + } while (!"q".equalsIgnoreCase(input)); - } - if (input.equals("36")) { - - new JuddiAdminService().viewRemoveRemoteNode(authtoken); - //System.out.println("35) UnRegister a node on a jUDDI server"); - } - if (input.equals("37")) { - new JuddiAdminService().viewReplicationConfig(authtoken); - } - if (input.equals("38")) { - new JuddiAdminService().setReplicationConfig(authtoken); - } - if (input.equals("magic")) { - //secret menu, setups up replication between juddi8080 and 9080 and adds a record or two on 8080 - //UDDISecurityPortType security = null; - //UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); - - /* Transport transport = clerkManager.getTransport("default"); - security = transport.getUDDISecurityService(); - - String uname = "root"; - - GetAuthToken getAuthTokenRoot = new GetAuthToken(); - getAuthTokenRoot.setUserID(uname); - getAuthTokenRoot.setCred("root"); - authtoken = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); - System.out.println("Success!");*/ - - //this setups up a replication config between the two nodes - new JuddiAdminService().autoMagic(); + } - new UddiCreatebulk("default").publishBusiness(null, 1, 1); - new UddiCreatebulk("uddi:another.juddi.apache.org:node2").publishBusiness(null, 1, 1); - } - if (input.equals("rep")) { - new JuddiAdminService().printStatus(); + private static void processOffline(String input) throws Exception { + if (input.equals("1")) { + CompareByTModelInstanceInfoQOS.main(null); } - if (input.equals("39")) { + if (input.equals("2")) { new UddiDigitalSignatureFile().Fire(null, null, null); } - } + } http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPointSingleNode.java ---------------------------------------------------------------------- diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPointSingleNode.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPointSingleNode.java new file mode 100644 index 0000000..1149302 --- /dev/null +++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPointSingleNode.java @@ -0,0 +1,471 @@ +/* + * Copyright 2015 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.samples; + +import java.util.List; +import org.apache.juddi.api_v3.Node; +import org.apache.juddi.v3.client.config.UDDIClient; +import org.apache.juddi.v3.client.config.UDDINode; +import org.apache.juddi.v3.client.transport.Transport; +import org.uddi.api_v3.DiscardAuthToken; +import org.uddi.api_v3.GetAuthToken; +import org.uddi.v3_service.UDDISecurityPortType; + +/** + * + * @author alex + */ +public class EntryPointSingleNode { + + static void goSingleNode() throws Exception { + String currentNode = "default"; + UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); + + List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); + System.out.println(); + + System.out.println("Nodes:"); + for (int i = 0; i < uddiNodeList.size(); i++) { + System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName()); + } + System.out.println("Destination Node: "); + int index = Integer.parseInt(System.console().readLine()) - 1; + + currentNode = uddiNodeList.get(index).getName(); + Transport transport = clerkManager.getTransport(currentNode); + authtoken = login(currentNode, transport); + String input = null; + do { + System.out.println(" 1) Login"); + System.out.println(" 2) Print auth token"); + System.out.println(" 3) Logout (discard auth token)"); + + + System.out.println(" 4) Find Binding by QOS Parameters (Binding/tModelInstanceInfo)"); + System.out.println(" 5) Find Business by QOS Parameters (Binding/tModelInstanceInfo)"); + System.out.println(" 6) Find Service by QOS Parameters (Binding/tModelInstanceInfo)"); + System.out.println(" 7) UDDI Create Bulk (makes N business/services"); + + System.out.println(" 8) UDDI Custody Transfer (within a single node)"); + System.out.println(" 9) UDDI Digital Signatures - Sign a Business"); + System.out.println("10) UDDI Digital Signatures - Sign a Service"); + System.out.println("11) UDDI Digital Signatures - Sign a tModel"); + System.out.println("12) UDDI Digital Signatures - Search for Signed Items"); + System.out.println("13) Find a Binding, lists all bindings for all services"); + System.out.println("14) Find Endpoints of a service (given the key)"); + System.out.println("15) Get the details of a service"); + System.out.println("16) Make a Key Generator tModel"); + System.out.println("17) Create a Business Relationship Between two users and two Businesses(Publisher Assertion)"); + System.out.println("18) Subscriptions - Asynchronous, listens for all changes"); + System.out.println("19) Subscriptions - Synchronous"); + System.out.println("20) WSDL2UDDI - Register a service from a WSDL document"); + System.out.println("21) WADL2UDDI - Register a service from a WADL document"); + + + System.out.println("22) Print Subscriptions"); + System.out.println("23) Delete a subscription"); + System.out.println("24) Delete all subscriptions"); + System.out.println("25) Subscriptions - Asynchronous, publisher assertion subscriptions"); + System.out.println("26) Replication - do_ping"); + System.out.println("27) Replication - get high watermarks"); + System.out.println("28) Replication - get change records"); + System.out.println("29) Replication - get failed change records (jUDDI only)"); + + //local config management + System.out.println("31) Quick add the jUDDI cloud node to *this's configuration file"); + System.out.println("32) Add a node to *this's configuration file"); + System.out.println("35) View all registered nodes for this client"); + + //remote config management - juddi only + System.out.println("33) Register a *this node to a jUDDI server"); + System.out.println("34) View all registered remote nodes on a jUDDI server"); + System.out.println("35) UnRegister a node on a jUDDI server"); + + //juddi only + System.out.println("37) View the replication config from the current jUDDI server"); + System.out.println("38) Set the replication config on a remote jUDDI server"); + System.out.println("39) Prints the current replication status of a given node"); + // System.out.println(" 3) jUDDI Admin service - Register a Node (quick add of the jUDDI cloud server)"); + + System.out.println("q) quit"); + System.out.print(currentNode + "# "); + input = System.console().readLine(); + try { + processInput(input,currentNode, transport,clerkManager); + } catch (Exception ex) { + ex.printStackTrace(); + } + } while (!input.equalsIgnoreCase("q")); + } + private static String authtoken = null; + + private static String login(String currentNode, Transport transport) throws Exception { + System.out.println("Options:"); + System.out.println("1) Enter a username/password for auth token"); + System.out.println("2) Enter a username/password for HTTP based logins"); + System.out.println("3) Enter a username/password for use stored credentials"); + String input = System.console().readLine(); + if ("1".equalsIgnoreCase(input)) { + UDDISecurityPortType security = null; + security = transport.getUDDISecurityService(); + System.out.print(currentNode + "# username: "); + String uname = System.console().readLine(); + char passwordArray[] = System.console().readPassword(currentNode + "# password: "); + GetAuthToken getAuthTokenRoot = new GetAuthToken(); + getAuthTokenRoot.setUserID(uname); + getAuthTokenRoot.setCred(new String(passwordArray)); + String lauthtoken = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); + System.out.println("Success!"); + return lauthtoken; + } else if ("2".equalsIgnoreCase(input)) { + + } else if ("3".equalsIgnoreCase(input)) { + } else { + System.out.println("Aborted!"); + } + return null; + + } + + private static void processInput(String input,String currentNode, Transport transport, UDDIClient client) throws Exception { + if (input == null) { + return; + } + if (input.equals("1")) { + login(currentNode, transport); + } + + + if (input.equals("2")) { + System.out.println("Token info: " + authtoken); + } + if (input.equals("3")) { + if (authtoken!=null){ + UDDISecurityPortType security = null; + security = transport.getUDDISecurityService(); + DiscardAuthToken getAuthTokenRoot = new DiscardAuthToken(); + getAuthTokenRoot.setAuthInfo(authtoken); + security.discardAuthToken(getAuthTokenRoot); + System.out.println("Success!");} + } + + if (input.equals("4")) { + SearchByQos.doFindBinding(authtoken); + } + if (input.equals("5")) { + SearchByQos.doFindBusiness(authtoken); + } + if (input.equals("6")) { + SearchByQos.doFindService(authtoken); + } + if (input.equals("7")) { + + System.out.print("businesses: "); + int biz = Integer.parseInt(System.console().readLine()); + System.out.print("servicesPerBusiness: "); + int svc = Integer.parseInt(System.console().readLine()); + new UddiCreatebulk(transport, false, currentNode).publishBusiness(authtoken, biz, svc); + } + if (input.equals("8")) { + UDDISecurityPortType security = null; + security = transport.getUDDISecurityService(); + + System.out.print("Transfer from username: "); + String uname = (System.console().readLine()); + char passwordArray[] = System.console().readPassword("password: "); + GetAuthToken getAuthTokenRoot = new GetAuthToken(); + getAuthTokenRoot.setUserID(uname); + getAuthTokenRoot.setCred(new String(passwordArray)); + String authtokenFrom = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); + System.out.println("Success!"); + + System.out.print("Transfer to username: "); + String uname2 = (System.console().readLine()); + char passwordArray2[] = System.console().readPassword("password: "); + getAuthTokenRoot = new GetAuthToken(); + getAuthTokenRoot.setUserID(uname2); + getAuthTokenRoot.setCred(new String(passwordArray2)); + String authtokenFrom2 = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); + System.out.println("Success!"); + System.out.print("business/tModel key to transfer: "); + String key = (System.console().readLine()); + new UddiCustodyTransfer().TransferBusiness(uname, authtokenFrom, uname2, authtokenFrom2, key); + } + if (input.equals("9")) { + System.out.print("Business key to sign: "); + String key = (System.console().readLine()); + new UddiDigitalSignatureBusiness().Fire(authtoken, key); + } + if (input.equals("10")) { + System.out.print("Service key to sign: "); + String key = (System.console().readLine()); + new UddiDigitalSignatureService().Fire(authtoken, key); + } + if (input.equals("11")) { + System.out.print("tModel key to sign: "); + String key = (System.console().readLine()); + new UddiDigitalSignatureTmodel().Fire(authtoken, key); + } + if (input.equals("12")) { + new UddiDigitalSignatureSearch().Fire(authtoken); + } + if (input.equals("13")) { + new UddiFindBinding().Fire(authtoken); + } + if (input.equals("14")) { + System.out.print("Service key to parse the endpoints: "); + String key = (System.console().readLine()); + new UddiFindEndpoints().Fire(authtoken, key); + } + if (input.equals("15")) { + System.out.print("Service key: "); + String key = (System.console().readLine()); + new UddiGetServiceDetails().Fire(authtoken, key); + } + if (input.equals("16")) { + System.out.print("Get FQDN: "); + String key = (System.console().readLine()); + new UddiKeyGenerator().Fire(authtoken, key); + } + if (input.equals("17")) { + UDDISecurityPortType security = null; + + security = transport.getUDDISecurityService(); + + System.out.print("1st Business username: "); + String uname = (System.console().readLine()); + char passwordArray[] = System.console().readPassword("password: "); + GetAuthToken getAuthTokenRoot = new GetAuthToken(); + getAuthTokenRoot.setUserID(uname); + getAuthTokenRoot.setCred(new String(passwordArray)); + String authtokenFrom = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); + System.out.println("Success!"); + + System.out.print(uname + "'s business : "); + String key = (System.console().readLine()); + + System.out.print("2st Business username: "); + String uname2 = (System.console().readLine()); + char passwordArray2[] = System.console().readPassword("password: "); + getAuthTokenRoot = new GetAuthToken(); + getAuthTokenRoot.setUserID(uname2); + getAuthTokenRoot.setCred(new String(passwordArray2)); + String authtokenFrom2 = security.getAuthToken(getAuthTokenRoot).getAuthInfo(); + System.out.println("Success!"); + + System.out.print(uname2 + "'s business : "); + String key2 = (System.console().readLine()); + + System.out.print("relationship (parent-child, peer-peer,or identity) : "); + String relationship = (System.console().readLine()); + new UddiRelatedBusinesses().Fire(key, authtokenFrom, key2, authtokenFrom2, relationship); + } + if (input.equals("18")) { + new UddiSubscribe(client, currentNode, transport).Fire(); + + } + if (input.equals("19")) { + System.out.print("Subscription key: "); + String key = (System.console().readLine()); + System.out.println("Fetching results for the past 30 days..."); + new UddiSubscribeValidate(transport).go(authtoken, input); + } + + if (input.equals("20")) { + System.out.print("Path or URL to WSDL file: "); + String url = (System.console().readLine()); + System.out.print("Business key to attach to: "); + String key = (System.console().readLine()); + new WsdlImport().Fire(url, key, authtoken, transport); + } + if (input.equals("21")) { + System.out.print("Path or URL to WADL file: "); + String url = (System.console().readLine()); + System.out.print("Business key to attach to: "); + String key = (System.console().readLine()); + new WadlImport().Fire(url, key, authtoken, transport); + } + + if (input.equals("22")) { + new UddiSubscriptionManagement(transport).PrintSubscriptions(authtoken); + } + if (input.equals("23")) { + System.out.print("Subscription key: "); + String key2 = (System.console().readLine()); + new UddiSubscriptionManagement(transport).DeleteSubscription(authtoken, key2); + } + if (input.equals("24")) { + new UddiSubscriptionManagement(transport).DeleteAllSubscriptions(authtoken); + } + if (input.equals("25")) { + new UddiSubscribeAssertionStatus(transport).Fire(currentNode); + + } + if (input.equals("26")) { + //System.out.println("27) Replication - do_ping"); + + new UddiReplication(client, currentNode).DoPing(); + + } + if (input.equals("27")) { + //System.out.println("28) Replication - get high watermarks"); + new UddiReplication(client, currentNode).GetHighWatermarks(); + + } + if (input.equals("28")) { + //System.out.println("29) Replication - get change records"); + + System.out.print("Change ID to fetch: "); + String id = (System.console().readLine()); + + System.out.print("Node id of something in the replication graph: "); + String src = (System.console().readLine()); + + new UddiReplication(client, currentNode).GetChangeRecords(Long.parseLong(id), src); + + } + if ("29".equals(input)){ + new JuddiAdminService(client, transport).dumpFailedReplicationRecords(authtoken); + } + if (input.equals("31")) { + + new JuddiAdminService(client, transport).quickRegisterRemoteCloud(authtoken); + } + if (input.equals("31")) { + //System.out.println("31) Quick add the jUDDI cloud node to *this's configuration file"); + new JuddiAdminService(client, transport).quickRegisterLocalCloud(); + } + if (input.equals("32")) { + // System.out.println("32) Add a node to *this's configuration file"); + UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); + UDDINode node = new UDDINode(); + System.out.print("Name (must be unique: "); + node.setClientName(System.console().readLine()); + node.setName(node.getClientName()); + System.out.print("Description: "); + node.setDescription(System.console().readLine()); + + node.setHomeJUDDI(false); + System.out.print("Inquiry URL: "); + node.setInquiryUrl(System.console().readLine()); + + System.out.print("Inquiry REST URL (optional): "); + node.setInquiryRESTUrl(System.console().readLine()); + + System.out.print("jUDDI API URL (optional): "); + node.setJuddiApiUrl(System.console().readLine()); + System.out.print("Custody Transfer URL: "); + node.setCustodyTransferUrl(System.console().readLine()); + System.out.print("Publish URL: "); + node.setPublishUrl(System.console().readLine()); + System.out.print("Replication URL: "); + node.setReplicationUrl(System.console().readLine()); + System.out.print("Security URL: "); + node.setSecurityUrl(System.console().readLine()); + System.out.print("Subscription URL: "); + node.setSubscriptionUrl(System.console().readLine()); + + System.out.print("Subscription Listener URL: "); + node.setSubscriptionListenerUrl(System.console().readLine()); + + System.out.print("Transport (defaults to JAXWS): "); + node.setProxyTransport(System.console().readLine()); + if (node.getProxyTransport() == null || node.getProxyTransport().trim().equalsIgnoreCase("")) { + node.setProxyTransport(org.apache.juddi.v3.client.transport.JAXWSTransport.class.getCanonicalName()); + } + System.out.print("Factory Initial (optional): "); + node.setFactoryInitial(System.console().readLine()); + System.out.print("Factory Naming Provider (optional): "); + node.setFactoryNamingProvider(System.console().readLine()); + System.out.print("Factory URL Packages (optional): "); + node.setFactoryURLPkgs(System.console().readLine()); + + clerkManager.getClientConfig().addUDDINode(node); + clerkManager.getClientConfig().saveConfig(); + System.out.println("Saved."); + } + if (input.equals("33")) { + + //System.out.println("32) Register a *this node to a jUDDI server"); + UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); + List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); + System.out.println(); + + System.out.println("Locally defined nodes:"); + for (int i = 0; i < uddiNodeList.size(); i++) { + System.out.println("________________________________________________________________________________"); + System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName()); + System.out.println((i + 1) + ") Node description: " + uddiNodeList.get(i).getDescription()); + System.out.println((i + 1) + ") Transport: " + uddiNodeList.get(i).getProxyTransport()); + System.out.println((i + 1) + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl()); + } + System.out.println("Local Source Node: "); + int index = Integer.parseInt(System.console().readLine()) - 1; + + System.out.println("Remote Destination(s):"); + for (int i = 0; i < uddiNodeList.size(); i++) { + System.out.println("________________________________________________________________________________"); + System.out.println((i + 1) + ") Node name: " + uddiNodeList.get(i).getName()); + System.out.println((i + 1) + ") Node description: " + uddiNodeList.get(i).getDescription()); + System.out.println((i + 1) + ") Transport: " + uddiNodeList.get(i).getProxyTransport()); + System.out.println((i + 1) + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl()); + } + System.out.println("Remote Destination Node to publish to: "); + int index2 = Integer.parseInt(System.console().readLine()) - 1; + + new JuddiAdminService(client, transport).registerLocalNodeToRemoteNode(authtoken, uddiNodeList.get(index), uddiNodeList.get(index2)); + + } + if (input.equals("34")) { + + // System.out.println("33) View all register remote nodes on a jUDDI server"); + new JuddiAdminService(client, transport).viewRemoteNodes(authtoken); + } + + /* if (input.equals("35")) { + UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); + List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); + for (int i = 0; i < uddiNodeList.size(); i++) { + System.out.println("________________________________________________________________________________"); + System.out.println("Client name: " + uddiNodeList.get(i).getClientName()); + System.out.println("Node name: " + uddiNodeList.get(i).getName()); + System.out.println("Node description: " + uddiNodeList.get(i).getDescription()); + System.out.println("Transport: " + uddiNodeList.get(i).getProxyTransport()); + System.out.println(i + ") jUDDI URL: " + uddiNodeList.get(i).getJuddiApiUrl()); + + } + + }*/ + if (input.equals("35")) { + + new JuddiAdminService(client, transport).viewRemoveRemoteNode(authtoken); + //System.out.println("35) UnRegister a node on a jUDDI server"); + } + if (input.equals("37")) { + new JuddiAdminService(client, transport).viewReplicationConfig(authtoken, currentNode); + } + if (input.equals("38")) { + new JuddiAdminService(client, transport).setReplicationConfig(authtoken); + } + + if (input.equals("39")) { + new JuddiAdminService(client, transport).printStatus(transport, authtoken); + } + + + } + +} http://git-wip-us.apache.org/repos/asf/juddi/blob/c0354a44/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoitMultiNode.java ---------------------------------------------------------------------- diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoitMultiNode.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoitMultiNode.java new file mode 100644 index 0000000..b017bb0 --- /dev/null +++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/EntryPoitMultiNode.java @@ -0,0 +1,81 @@ +/* + * Copyright 2015 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.samples; + +import java.util.List; +import org.apache.juddi.api_v3.Node; +import org.apache.juddi.v3.client.config.UDDIClient; +import org.apache.juddi.v3.client.transport.Transport; + +/** + * + * @author alex + */ +public class EntryPoitMultiNode { + + static void goMultiNode() throws Exception{ + String currentNode = "default"; + UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml"); + + List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); + String input=null; + do { + System.out.println("1) Replication - Setup replication between two nodes"); + + System.out.println("2) Sets the replication between two instances of jUDDI on 8080 and 9080"); + System.out.println("3) Sets directed replication between 3 instances of jUDDI on 8080 and 8080, 10080"); + System.out.println("4) Prints the replication status for all nodes"); + + + System.out.println("q) quit"); + System.out.print("Selection: "); + input = System.console().readLine(); + + processInput(input,clerkManager); + + } while (!input.equalsIgnoreCase("q")); + } + + private static void processInput(String input, UDDIClient clerkManager) throws Exception{ + if (input.equals("1")) { + // System.out.println("30) Replication - Setup replication between two nodes"); + new JuddiAdminService(null, null).setupReplication(); + + } + else if (input.equals("2")) { + + new JuddiAdminService(null, null).autoMagic(); + List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); + for (int i=0; i < uddiNodeList.size(); i++){ + new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1); + } + //new UddiCreatebulk("uddi:another.juddi.apache.org:node2").publishBusiness(null, 1, 1); + } + else if (input.equals("3")) { + new JuddiAdminService(clerkManager, null).autoMagicDirected(); + + List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); + for (int i=0; i < uddiNodeList.size(); i++){ + new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1); + } + } + else if (input.equals("4")) { + new JuddiAdminService(clerkManager, null).printStatus(); + } + + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
