Skip to content
Permalink
Browse files
JUDDI-241 updating the CLI example to use only configuration based ur…
…l's instead of hard coded ones
  • Loading branch information
spyhunter99 committed Feb 16, 2015
1 parent 4477b4c commit fa5c54f01ff9e738d6a086cad27914ac47b2a269
Showing 2 changed files with 31 additions and 65 deletions.
@@ -43,15 +43,12 @@ static void goMultiNode() throws Exception {
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,44 +61,31 @@ static void goMultiNode() throws Exception {

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();
for (int i = 0; i < uddiNodeList.size(); i++) {
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();
for (int i = 0; i < uddiNodeList.size(); i++) {
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 @@ else if (input.equals("4")) {
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();
}

}
@@ -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.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 @@ void autoMagic123() throws Exception {
}
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 @@ void autoMagic123() throws Exception {

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 @@ void autoMagic123() throws Exception {
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 @@ void autoMagicDirected() throws Exception {
}
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 @@ void autoMagicDirected() throws Exception {

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 @@ void autoMagicDirected() throws Exception {
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 @@ void autoMagic() throws Exception {
//}
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 @@ void autoMagic() throws Exception {

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 @@ void autoMagic3() throws Exception {
}
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 @@ void autoMagic3() throws Exception {

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 @@ void autoMagic3() throws Exception {

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 @@ void autoMagicDirectedSSL() throws Exception {
//}
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 @@ void autoMagicDirectedSSL() throws Exception {

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 @@ void autoMagicDirectedSSL() throws Exception {
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 @@ void pingAll() throws Exception {
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 {

0 comments on commit fa5c54f

Please sign in to comment.