Repository: juddi Updated Branches: refs/heads/master 4477b4cbd -> fa5c54f01
JUDDI-241 updating the CLI example to use only configuration based url's instead of hard coded ones Project: http://git-wip-us.apache.org/repos/asf/juddi/repo Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/fa5c54f0 Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/fa5c54f0 Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/fa5c54f0 Branch: refs/heads/master Commit: fa5c54f01ff9e738d6a086cad27914ac47b2a269 Parents: 4477b4c Author: Alex <[email protected]> Authored: Mon Feb 16 16:08:02 2015 -0500 Committer: Alex <[email protected]> Committed: Mon Feb 16 16:08:02 2015 -0500 ---------------------------------------------------------------------- .../juddi/samples/EntryPoitMultiNode.java | 46 ++++++------------ .../apache/juddi/samples/JuddiAdminService.java | 50 +++++++------------- 2 files changed, 31 insertions(+), 65 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/juddi/blob/fa5c54f0/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 index b73d2f5..84c0efa 100644 --- 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 @@ -43,15 +43,12 @@ public class EntryPoitMultiNode { 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 undirected replication two instances of jUDDI on 8080 and 9080"); - System.out.println("3) Sets undirected replication 3 instances of jUDDI on 8080 and 9080 and 10080"); - System.out.println("4) Sets directed replication between 3 instances of jUDDI on 8080 and 9080, 10080"); - System.out.println("5) Sets directed replication between 3 instances of jUDDI on 8443 and 9443, 10443 over two way ssl"); - System.out.println("6) Prints the replication status for all nodes"); - System.out.println("7) Prints the business, service, and tmodels counts"); - System.out.println("8) Ping all nodes"); + System.out.println("1) Sets undirected replication two instances of jUDDI"); + System.out.println("2) Sets undirected replication 3 instances of jUDDI"); + System.out.println("3) Sets directed replication between 3 instances of jUDDI"); + System.out.println("4) Prints the replication status for all nodes"); + System.out.println("5) Prints the business, service, and tmodels counts"); + System.out.println("6) Ping all nodes"); System.out.println("q) quit"); System.out.print("Selection: "); @@ -64,10 +61,6 @@ public class EntryPoitMultiNode { 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(clerkManager, null).setupReplication(); - - } else if (input.equals("2")) { new JuddiAdminService(clerkManager, null).autoMagic(); List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); @@ -75,8 +68,7 @@ public class EntryPoitMultiNode { new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1, "root@" + uddiNodeList.get(i).getName()); } //new UddiCreatebulk("uddi:another.juddi.apache.org:node2").publishBusiness(null, 1, 1); - } - else if (input.equals("3")) { + } else if (input.equals("2")) { new JuddiAdminService(clerkManager, null).autoMagic3(); List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); @@ -84,24 +76,16 @@ public class EntryPoitMultiNode { new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1, "root@" + uddiNodeList.get(i).getName()); } //new UddiCreatebulk("uddi:another.juddi.apache.org:node2").publishBusiness(null, 1, 1); - } - else if (input.equals("4")) { + } 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, "root@" + uddiNodeList.get(i).getName()); } - } else if (input.equals("5")) { - new JuddiAdminService(clerkManager, null).autoMagicDirectedSSL(); - - List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); - for (int i = 0; i < uddiNodeList.size(); i++) { - new UddiCreatebulk(uddiNodeList.get(i).getName()).publishBusiness(null, 1, 1, "root@" + uddiNodeList.get(i).getName()); - } - } else if (input.equals("6")) { + } else if (input.equals("4")) { new JuddiAdminService(clerkManager, null).printStatus(); - } else if (input.equals("7")) { + } else if (input.equals("5")) { List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); for (Node n : uddiNodeList) { UDDIInquiryPortType uddiInquiryService = clerkManager.getTransport(n.getName()).getUDDIInquiryService(); @@ -126,21 +110,21 @@ public class EntryPoitMultiNode { ServiceList findService = uddiInquiryService.findService(fs); System.out.println(n.getName() + " service count " + findService.getListDescription().getActualCount()); - - FindTModel ft= new FindTModel(); + + FindTModel ft = new FindTModel(); ft.setName(new Name(UDDIConstants.WILDCARD, null)); ft.setFindQualifiers(new FindQualifiers()); ft.getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH); ft.setMaxRows(1); ft.setListHead(0); TModelList findTModel = uddiInquiryService.findTModel(ft); - System.out.println(n.getName() + " tModel count " + System.out.println(n.getName() + " tModel count " + findTModel.getListDescription().getActualCount()); } System.out.println(); - } else if (input.equals("8")){ - new JuddiAdminService(clerkManager, null).pingAll(); + } else if (input.equals("6")) { + new JuddiAdminService(clerkManager, null).pingAll(); } } http://git-wip-us.apache.org/repos/asf/juddi/blob/fa5c54f0/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/JuddiAdminService.java ---------------------------------------------------------------------- diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/JuddiAdminService.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/JuddiAdminService.java index 4834b00..b26e631 100644 --- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/JuddiAdminService.java +++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/JuddiAdminService.java @@ -15,7 +15,6 @@ */ package org.apache.juddi.samples; -//import com.sun.xml.internal.ws.developer.JAXWSProperties; import java.io.File; import java.io.FileInputStream; import java.math.BigInteger; @@ -38,6 +37,7 @@ import org.apache.juddi.jaxb.PrintJUDDI; import org.apache.juddi.v3.client.UDDIService; import org.apache.juddi.v3.client.config.UDDIClient; import org.apache.juddi.v3.client.config.UDDINode; +import org.apache.juddi.v3.client.cryptor.TransportSecurityHelper; import org.apache.juddi.v3.client.transport.Transport; import org.apache.juddi.v3.client.transport.TransportException; import org.apache.juddi.v3_service.JUDDIApiPortType; @@ -505,7 +505,7 @@ public class JuddiAdminService { } Operator op = new Operator(); op.setOperatorNodeID("uddi:juddi.apache.org:node1"); - op.setSoapReplicationURL("http://localhost:8080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("bob", "en")); @@ -515,7 +515,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:another.juddi.apache.org:node2"); - op.setSoapReplicationURL("http://localhost:9080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -524,7 +524,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3"); - op.setSoapReplicationURL("http://localhost:10080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -586,7 +586,7 @@ public class JuddiAdminService { } Operator op = new Operator(); op.setOperatorNodeID("uddi:juddi.apache.org:node1"); - op.setSoapReplicationURL("http://localhost:8080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("bob", "en")); @@ -596,7 +596,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:another.juddi.apache.org:node2"); - op.setSoapReplicationURL("http://localhost:9080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -605,7 +605,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3"); - op.setSoapReplicationURL("http://localhost:10080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -687,7 +687,7 @@ public class JuddiAdminService { //} Operator op = new Operator(); op.setOperatorNodeID("uddi:juddi.apache.org:node1"); - op.setSoapReplicationURL("http://localhost:8080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("bob", "en")); @@ -697,7 +697,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:another.juddi.apache.org:node2"); - op.setSoapReplicationURL("http://localhost:9080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -750,7 +750,7 @@ public class JuddiAdminService { } Operator op = new Operator(); op.setOperatorNodeID("uddi:juddi.apache.org:node1"); - op.setSoapReplicationURL("http://localhost:8080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("bob", "en")); @@ -760,7 +760,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:another.juddi.apache.org:node2"); - op.setSoapReplicationURL("http://localhost:9080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -769,7 +769,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3"); - op.setSoapReplicationURL("http://localhost:10080/juddiv3/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -965,7 +965,7 @@ public class JuddiAdminService { //} Operator op = new Operator(); op.setOperatorNodeID("uddi:juddi.apache.org:node1"); - op.setSoapReplicationURL("https://localhost:8443/juddiv3replication/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("default").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("bob", "en")); @@ -975,7 +975,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:another.juddi.apache.org:node2"); - op.setSoapReplicationURL("https://localhost:9443/juddiv3replication/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:another.juddi.apache.org:node2").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -984,7 +984,7 @@ public class JuddiAdminService { op = new Operator(); op.setOperatorNodeID("uddi:yet.another.juddi.apache.org:node3"); - op.setSoapReplicationURL("https://localhost:10443/juddiv3replication/services/replication"); + op.setSoapReplicationURL(clerkManager.getClientConfig().getUDDINode("uddi:yet.another.juddi.apache.org:node3").getReplicationUrl()); op.setOperatorStatus(OperatorStatusType.NORMAL); op.getContact().add(new Contact()); op.getContact().get(0).getPersonName().add(new PersonName("mary", "en")); @@ -1045,25 +1045,7 @@ public class JuddiAdminService { List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList(); UDDIReplicationPortType uddiReplicationPort = new UDDIService().getUDDIReplicationPort(); - File currentdir = new File("."); - System.out.println("Using keystore from " + System.getProperty("javax.net.ssl.keyStore") + " current dir is " + currentdir.getAbsolutePath()); - System.out.println("Using truststure from " + System.getProperty("javax.net.ssl.trustStore") + " current dir is " + currentdir.getAbsolutePath()); - SSLContext sc = SSLContext.getInstance("SSLv3"); - - KeyManagerFactory kmf - = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - - KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); - ks.load(new FileInputStream(System.getProperty("javax.net.ssl.keyStore")), System.getProperty("javax.net.ssl.keyStorePassword").toCharArray()); - - kmf.init(ks, System.getProperty("javax.net.ssl.keyStorePassword").toCharArray()); - - sc.init(kmf.getKeyManagers(), null, null); - - ((BindingProvider) uddiReplicationPort).getRequestContext() - .put( - "com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory", - sc.getSocketFactory()); + TransportSecurityHelper.applyTransportSecurity((BindingProvider) uddiReplicationPort); for (Node currenteNode : uddiNodeList) { try { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
