You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2017/10/09 15:59:42 UTC
[3/3] juddi git commit: JUDDI-973 more code clean up JUDDI-977 find
bugs
JUDDI-973 more code clean up
JUDDI-977 find bugs
Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/de1de4c4
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/de1de4c4
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/de1de4c4
Branch: refs/heads/master
Commit: de1de4c4f243f182fe548bae45c8615026ae7e76
Parents: 193fa4c
Author: Alex O'Ree <al...@apache.org>
Authored: Mon Oct 9 11:59:37 2017 -0400
Committer: Alex O'Ree <al...@apache.org>
Committed: Mon Oct 9 11:59:37 2017 -0400
----------------------------------------------------------------------
.../juddi/v3/client/cli/UddiSubscribe.java | 4 +-
.../cli/UddiSubscribeAssertionStatus.java | 4 +-
.../subscription/ISubscriptionCallback.java | 8 +-
.../SubscriptionCallbackListener.java | 4 +-
.../subscription/SubscriptionCallbackTest.java | 16 +-
.../main/java/org/apache/juddi/samples/AES.java | 122 ++++----
.../samples/BusinessServiceKeymismatch.java | 89 +++---
.../samples/CompareByTModelInstanceInfoQOS.java | 155 +++++-----
.../main/java/org/apache/juddi/samples/DES.java | 110 +++----
.../org/apache/juddi/samples/EntryPoint.java | 21 +-
.../juddi/samples/EntryPointSingleNode.java | 49 ++--
.../juddi/samples/EntryPoitMultiNode.java | 5 +-
.../juddi/samples/FindBusinessBugHunt.java | 290 +++++++++----------
.../apache/juddi/samples/JuddiAdminService.java | 34 +--
.../org/apache/juddi/samples/SearchByQos.java | 41 +--
.../org/apache/juddi/samples/SimpleBrowse.java | 12 +-
.../apache/juddi/samples/UddiCreatebulk.java | 28 +-
.../juddi/samples/UddiCustodyTransfer.java | 10 +-
.../samples/UddiDigitalSignatureBusiness.java | 20 +-
.../juddi/samples/UddiDigitalSignatureFile.java | 30 +-
.../samples/UddiDigitalSignatureSearch.java | 153 +++++-----
.../samples/UddiDigitalSignatureService.java | 33 +--
.../samples/UddiDigitalSignatureTmodel.java | 48 ++-
.../apache/juddi/samples/UddiFindBinding.java | 19 +-
.../apache/juddi/samples/UddiFindEndpoints.java | 18 +-
.../juddi/samples/UddiGetServiceDetails.java | 15 +-
.../apache/juddi/samples/UddiKeyGenerator.java | 21 +-
.../juddi/samples/UddiRelatedBusinesses.java | 31 +-
.../apache/juddi/samples/UddiReplication.java | 18 +-
.../org/apache/juddi/samples/UddiSubscribe.java | 43 +--
.../samples/UddiSubscribeAssertionStatus.java | 62 +---
.../juddi/samples/UddiSubscribeValidate.java | 25 +-
.../samples/UddiSubscriptionManagement.java | 58 +---
.../org/apache/juddi/samples/WadlImport.java | 16 +-
.../org/apache/juddi/samples/WsdlImport.java | 22 +-
.../org/apache/juddi/samples/testStrings.java | 73 -----
...tSubscriptionCallbackAPIIntegrationTest.java | 4 +-
37 files changed, 725 insertions(+), 986 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java
index 2d4d72f..492dd9c 100644
--- a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribe.java
@@ -210,13 +210,13 @@ public class UddiSubscribe implements ISubscriptionCallback {
@Override
- public void HandleCallback(SubscriptionResultsList body) {
+ public void handleCallback(SubscriptionResultsList body) {
System.out.println("Callback received!");
System.out.println(p.print(body));
}
@Override
- public void NotifyEndpointStopped() {
+ public void notifyEndpointStopped() {
System.out.println("The endpoint was stopped!");
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java
----------------------------------------------------------------------
diff --git a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java
index d22704e..882a4bc 100644
--- a/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java
+++ b/juddi-client-cli/src/main/java/org/apache/juddi/v3/client/cli/UddiSubscribeAssertionStatus.java
@@ -126,13 +126,13 @@ public class UddiSubscribeAssertionStatus implements ISubscriptionCallback {
PrintUDDI<SubscriptionResultsList> p = new PrintUDDI<SubscriptionResultsList>();
@Override
- public void HandleCallback(SubscriptionResultsList body) {
+ public void handleCallback(SubscriptionResultsList body) {
System.out.println("Callback received!");
System.out.println(p.print(body));
}
@Override
- public void NotifyEndpointStopped() {
+ public void notifyEndpointStopped() {
System.out.println("The endpoint was stopped!");
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/ISubscriptionCallback.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/ISubscriptionCallback.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/ISubscriptionCallback.java
index f334fc1..b0572e9 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/ISubscriptionCallback.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/ISubscriptionCallback.java
@@ -18,8 +18,10 @@ package org.apache.juddi.v3.client.subscription;
import org.uddi.sub_v3.SubscriptionResultsList;
/**
- * This is an interface for creating asynchronous callback clientsfor the
+ * This is an interface for creating asynchronous callback clients for the
* UDDI Subscription API.
+ *
+ * Change notice, since 3.3.5, methods were renamed for the most standard convention (lowercase)
* @since 3.2
* @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
* @see SubscriptionCallbackListener
@@ -31,10 +33,10 @@ public interface ISubscriptionCallback {
* Implementations should never block.
* @param body
*/
- public void HandleCallback(SubscriptionResultsList body);
+ public void handleCallback(SubscriptionResultsList body);
/**
* Called when the callback endpoint is stopped
*/
- public void NotifyEndpointStopped();
+ public void notifyEndpointStopped();
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java b/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
index a424e19..87bf3dc 100644
--- a/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
+++ b/juddi-client/src/main/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackListener.java
@@ -543,7 +543,7 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
for (int i = 0; i < callbacks.size(); i++) {
if (callbacks.get(i) != null) {
try {
- callbacks.get(i).NotifyEndpointStopped();
+ callbacks.get(i).notifyEndpointStopped();
} catch (Exception ex) {
log.warn("Your implementation on ISubscriptionCallback is faulty and threw an error, contact the developer", ex);
}
@@ -614,7 +614,7 @@ public class SubscriptionCallbackListener implements org.uddi.v3_service.UDDISub
public DispositionReport notifySubscriptionListener(NotifySubscriptionListener body) throws DispositionReportFaultMessage, RemoteException {
for (int i = 0; i < callbacks.size(); i++) {
try {
- callbacks.get(i).HandleCallback(body.getSubscriptionResultsList());
+ callbacks.get(i).handleCallback(body.getSubscriptionResultsList());
} catch (Exception ex) {
log.warn("Your implementation on ISubscriptionCallback is faulty and threw an error, contact the developer", ex);
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-client/src/test/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackTest.java
----------------------------------------------------------------------
diff --git a/juddi-client/src/test/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackTest.java b/juddi-client/src/test/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackTest.java
index d4c5b05..c05d30e 100644
--- a/juddi-client/src/test/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackTest.java
+++ b/juddi-client/src/test/java/org/apache/juddi/v3/client/subscription/SubscriptionCallbackTest.java
@@ -138,11 +138,11 @@ public class SubscriptionCallbackTest implements ISubscriptionCallback {
SubscriptionCallbackListener.unRegisterCallback(new ISubscriptionCallback() {
@Override
- public void HandleCallback(SubscriptionResultsList body) {
+ public void handleCallback(SubscriptionResultsList body) {
}
@Override
- public void NotifyEndpointStopped() {
+ public void notifyEndpointStopped() {
}
});
@@ -197,12 +197,12 @@ public class SubscriptionCallbackTest implements ISubscriptionCallback {
SubscriptionCallbackListener.registerCallback(new ISubscriptionCallback() {
@Override
- public void HandleCallback(SubscriptionResultsList body) {
+ public void handleCallback(SubscriptionResultsList body) {
log.info("bogus callback received");
}
@Override
- public void NotifyEndpointStopped() {
+ public void notifyEndpointStopped() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
@@ -226,12 +226,12 @@ public class SubscriptionCallbackTest implements ISubscriptionCallback {
SubscriptionCallbackListener.registerCallback(new ISubscriptionCallback() {
@Override
- public void HandleCallback(SubscriptionResultsList body) {
+ public void handleCallback(SubscriptionResultsList body) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
- public void NotifyEndpointStopped() {
+ public void notifyEndpointStopped() {
log.info("bogus callback received");
}
@@ -262,13 +262,13 @@ public class SubscriptionCallbackTest implements ISubscriptionCallback {
}
@Override
- public void HandleCallback(SubscriptionResultsList body) {
+ public void handleCallback(SubscriptionResultsList body) {
log.info("HandleCallback received");
Test2_NoAutoRegisterAndShortCircuitReceive_ = true;
}
@Override
- public void NotifyEndpointStopped() {
+ public void notifyEndpointStopped() {
log.info("NotifyEndpointStopped received");
Test4_NotifyEndpointStopped_ = true;
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/AES.java
----------------------------------------------------------------------
diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/AES.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/AES.java
index 3a5864f..1c95338 100644
--- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/AES.java
+++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/AES.java
@@ -29,77 +29,77 @@ import javax.crypto.spec.SecretKeySpec;
*/
public class AES {
- public static String GEN(int keysize) {
- KeyGenerator kgen;
- try {
- kgen = KeyGenerator.getInstance("AES");
- kgen.init(keysize);
- SecretKey skey = kgen.generateKey();
- byte[] raw = skey.getEncoded();
- return asHex(raw);
- } catch (Exception ex) {
+ public static String GEN(int keysize) {
+ KeyGenerator kgen;
+ try {
+ kgen = KeyGenerator.getInstance("AES");
+ kgen.init(keysize);
+ SecretKey skey = kgen.generateKey();
+ byte[] raw = skey.getEncoded();
+ return asHex(raw);
+ } catch (Exception ex) {
+ }
+ return null;
}
- return null;
- }
- private static String asHex(byte buf[]) {
- //return new String(buf);
- StringBuilder strbuf = new StringBuilder(buf.length * 2);
- int i;
+ private static String asHex(byte buf[]) {
+ //return new String(buf);
+ StringBuilder strbuf = new StringBuilder(buf.length * 2);
+ int i;
- for (i = 0; i < buf.length; i++) {
- if (((int) buf[i] & 0xff) < 0x10) {
- strbuf.append("0");
- }
- strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
- }
+ for (i = 0; i < buf.length; i++) {
+ if (((int) buf[i] & 0xff) < 0x10) {
+ strbuf.append("0");
+ }
+ strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
+ }
- return strbuf.toString();
- }
+ return strbuf.toString();
+ }
- private static byte[] hexToBytes(String s) {
- //return s.getBytes();
- return hexToBytes(s.toCharArray());
- }
- private static final char[] kDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a',
- 'b', 'c', 'd', 'e', 'f'};
+ private static byte[] hexToBytes(String s) {
+ //return s.getBytes();
+ return hexToBytes(s.toCharArray());
+ }
+ private static final char[] kDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a',
+ 'b', 'c', 'd', 'e', 'f'};
- private static byte[] hexToBytes(char[] hex) {
- int length = hex.length / 2;
- byte[] raw = new byte[length];
- for (int i = 0; i < length; i++) {
- int high = Character.digit(hex[i * 2], 16);
- int low = Character.digit(hex[i * 2 + 1], 16);
- int value = (high << 4) | low;
- if (value > 127) {
- value -= 256;
- }
- raw[i] = (byte) value;
+ private static byte[] hexToBytes(char[] hex) {
+ int length = hex.length / 2;
+ byte[] raw = new byte[length];
+ for (int i = 0; i < length; i++) {
+ int high = Character.digit(hex[i * 2], 16);
+ int low = Character.digit(hex[i * 2 + 1], 16);
+ int value = (high << 4) | low;
+ if (value > 127) {
+ value -= 256;
+ }
+ raw[i] = (byte) value;
+ }
+ return raw;
}
- return raw;
- }
- //default key
- // private final static String something2 = "dde284c781d60ca0b56c4b23eec85217951dc99869402abd42c7dcc9080d60aa";
+ //default key
+ // private final static String something2 = "dde284c781d60ca0b56c4b23eec85217951dc99869402abd42c7dcc9080d60aa";
- public static void main(String[] args) throws Exception {
- //ee4bd3eefe38c3d996a89589de5b9698
- String key = GEN(128);
- System.out.println(key);
+ public static void main(String[] args) throws Exception {
+ //ee4bd3eefe38c3d996a89589de5b9698
+ String key = GEN(128);
+ System.out.println(key);
- byte[] raw = hexToBytes(key); //
- SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
- // Instantiate the cipher
- Cipher cipher = Cipher.getInstance("AES");
- cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
- byte[] encrypted = cipher.doFinal("password".getBytes());
- String enc = (asHex(encrypted));
- System.out.println(enc);
+ byte[] raw = hexToBytes(key); //
+ SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
+ // Instantiate the cipher
+ Cipher cipher = Cipher.getInstance("AES");
+ cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
+ byte[] encrypted = cipher.doFinal("password".getBytes("UTF-8"));
+ String enc = (asHex(encrypted));
+ System.out.println(enc);
- skeySpec = new SecretKeySpec(hexToBytes(key), "AES");
- cipher.init(Cipher.DECRYPT_MODE, skeySpec);
- byte[] original = cipher.doFinal(hexToBytes(enc));
+ skeySpec = new SecretKeySpec(hexToBytes(key), "AES");
+ cipher.init(Cipher.DECRYPT_MODE, skeySpec);
+ byte[] original = cipher.doFinal(hexToBytes(enc));
- System.out.println(new String(original));
+ System.out.println(new String(original, "UTF-8"));
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/BusinessServiceKeymismatch.java
----------------------------------------------------------------------
diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/BusinessServiceKeymismatch.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/BusinessServiceKeymismatch.java
index bb9feeb..ff6bea5 100644
--- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/BusinessServiceKeymismatch.java
+++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/BusinessServiceKeymismatch.java
@@ -38,62 +38,61 @@ import org.uddi.v3_service.UDDISecurityPortType;
/**
* This class was created to demonstrate that UDDI entities's keys do not need
- * to be from the same key domain.
- * I.e. Business key = "uddi:1234:business"
+ * to be from the same key domain. I.e. Business key = "uddi:1234:business"
* which owns Service key "uddi:4567:service1"
*
* @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
*/
public class BusinessServiceKeymismatch {
- private static UDDISecurityPortType security = null;
- private static JUDDIApiPortType juddiApi = null;
- private static UDDIPublicationPortType publish = null;
+ private static UDDISecurityPortType security = null;
+ private static JUDDIApiPortType juddiApi = null;
+ private static UDDIPublicationPortType publish = null;
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws Exception {
- // create a manager and read the config in the archive;
- // you can use your config file name
- UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
- // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
- Transport transport = clerkManager.getTransport("default");
- // Now you create a reference to the UDDI API
- security = transport.getUDDISecurityService();
- publish = transport.getUDDIPublishService();
+ // create a manager and read the config in the archive;
+ // you can use your config file name
+ UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+ // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
+ Transport transport = clerkManager.getTransport("default");
+ // Now you create a reference to the UDDI API
+ security = transport.getUDDISecurityService();
+ publish = transport.getUDDIPublishService();
- //step one, get a token
- GetAuthToken getAuthTokenRoot = new GetAuthToken();
- getAuthTokenRoot.setUserID("uddi");
+ //step one, get a token
+ GetAuthToken getAuthTokenRoot = new GetAuthToken();
+ getAuthTokenRoot.setUserID("uddi");
- getAuthTokenRoot.setCred("uddi");
- AuthToken authToken = security.getAuthToken(getAuthTokenRoot);
- TModel createKeyGenator = UDDIClerk.createKeyGenator("uddi:testdomain:keygenerator", "a name", "en");
+ getAuthTokenRoot.setCred("uddi");
+ AuthToken authToken = security.getAuthToken(getAuthTokenRoot);
+ TModel createKeyGenator = UDDIClerk.createKeyGenator("uddi:testdomain:keygenerator", "a name", "en");
- TModel createKeyGenator2 = UDDIClerk.createKeyGenator("uddi:testdomain2:keygenerator", "a name", "en");
+ TModel createKeyGenator2 = UDDIClerk.createKeyGenator("uddi:testdomain2:keygenerator", "a name", "en");
- SaveTModel st = new SaveTModel();
- st.setAuthInfo(authToken.getAuthInfo());
- st.getTModel().add(createKeyGenator);
- st.getTModel().add(createKeyGenator2);
- publish.saveTModel(st);
+ SaveTModel st = new SaveTModel();
+ st.setAuthInfo(authToken.getAuthInfo());
+ st.getTModel().add(createKeyGenator);
+ st.getTModel().add(createKeyGenator2);
+ publish.saveTModel(st);
- SaveBusiness sb = new SaveBusiness();
- sb.setAuthInfo(authToken.getAuthInfo());
- BusinessEntity be = new BusinessEntity();
- be.setBusinessKey("uddi:testdomain:biz1");
- be.getName().add(new Name("test", "en"));
- be.setBusinessServices(new BusinessServices());
- BusinessService bs = new BusinessService();
- bs.setServiceKey("uddi:testdomain2:svc");
- bs.setBusinessKey("uddi:testdomain:biz1");
- bs.getName().add(new Name("svc", "en"));
- bs.setBindingTemplates(new BindingTemplates());
- BindingTemplate bt = new BindingTemplate();
- bt.setAccessPoint(new AccessPoint("http://localhost", "wsdlDeployment"));
- bt = UDDIClient.addSOAPtModels(bt);
- bs.getBindingTemplates().getBindingTemplate().add(bt);
- be.getBusinessServices().getBusinessService().add(bs);
- sb.getBusinessEntity().add(be);
- publish.saveBusiness(sb);
- }
+ SaveBusiness sb = new SaveBusiness();
+ sb.setAuthInfo(authToken.getAuthInfo());
+ BusinessEntity be = new BusinessEntity();
+ be.setBusinessKey("uddi:testdomain:biz1");
+ be.getName().add(new Name("test", "en"));
+ be.setBusinessServices(new BusinessServices());
+ BusinessService bs = new BusinessService();
+ bs.setServiceKey("uddi:testdomain2:svc");
+ bs.setBusinessKey("uddi:testdomain:biz1");
+ bs.getName().add(new Name("svc", "en"));
+ bs.setBindingTemplates(new BindingTemplates());
+ BindingTemplate bt = new BindingTemplate();
+ bt.setAccessPoint(new AccessPoint("http://localhost", "wsdlDeployment"));
+ bt = UDDIClient.addSOAPtModels(bt);
+ bs.getBindingTemplates().getBindingTemplate().add(bt);
+ be.getBusinessServices().getBusinessService().add(bs);
+ sb.getBusinessEntity().add(be);
+ publish.saveBusiness(sb);
+ }
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/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 de8b0d7..6815c48 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,89 +37,90 @@ 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
+ * 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 {
-
- public static void main(String[] args) throws Exception {
- BusinessEntity mary = CreateMary();
- BindingTemplate bt1 = mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0);
- BindingTemplate bt2 = mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1);
-
- TModelInstanceDetailsComparator tidc = new TModelInstanceDetailsComparator(WSDMQosConstants.METRIC_FAULT_COUNT_KEY, true, false, false);
- int compare = tidc.compare(bt1.getTModelInstanceDetails(), bt2.getTModelInstanceDetails());
- if (compare > 0)
- System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue() +
- " is greater than " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
- if (compare < 0)
- System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue() +
- " is less than " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
- if (compare== 0)
- System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue() +
- " is equal to " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
-
- }
+ public static void main(String[] args) throws Exception {
+ BusinessEntity mary = CreateMary();
+ BindingTemplate bt1 = mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0);
+ BindingTemplate bt2 = mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1);
+
+ TModelInstanceDetailsComparator tidc = new TModelInstanceDetailsComparator(WSDMQosConstants.METRIC_FAULT_COUNT_KEY, true, false, false);
+ int compare = tidc.compare(bt1.getTModelInstanceDetails(), bt2.getTModelInstanceDetails());
+ if (compare > 0) {
+ System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue()
+ + " is greater than " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
+ }
+ if (compare < 0) {
+ System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue()
+ + " is less than " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
+ }
+ if (compare == 0) {
+ System.out.println(mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(0).getAccessPoint().getValue()
+ + " is equal to " + mary.getBusinessServices().getBusinessService().get(0).getBindingTemplates().getBindingTemplate().get(1).getAccessPoint().getValue());
+ }
+
+ }
+
+ /**
+ * creates a business, service, bt with tmodel instance details with qos
+ * parameters
+ *
+ * @param rootAuthToken
+ * @throws Exception
+ */
+ private static BusinessEntity CreateMary() throws Exception {
+ BusinessEntity be = new BusinessEntity();
+ be.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+ be.setDiscoveryURLs(new DiscoveryURLs());
+ be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("home", "http://www.marybusinessone.com"));
+ be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("serviceList", "http://www.marybusinessone.com/services"));
+ be.getName().add(new Name("Mary Doe Enterprises", "en"));
+ be.getName().add(new Name("Maria Negocio Uno", "es"));
+ be.getDescription().add(new Description("This is the description for Mary Business One.", "en"));
+ be.setContacts(new Contacts());
+ Contact c = new Contact();
+ c.setUseType("administrator");
+ c.getPersonName().add(new PersonName("Mary Doe", "en"));
+ c.getPersonName().add(new PersonName("Juan Doe", "es"));
+ c.getDescription().add(new Description("This is the administrator of the service offerings.", "en"));
+ be.getContacts().getContact().add(c);
+ be.setBusinessServices(new BusinessServices());
+ BusinessService bs = new BusinessService();
+ bs.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+ bs.setServiceKey("uddi:uddi.marypublisher.com:marybusinessoneservice");
+ bs.getName().add(new Name("name!", "en"));
+ bs.setBindingTemplates(new BindingTemplates());
+ BindingTemplate bt = new BindingTemplate();
+ bt.setAccessPoint(new AccessPoint("http://localhost/endpoint1BAD", AccessPointType.WSDL_DEPLOYMENT.toString()));
+ bt.setTModelInstanceDetails(new TModelInstanceDetails());
+ TModelInstanceInfo tii = new TModelInstanceInfo();
+ tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY);
+
+ tii.setInstanceDetails(new InstanceDetails());
+ tii.getInstanceDetails().setInstanceParms("400");
+ bt = UDDIClient.addSOAPtModels(bt);
+ bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
+ bs.getBindingTemplates().getBindingTemplate().add(bt);
-
+ bt = new BindingTemplate();
+ bt.setAccessPoint(new AccessPoint("http://localhost/endpoint2BETTER", AccessPointType.WSDL_DEPLOYMENT.toString()));
+ bt.setTModelInstanceDetails(new TModelInstanceDetails());
+ tii = new TModelInstanceInfo();
+ tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY);
- /**
- * creates a business, service, bt with tmodel instance details with qos
- * parameters
- *
- * @param rootAuthToken
- * @throws Exception
- */
- private static BusinessEntity CreateMary() throws Exception {
- BusinessEntity be = new BusinessEntity();
- be.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
- be.setDiscoveryURLs(new DiscoveryURLs());
- be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("home", "http://www.marybusinessone.com"));
- be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("serviceList", "http://www.marybusinessone.com/services"));
- be.getName().add(new Name("Mary Doe Enterprises", "en"));
- be.getName().add(new Name("Maria Negocio Uno", "es"));
- be.getDescription().add(new Description("This is the description for Mary Business One.", "en"));
- be.setContacts(new Contacts());
- Contact c = new Contact();
- c.setUseType("administrator");
- c.getPersonName().add(new PersonName("Mary Doe", "en"));
- c.getPersonName().add(new PersonName("Juan Doe", "es"));
- c.getDescription().add(new Description("This is the administrator of the service offerings.", "en"));
- be.getContacts().getContact().add(c);
- be.setBusinessServices(new BusinessServices());
- BusinessService bs = new BusinessService();
- bs.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
- bs.setServiceKey("uddi:uddi.marypublisher.com:marybusinessoneservice");
- bs.getName().add(new Name("name!", "en"));
- bs.setBindingTemplates(new BindingTemplates());
- BindingTemplate bt = new BindingTemplate();
- bt.setAccessPoint(new AccessPoint("http://localhost/endpoint1BAD", AccessPointType.WSDL_DEPLOYMENT.toString()));
- bt.setTModelInstanceDetails(new TModelInstanceDetails());
- TModelInstanceInfo tii = new TModelInstanceInfo();
- tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY);
+ tii.setInstanceDetails(new InstanceDetails());
+ tii.getInstanceDetails().setInstanceParms("4");
+ bt = UDDIClient.addSOAPtModels(bt);
+ bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
+ bs.getBindingTemplates().getBindingTemplate().add(bt);
- tii.setInstanceDetails(new InstanceDetails());
- tii.getInstanceDetails().setInstanceParms("400");
- bt = UDDIClient.addSOAPtModels(bt);
- bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
- bs.getBindingTemplates().getBindingTemplate().add(bt);
-
- bt = new BindingTemplate();
- bt.setAccessPoint(new AccessPoint("http://localhost/endpoint2BETTER", AccessPointType.WSDL_DEPLOYMENT.toString()));
- bt.setTModelInstanceDetails(new TModelInstanceDetails());
- tii = new TModelInstanceInfo();
- tii.setTModelKey(WSDMQosConstants.METRIC_FAULT_COUNT_KEY);
+ be.getBusinessServices().getBusinessService().add(bs);
- tii.setInstanceDetails(new InstanceDetails());
- tii.getInstanceDetails().setInstanceParms("4");
- bt = UDDIClient.addSOAPtModels(bt);
- bt.getTModelInstanceDetails().getTModelInstanceInfo().add(tii);
- bs.getBindingTemplates().getBindingTemplate().add(bt);
-
-
- be.getBusinessServices().getBusinessService().add(bs);
-
- return be;
- }
+ return be;
+ }
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/DES.java
----------------------------------------------------------------------
diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/DES.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/DES.java
index 14f6741..69119b9 100644
--- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/DES.java
+++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/DES.java
@@ -38,67 +38,67 @@ import org.apache.commons.codec.binary.Base64;
*/
public class DES {
- private static final String UNICODE_FORMAT = "UTF8";
- public static final String DESEDE_ENCRYPTION_SCHEME = "DESede";
- static private KeySpec ks;
- static private SecretKeyFactory skf;
- static private Cipher cipher;
- static byte[] arrayBytes;
- static private String myEncryptionKey;
- static private String myEncryptionScheme;
- static SecretKey key;
+ private static final String UNICODE_FORMAT = "UTF8";
+ public static final String DESEDE_ENCRYPTION_SCHEME = "DESede";
+ static private KeySpec ks;
+ static private SecretKeyFactory skf;
+ static private Cipher cipher;
+ static byte[] arrayBytes;
+ static private String myEncryptionKey;
+ static private String myEncryptionScheme;
+ static SecretKey key;
- public DES() throws Exception {
- }
+ public DES() throws Exception {
+ }
- public String encrypt(String clear) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
- String encryptedString = null;
- try {
- cipher.init(Cipher.ENCRYPT_MODE, key);
- byte[] plainText = clear.getBytes(UNICODE_FORMAT);
- byte[] encryptedText = cipher.doFinal(plainText);
- encryptedString = new String(Base64.encodeBase64(encryptedText));
- } catch (Exception e) {
- e.printStackTrace();
+ public String encrypt(String clear) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
+ String encryptedString = null;
+ try {
+ cipher.init(Cipher.ENCRYPT_MODE, key);
+ byte[] plainText = clear.getBytes(UNICODE_FORMAT);
+ byte[] encryptedText = cipher.doFinal(plainText);
+ encryptedString = new String(Base64.encodeBase64(encryptedText), "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return encryptedString;
}
- return encryptedString;
- }
- public String decrypt(String str) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
- String encryptedString = null;
- try {
- cipher.init(Cipher.DECRYPT_MODE, key);
- byte[] encryptedText = Base64.decodeBase64(str.getBytes());
- byte[] clear = cipher.doFinal(encryptedText);
- encryptedString = new String(Base64.encodeBase64(clear));
- } catch (Exception e) {
- e.printStackTrace();
+ public String decrypt(String str) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
+ String encryptedString = null;
+ try {
+ cipher.init(Cipher.DECRYPT_MODE, key);
+ byte[] encryptedText = Base64.decodeBase64(str.getBytes("UTF-8"));
+ byte[] clear = cipher.doFinal(encryptedText);
+ encryptedString = new String(Base64.encodeBase64(clear), "UTF-8");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return encryptedString;
}
- return encryptedString;
- }
- public static void main(String[] args) throws Exception {
- DES des = new DES();
- KeyGenerator kgen;
- try {
- kgen = KeyGenerator.getInstance(DESEDE_ENCRYPTION_SCHEME);
- kgen.init(168);
- SecretKey skey = kgen.generateKey();
- byte[] raw = skey.getEncoded();
- myEncryptionKey = new String(Base64.encodeBase64(raw));
- myEncryptionScheme = DESEDE_ENCRYPTION_SCHEME;
- arrayBytes = myEncryptionKey.getBytes(UNICODE_FORMAT);
- ks = new DESedeKeySpec(arrayBytes);
- skf = SecretKeyFactory.getInstance(myEncryptionScheme);
- cipher = Cipher.getInstance(myEncryptionScheme);
- key = skf.generateSecret(ks);
+ public static void main(String[] args) throws Exception {
+ DES des = new DES();
+ KeyGenerator kgen;
+ try {
+ kgen = KeyGenerator.getInstance(DESEDE_ENCRYPTION_SCHEME);
+ kgen.init(168);
+ SecretKey skey = kgen.generateKey();
+ byte[] raw = skey.getEncoded();
+ myEncryptionKey = new String(Base64.encodeBase64(raw), "UTF-8");
+ myEncryptionScheme = DESEDE_ENCRYPTION_SCHEME;
+ arrayBytes = myEncryptionKey.getBytes(UNICODE_FORMAT);
+ ks = new DESedeKeySpec(arrayBytes);
+ skf = SecretKeyFactory.getInstance(myEncryptionScheme);
+ cipher = Cipher.getInstance(myEncryptionScheme);
+ key = skf.generateSecret(ks);
- System.out.println(new String(Base64.encodeBase64(raw)));
- System.out.println(des.encrypt("password"));
- System.out.println(des.decrypt(des.encrypt("password")));
- } catch (Exception ex) {
- ex.printStackTrace();;
- }
+ System.out.println(new String(Base64.encodeBase64(raw), "UTF-8"));
+ System.out.println(des.encrypt("password"));
+ System.out.println(des.decrypt(des.encrypt("password")));
+ } catch (Exception ex) {
+ ex.printStackTrace();;
+ }
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/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 5170e35..73003d3 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
@@ -16,14 +16,6 @@
package org.apache.juddi.samples;
import java.io.File;
-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;
/**
*
@@ -65,8 +57,7 @@ public class EntryPoint {
} else {
System.out.println("javax.net.ssl.trustStore = " + trustStore);
}
-
-
+
if (System.getProperty("javax.net.ssl.keyStore") == null) {
File f = new File("../../juddi-tomcat/keystore.jks");
if (f.exists()) {
@@ -142,18 +133,18 @@ public class EntryPoint {
System.out.println("2) Digitally sign a UDDI entity from a file.");
System.out.println(" q) Quit/exit");
System.out.print("#");
- input=System.console().readLine();
+ input = System.console().readLine();
processOffline(input);
} while (!"q".equalsIgnoreCase(input));
}
private static void processOffline(String input) throws Exception {
- if (input.equals("1")) {
- CompareByTModelInstanceInfoQOS.main(null);
+ if ("1".equals(input)) {
+ CompareByTModelInstanceInfoQOS.main(new String[0]);
}
- if (input.equals("2")) {
- new UddiDigitalSignatureFile().Fire(null, null, null);
+ if ("2".equals(input)) {
+ new UddiDigitalSignatureFile().fire(null, null, null);
}
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/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
index 42d190e..6d78051 100644
--- 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
@@ -220,38 +220,38 @@ public class EntryPointSingleNode {
if (input.equals("9")) {
System.out.print("Business key to sign: ");
String key = (System.console().readLine());
- new UddiDigitalSignatureBusiness().Fire(authtoken, key);
+ 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);
+ 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);
+ new UddiDigitalSignatureTmodel().fire(authtoken, key);
}
if (input.equals("12")) {
- new UddiDigitalSignatureSearch().Fire(authtoken);
+ new UddiDigitalSignatureSearch().fire(authtoken);
}
if (input.equals("13")) {
- new UddiFindBinding().Fire(authtoken);
+ 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);
+ new UddiFindEndpoints().fire(authtoken, key);
}
if (input.equals("15")) {
System.out.print("Service key: ");
String key = (System.console().readLine());
- new UddiGetServiceDetails().Fire(authtoken, key);
+ new UddiGetServiceDetails().fire(authtoken, key);
}
if (input.equals("16")) {
System.out.print("Get FQDN: ");
String key = (System.console().readLine());
- new UddiKeyGenerator().Fire(authtoken, key);
+ new UddiKeyGenerator().fire(authtoken, key);
}
if (input.equals("17")) {
UDDISecurityPortType security = null;
@@ -284,10 +284,10 @@ public class EntryPointSingleNode {
System.out.print("relationship (parent-child, peer-peer,or identity) : ");
String relationship = (System.console().readLine());
- new UddiRelatedBusinesses().Fire(key, authtokenFrom, key2, authtokenFrom2, relationship);
+ new UddiRelatedBusinesses().fire(key, authtokenFrom, key2, authtokenFrom2, relationship);
}
if (input.equals("18")) {
- new UddiSubscribe(client, currentNode, transport).Fire();
+ new UddiSubscribe(client, currentNode, transport).fire();
}
if (input.equals("19")) {
@@ -302,40 +302,40 @@ public class EntryPointSingleNode {
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);
+ 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);
+ new WadlImport().fire(url, key, authtoken, transport);
}
if (input.equals("22")) {
- new UddiSubscriptionManagement(transport).PrintSubscriptions(authtoken);
+ 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);
+ new UddiSubscriptionManagement(transport).deleteSubscription(authtoken, key2);
}
if (input.equals("24")) {
- new UddiSubscriptionManagement(transport).DeleteAllSubscriptions(authtoken);
+ new UddiSubscriptionManagement(transport).deleteAllSubscriptions(authtoken);
}
if (input.equals("25")) {
- new UddiSubscribeAssertionStatus(transport).Fire(currentNode);
+ new UddiSubscribeAssertionStatus().fire(currentNode);
}
if (input.equals("26")) {
//System.out.println("27) Replication - do_ping");
- new UddiReplication(client, currentNode).DoPing();
+ new UddiReplication(client, currentNode).doPing();
}
if (input.equals("27")) {
//System.out.println("28) Replication - get high watermarks");
- new UddiReplication(client, currentNode).GetHighWatermarks();
+ new UddiReplication(client, currentNode).getHighWatermarks();
}
if (input.equals("28")) {
@@ -347,7 +347,7 @@ public class EntryPointSingleNode {
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);
+ new UddiReplication(client, currentNode).getChangeRecords(Long.parseLong(id), src);
}
if ("29".equals(input)) {
@@ -552,9 +552,8 @@ public class EntryPointSingleNode {
System.out.println("after business counts "
+ afterfindBusiness.getListDescription().getActualCount());
System.out.println("actual created " + createdBusinesses);
- System.out.println("Delta = " + (afterfindBusiness.getListDescription().getActualCount() - findBusiness.getListDescription().getActualCount()));
-
-
+ System.out.println("Delta = " + (afterfindBusiness.getListDescription().getActualCount() - findBusiness.getListDescription().getActualCount()));
+
System.out.println("before service counts "
+ findService.getListDescription().getActualCount());
@@ -564,9 +563,11 @@ public class EntryPointSingleNode {
+ afterfindService.getListDescription().getActualCount());
System.out.println("actual created " + createdServices);
System.out.println("delta = " + (afterfindService.getListDescription().getActualCount() - findService.getListDescription().getActualCount()));
- if ((afterfindService.getListDescription().getActualCount() - findService.getListDescription().getActualCount()) == createdServices)
+ if ((afterfindService.getListDescription().getActualCount() - findService.getListDescription().getActualCount()) == createdServices) {
System.out.println("success");
- else System.out.println("failure!");
+ } else {
+ System.out.println("failure!");
+ }
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/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 84c0efa..19b0264 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
@@ -19,7 +19,6 @@ import java.util.List;
import org.apache.juddi.api_v3.Node;
import org.apache.juddi.v3.client.UDDIConstants;
import org.apache.juddi.v3.client.config.UDDIClient;
-import org.apache.juddi.v3.client.transport.Transport;
import org.uddi.api_v3.BusinessList;
import org.uddi.api_v3.FindBusiness;
import org.uddi.api_v3.FindQualifiers;
@@ -37,10 +36,10 @@ import org.uddi.v3_service.UDDIInquiryPortType;
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) Sets undirected replication two instances of jUDDI");
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/FindBusinessBugHunt.java
----------------------------------------------------------------------
diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/FindBusinessBugHunt.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/FindBusinessBugHunt.java
index 0e507ea..3e2fbff 100644
--- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/FindBusinessBugHunt.java
+++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/FindBusinessBugHunt.java
@@ -47,162 +47,160 @@ import org.uddi.v3_service.UDDIPublicationPortType;
import org.uddi.v3_service.UDDISecurityPortType;
/**
- *
+ * This class was made to try and hunt down a bug reported by an end user.
* @author Alex O'Ree
*/
public class FindBusinessBugHunt {
- static PrintUDDI<TModel> pTModel = new PrintUDDI<TModel>();
- static Properties properties = new Properties();
- static String wsdlURL = null;
- private static UDDISecurityPortType security = null;
- private static JUDDIApiPortType juddiApi = null;
- private static UDDIPublicationPortType publish = null;
- private static UDDIInquiryPortType inquiry;
-
- public static void main(String[] args) throws Exception {
-
- // create a manager and read the config in the archive;
- // you can use your config file name
- UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
- UDDIClerk clerk = clerkManager.getClerk("default");
- // a ClerkManager 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 = clerkManager.getTransport();
- // Now you create a reference to the UDDI API
- security = transport.getUDDISecurityService();
- publish = transport.getUDDIPublishService();
- inquiry = transport.getUDDIInquiryService();
- //step one, get a token
- GetAuthToken getAuthTokenRoot = new GetAuthToken();
- getAuthTokenRoot.setUserID("uddi");
- getAuthTokenRoot.setCred("uddi");
-
- // Making API call that retrieves the authentication token for the 'root' user.
- String rootAuthToken = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
- String uddi = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
-
- System.out.println("killing mary's business if it exists");
- //first check is Mary's business exists and delete
- DeleteIfExists("uddi:uddi.marypublisher.com:marybusinessone", uddi);
-
- System.out.println("making mary's tmodel key gen");
- //make the key gen since our test case uses some custom keys
- TModel createKeyGenator = UDDIClerk.createKeyGenator("uddi.marypublisher.com", "mary key gen", "en");
- //clerk.register(createKeyGenator);
- System.out.println("saving...");
- SaveTM(createKeyGenator, uddi);
-
-
- System.out.println("fetching business list");
- BusinessList before = getBusinessList(uddi);
- if (before.getBusinessInfos() == null) {
- System.out.println("before no businesses returned!");
- before.setBusinessInfos(new BusinessInfos());
- } else {
- System.out.println(before.getBusinessInfos().getBusinessInfo().size() + " businesses returned before");
- }
+ static PrintUDDI<TModel> pTModel = new PrintUDDI<TModel>();
+ static Properties properties = new Properties();
+ static String wsdlURL = null;
+ private static UDDISecurityPortType security = null;
+ private static JUDDIApiPortType juddiApi = null;
+ private static UDDIPublicationPortType publish = null;
+ private static UDDIInquiryPortType inquiry;
+
+ public static void main(String[] args) throws Exception {
+
+ // create a manager and read the config in the archive;
+ // you can use your config file name
+ UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
+
+ // a ClerkManager 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 = clerkManager.getTransport();
+ // Now you create a reference to the UDDI API
+ security = transport.getUDDISecurityService();
+ publish = transport.getUDDIPublishService();
+ inquiry = transport.getUDDIInquiryService();
+ //step one, get a token
+ GetAuthToken getAuthTokenRoot = new GetAuthToken();
+ getAuthTokenRoot.setUserID("uddi");
+ getAuthTokenRoot.setCred("uddi");
+
+ // Making API call that retrieves the authentication token for the 'root' user.
+ String uddi = security.getAuthToken(getAuthTokenRoot).getAuthInfo();
+
+ System.out.println("killing mary's business if it exists");
+ //first check is Mary's business exists and delete
+ DeleteIfExists("uddi:uddi.marypublisher.com:marybusinessone", uddi);
+
+ System.out.println("making mary's tmodel key gen");
+ //make the key gen since our test case uses some custom keys
+ TModel createKeyGenator = UDDIClerk.createKeyGenator("uddi.marypublisher.com", "mary key gen", "en");
+ //clerk.register(createKeyGenator);
+ System.out.println("saving...");
+ SaveTM(createKeyGenator, uddi);
+
+ System.out.println("fetching business list");
+ BusinessList before = getBusinessList(uddi);
+ if (before.getBusinessInfos() == null) {
+ System.out.println("before no businesses returned!");
+ before.setBusinessInfos(new BusinessInfos());
+ } else {
+ System.out.println(before.getBusinessInfos().getBusinessInfo().size() + " businesses returned before");
+ }
+
+ System.out.println("saving mary");
+ SaveMary(uddi);
+
+ BusinessList after = getBusinessList(uddi);
+ if (after.getBusinessInfos() == null) {
+ System.out.println("after no businesses returned!");
+ after.setBusinessInfos(new BusinessInfos());
+ } else {
+ System.out.println(after.getBusinessInfos().getBusinessInfo().size() + " businesses returned after");
+ }
+ PrintUDDI<BusinessList> p = new PrintUDDI<BusinessList>();
+ if (before.getBusinessInfos().getBusinessInfo().size()
+ < after.getBusinessInfos().getBusinessInfo().size()) {
+ System.out.println("hey it worked as advertised, double checking");
+ if (CheckFor(after, "uddi:uddi.marypublisher.com:marybusinessone")) {
+ System.out.println("ok!");
+ } else {
+ System.out.println("no good!");
+ }
+ } else {
+
+ System.out.println("something's not right, here's the before service listing");
+ System.out.println(p.print(before));
+ System.out.println(p.print(after));
+ }
- System.out.println("saving mary");
- SaveMary(uddi);
+ }
- BusinessList after = getBusinessList(uddi);
- if (after.getBusinessInfos() == null) {
- System.out.println("after no businesses returned!");
- after.setBusinessInfos(new BusinessInfos());
- } else {
- System.out.println(after.getBusinessInfos().getBusinessInfo().size() + " businesses returned after");
+ private static void DeleteIfExists(String key, String authInfo) {
+ GetBusinessDetail gbd = new GetBusinessDetail();
+ gbd.setAuthInfo(authInfo);
+ gbd.getBusinessKey().add(key);
+ boolean found = false;
+ try {
+ BusinessDetail businessDetail = inquiry.getBusinessDetail(gbd);
+ if (businessDetail != null
+ && !businessDetail.getBusinessEntity().isEmpty()
+ && businessDetail.getBusinessEntity().get(0).getBusinessKey().equals(key)) {
+ found = true;
+ }
+ } catch (Exception ex) {
+ }
+ if (found) {
+ DeleteBusiness db = new DeleteBusiness();
+ db.setAuthInfo(authInfo);
+ db.getBusinessKey().add(key);
+ try {
+ publish.deleteBusiness(db);
+ } catch (Exception ex) {
+ Logger.getLogger(FindBusinessBugHunt.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
}
- PrintUDDI<BusinessList> p = new PrintUDDI<BusinessList>();
- if (before.getBusinessInfos().getBusinessInfo().size()
- < after.getBusinessInfos().getBusinessInfo().size()) {
- System.out.println("hey it worked as advertised, double checking");
- if (CheckFor(after, "uddi:uddi.marypublisher.com:marybusinessone")) {
- System.out.println("ok!");
- } else {
- System.out.println("no good!");
- }
- } else {
-
- System.out.println("something's not right, here's the before service listing");
- System.out.println(p.print(before));
- System.out.println(p.print(after));
+
+ private static BusinessList getBusinessList(String token) throws Exception {
+ FindBusiness fb = new FindBusiness();
+ fb.setAuthInfo(token);
+ org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
+ fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+ fb.setFindQualifiers(fq);
+ fb.getName().add((new Name(UDDIConstants.WILDCARD, null)));
+ return inquiry.findBusiness(fb);
}
- }
-
- private static void DeleteIfExists(String key, String authInfo) {
- GetBusinessDetail gbd = new GetBusinessDetail();
- gbd.setAuthInfo(authInfo);
- gbd.getBusinessKey().add(key);
- boolean found = false;
- try {
- BusinessDetail businessDetail = inquiry.getBusinessDetail(gbd);
- if (businessDetail != null
- && !businessDetail.getBusinessEntity().isEmpty()
- && businessDetail.getBusinessEntity().get(0).getBusinessKey().equals(key)) {
- found = true;
- }
- } catch (Exception ex) {
+ private static void SaveMary(String rootAuthToken) throws Exception {
+ BusinessEntity be = new BusinessEntity();
+ be.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
+ be.setDiscoveryURLs(new DiscoveryURLs());
+ be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("home", "http://www.marybusinessone.com"));
+ be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("serviceList", "http://www.marybusinessone.com/services"));
+ be.getName().add(new Name("Mary Doe Enterprises", "en"));
+ be.getName().add(new Name("Maria Negocio Uno", "es"));
+ be.getDescription().add(new Description("This is the description for Mary Business One.", "en"));
+ be.setContacts(new Contacts());
+ Contact c = new Contact();
+ c.setUseType("administrator");
+ c.getPersonName().add(new PersonName("Mary Doe", "en"));
+ c.getPersonName().add(new PersonName("Juan Doe", "es"));
+ c.getDescription().add(new Description("This is the administrator of the service offerings.", "en"));
+ be.getContacts().getContact().add(c);
+ SaveBusiness sb = new SaveBusiness();
+ sb.setAuthInfo(rootAuthToken);
+ sb.getBusinessEntity().add(be);
+ publish.saveBusiness(sb);
}
- if (found) {
- DeleteBusiness db = new DeleteBusiness();
- db.setAuthInfo(authInfo);
- db.getBusinessKey().add(key);
- try {
- publish.deleteBusiness(db);
- } catch (Exception ex) {
- Logger.getLogger(FindBusinessBugHunt.class.getName()).log(Level.SEVERE, null, ex);
- }
+
+ private static boolean CheckFor(BusinessList list, String key) {
+ for (int i = 0; i < list.getBusinessInfos().getBusinessInfo().size(); i++) {
+ if (list.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey().equalsIgnoreCase(key)) {
+ return true;
+ }
+ }
+ return false;
}
- }
-
- private static BusinessList getBusinessList(String token) throws Exception {
- FindBusiness fb = new FindBusiness();
- fb.setAuthInfo(token);
- org.uddi.api_v3.FindQualifiers fq = new org.uddi.api_v3.FindQualifiers();
- fq.getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
- fb.setFindQualifiers(fq);
- fb.getName().add((new Name(UDDIConstants.WILDCARD, null)));
- return inquiry.findBusiness(fb);
- }
-
- private static void SaveMary(String rootAuthToken) throws Exception {
- BusinessEntity be = new BusinessEntity();
- be.setBusinessKey("uddi:uddi.marypublisher.com:marybusinessone");
- be.setDiscoveryURLs(new DiscoveryURLs());
- be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("home", "http://www.marybusinessone.com"));
- be.getDiscoveryURLs().getDiscoveryURL().add(new DiscoveryURL("serviceList", "http://www.marybusinessone.com/services"));
- be.getName().add(new Name("Mary Doe Enterprises", "en"));
- be.getName().add(new Name("Maria Negocio Uno", "es"));
- be.getDescription().add(new Description("This is the description for Mary Business One.", "en"));
- be.setContacts(new Contacts());
- Contact c = new Contact();
- c.setUseType("administrator");
- c.getPersonName().add(new PersonName("Mary Doe", "en"));
- c.getPersonName().add(new PersonName("Juan Doe", "es"));
- c.getDescription().add(new Description("This is the administrator of the service offerings.", "en"));
- be.getContacts().getContact().add(c);
- SaveBusiness sb = new SaveBusiness();
- sb.setAuthInfo(rootAuthToken);
- sb.getBusinessEntity().add(be);
- publish.saveBusiness(sb);
- }
-
- private static boolean CheckFor(BusinessList list, String key) {
- for (int i = 0; i < list.getBusinessInfos().getBusinessInfo().size(); i++) {
- if (list.getBusinessInfos().getBusinessInfo().get(i).getBusinessKey().equalsIgnoreCase(key)) {
- return true;
- }
+
+ private static void SaveTM(TModel createKeyGenator, String uddi) throws Exception {
+ SaveTModel stm = new SaveTModel();
+ stm.setAuthInfo(uddi);
+ stm.getTModel().add(createKeyGenator);
+ publish.saveTModel(stm);
}
- return false;
- }
-
- private static void SaveTM(TModel createKeyGenator, String uddi) throws Exception {
- SaveTModel stm = new SaveTModel();
- stm.setAuthInfo(uddi);
- stm.getTModel().add(createKeyGenator);
- publish.saveTModel(stm);
- }
}
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/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 b26e631..1ed62db 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 java.io.File;
import java.io.FileInputStream;
import java.math.BigInteger;
import java.rmi.RemoteException;
@@ -43,7 +42,6 @@ import org.apache.juddi.v3.client.transport.TransportException;
import org.apache.juddi.v3_service.JUDDIApiPortType;
import org.uddi.api_v3.Contact;
import org.uddi.api_v3.Description;
-import org.uddi.api_v3.DispositionReport;
import org.uddi.api_v3.Email;
import org.uddi.api_v3.GetAuthToken;
import org.uddi.api_v3.PersonName;
@@ -64,11 +62,8 @@ import org.uddi.v3_service.UDDISecurityPortType;
*/
public class JuddiAdminService {
- // private static UDDISecurityPortType security = null;
- // private static UDDIPublicationPortType publish = null;
- static JUDDIApiPortType juddi = null;
- // static UDDIClerk clerk = null;
- static UDDIClient clerkManager = null;
+ private JUDDIApiPortType juddi = null;
+ private UDDIClient clerkManager = null;
public JuddiAdminService(UDDIClient client, Transport transport) {
try {
@@ -302,7 +297,7 @@ public class JuddiAdminService {
}
if (input.equalsIgnoreCase("d")) {
//save the changes
- DispositionReport setReplicationNodes = juddiApiService.setReplicationNodes(authtoken, replicationNodes);
+ juddiApiService.setReplicationNodes(authtoken, replicationNodes);
System.out.println("Saved!, dumping config from the server");
replicationNodes = juddiApiService.getReplicationNodes(authtoken);
JAXB.marshal(replicationNodes, System.out);
@@ -483,8 +478,6 @@ public class JuddiAdminService {
void autoMagic123() throws Exception {
//1 > 2 >3 >1
- List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
-
Transport transport = clerkManager.getTransport("default");
String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
@@ -564,8 +557,6 @@ public class JuddiAdminService {
void autoMagicDirected() throws Exception {
//1 > 2 >3 >1
- List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
-
Transport transport = clerkManager.getTransport("default");
String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
@@ -665,8 +656,6 @@ public class JuddiAdminService {
void autoMagic() throws Exception {
- List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
-
Transport transport = clerkManager.getTransport("default");
String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
@@ -683,7 +672,7 @@ public class JuddiAdminService {
}
//if (replicationNodes.getCommunicationGraph() == null) {
- replicationNodes.setCommunicationGraph(new CommunicationGraph());
+ replicationNodes.setCommunicationGraph(new CommunicationGraph());
//}
Operator op = new Operator();
op.setOperatorNodeID("uddi:juddi.apache.org:node1");
@@ -728,8 +717,6 @@ public class JuddiAdminService {
void autoMagic3() throws Exception {
- List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
-
Transport transport = clerkManager.getTransport("default");
String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
@@ -919,7 +906,17 @@ public class JuddiAdminService {
= 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());
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(System.getProperty("javax.net.ssl.keyStore"));
+ ks.load(fis, System.getProperty("javax.net.ssl.keyStorePassword").toCharArray());
+ } catch (Exception ex) {
+
+ } finally {
+ if (fis != null) {
+ fis.close();
+ }
+ }
kmf.init(ks, System.getProperty("javax.net.ssl.keyStorePassword").toCharArray());
@@ -943,7 +940,6 @@ public class JuddiAdminService {
void autoMagicDirectedSSL() throws Exception {
//1 > 2 >3 >1
- List<Node> uddiNodeList = clerkManager.getClientConfig().getUDDINodeList();
Transport transport = clerkManager.getTransport("default");
String authtoken = transport.getUDDISecurityService().getAuthToken(new GetAuthToken("root", "root")).getAuthInfo();
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SearchByQos.java
----------------------------------------------------------------------
diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SearchByQos.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SearchByQos.java
index 025e617..c773561 100644
--- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SearchByQos.java
+++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SearchByQos.java
@@ -90,12 +90,12 @@ public class SearchByQos {
security = transport.getUDDISecurityService();
publish = transport.getUDDIPublishService();
inquiry = transport.getUDDIInquiryService();
- //step one, get a token
+ //step one, get a token
//GetAuthToken getAuthTokenRoot = new GetAuthToken();
//getAuthTokenRoot.setUserID("uddi");
//getAuthTokenRoot.setCred("uddi");
- // Making API call that retrieves the authentication token for the 'root' user.
+ // Making API call that retrieves the authentication token for the 'root' user.
//String rootAuthToken = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
String uddi = token;// security.getAuthToken(getAuthTokenRoot).getAuthInfo();
@@ -145,7 +145,7 @@ public class SearchByQos {
}
public static void doFindBinding(String token) throws Exception {
- // create a manager and read the config in the archive;
+ // create a manager and read the config in the archive;
// you can use your config file name
UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
Transport transport = clerkManager.getTransport();
@@ -153,12 +153,12 @@ public class SearchByQos {
security = transport.getUDDISecurityService();
publish = transport.getUDDIPublishService();
inquiry = transport.getUDDIInquiryService();
- //step one, get a token
+ //step one, get a token
// GetAuthToken getAuthTokenRoot = new GetAuthToken();
//getAuthTokenRoot.setUserID("uddi");
//getAuthTokenRoot.setCred("uddi");
- // Making API call that retrieves the authentication token for the 'root' user.
+ // Making API call that retrieves the authentication token for the 'root' user.
//String rootAuthToken = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
String uddi = token;//security.getAuthToken(getAuthTokenRoot).getAuthInfo();
@@ -181,7 +181,6 @@ public class SearchByQos {
} else {
System.out.println(before.getBindingTemplate().size() + " service returned before");
}
-
System.out.println("saving mary");
SaveMary(uddi);
@@ -205,16 +204,11 @@ public class SearchByQos {
System.out.println(p.print(before));
System.out.println(p.print(after));
}
-
-
-
}
-
-
public static void doFindBusiness(String token) throws Exception {
- // create a manager and read the config in the archive;
+ // create a manager and read the config in the archive;
// you can use your config file name
UDDIClient clerkManager = new UDDIClient("META-INF/simple-publish-uddi.xml");
Transport transport = clerkManager.getTransport();
@@ -222,12 +216,12 @@ public class SearchByQos {
security = transport.getUDDISecurityService();
publish = transport.getUDDIPublishService();
inquiry = transport.getUDDIInquiryService();
- //step one, get a token
+ //step one, get a token
// GetAuthToken getAuthTokenRoot = new GetAuthToken();
//getAuthTokenRoot.setUserID("uddi");
//getAuthTokenRoot.setCred("uddi");
- // Making API call that retrieves the authentication token for the 'root' user.
+ // Making API call that retrieves the authentication token for the 'root' user.
//String rootAuthToken = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
String uddi = token;//security.getAuthToken(getAuthTokenRoot).getAuthInfo();
@@ -242,10 +236,9 @@ public class SearchByQos {
System.out.println("saving...");
SaveTM(createKeyGenator, uddi);
-
- System.out.println("fetching business list");
- BusinessList before2 = getBusinessList(uddi);
- if (before2.getBusinessInfos()== null) {
+ System.out.println("fetching business list");
+ BusinessList before2 = getBusinessList(uddi);
+ if (before2.getBusinessInfos() == null) {
System.out.println("before no service returned!");
// before.setServiceInfos(new ServiceInfos());
} else {
@@ -255,14 +248,12 @@ public class SearchByQos {
System.out.println("saving mary");
SaveMary(uddi);
-
-
-
- BusinessList after2 = getBusinessList(uddi);
-
+ BusinessList after2 = getBusinessList(uddi);
+
PrintUDDI<BusinessList> p2 = new PrintUDDI<BusinessList>();
- if (before2.getBusinessInfos()==null )
+ if (before2.getBusinessInfos() == null) {
before2.setBusinessInfos(new BusinessInfos());
+ }
if ((before2.getBusinessInfos().getBusinessInfo().size()
< after2.getBusinessInfos().getBusinessInfo().size())) {
System.out.println("hey it worked as advertised. Here's all the business with QOS parameters");
@@ -302,7 +293,7 @@ public class SearchByQos {
}
}
}
-
+
private static BusinessList getBusinessList(String token) throws Exception {
FindBusiness fb = new FindBusiness();
fb.setAuthInfo(token);
http://git-wip-us.apache.org/repos/asf/juddi/blob/de1de4c4/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java
----------------------------------------------------------------------
diff --git a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java
index 0bd8085..cb62e1b 100644
--- a/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java
+++ b/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/SimpleBrowse.java
@@ -49,18 +49,18 @@ import org.uddi.v3_service.UDDISecurityPortType;
*/
public class SimpleBrowse {
- private static UDDISecurityPortType security = null;
- private static UDDIInquiryPortType inquiry = null;
+ private UDDISecurityPortType security = null;
+ private UDDIInquiryPortType inquiry = null;
/**
* This sets up the ws proxies using uddi.xml in META-INF
*/
public SimpleBrowse() {
try {
- // create a manager and read the config in the archive;
+ // create a manager and read the config in the archive;
// you can use your config file name
UDDIClient client = new UDDIClient("META-INF/simple-browse-uddi.xml");
- // a UDDIClient can be a client to multiple UDDI nodes, so
+ // 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 = client.getTransport("default");
@@ -217,7 +217,7 @@ public class SimpleBrowse {
}
for (int i = 0; i < bindingTemplates.getBindingTemplate().size(); i++) {
System.out.println("Binding Key: " + bindingTemplates.getBindingTemplate().get(i).getBindingKey());
- //TODO The UDDI spec is kind of strange at this point.
+ //TODO The UDDI spec is kind of strange at this point.
//An access point could be a URL, a reference to another UDDI binding key, a hosting redirector (which is
//esscentially a pointer to another UDDI registry) or a WSDL Deployment
//From an end client's perspective, all you really want is the endpoint.
@@ -282,8 +282,6 @@ public class SimpleBrowse {
return null;
}
-
-
private void PrintBusinessInfo(BusinessInfos businessInfos) {
if (businessInfos == null) {
System.out.println("No data returned");
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org