You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by sv...@apache.org on 2004/06/29 15:36:01 UTC
cvs commit: ws-juddi/samples/src SaveBusinessSample.java FindBusinessSample.java
sviens 2004/06/29 06:36:01
Modified: samples/src SaveBusinessSample.java FindBusinessSample.java
Log:
Updating Save & Find Samples after testing search by category bag functionality.
Revision Changes Path
1.2 +12 -3 ws-juddi/samples/src/SaveBusinessSample.java
Index: SaveBusinessSample.java
===================================================================
RCS file: /home/cvs/ws-juddi/samples/src/SaveBusinessSample.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SaveBusinessSample.java 30 May 2004 12:13:59 -0000 1.1
+++ SaveBusinessSample.java 29 Jun 2004 13:36:01 -0000 1.2
@@ -19,6 +19,7 @@
import java.util.Vector;
import org.apache.juddi.IRegistry;
+import org.apache.juddi.datatype.KeyedReference;
import org.apache.juddi.datatype.Name;
import org.apache.juddi.datatype.business.BusinessEntity;
import org.apache.juddi.datatype.request.AuthInfo;
@@ -27,9 +28,10 @@
import org.apache.juddi.datatype.response.DispositionReport;
import org.apache.juddi.datatype.response.ErrInfo;
import org.apache.juddi.datatype.response.Result;
+import org.apache.juddi.datatype.service.BusinessService;
+import org.apache.juddi.datatype.tmodel.TModel;
import org.apache.juddi.error.RegistryException;
import org.apache.juddi.proxy.RegistryProxy;
-import org.apache.juddi.util.Language;
/**
* @author Steve Viens (sviens@apache.org)
@@ -46,7 +48,6 @@
props.load(new FileInputStream(args[0]));
IRegistry registry = new RegistryProxy(props);
-
// Option #3 (explicitly set the proxy property values)
//Properties props = new Properties();
//props.setProperty(RegistryProxy.ADMIN_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/admin");
@@ -77,10 +78,18 @@
AuthToken authToken = registry.getAuthToken(userID,password);
AuthInfo authInfo = authToken.getAuthInfo();
+ BusinessService businessService = new BusinessService();
+ businessService.addName(new Name("Real-time Stock Quotes"));
+
// generate a BusinessEntity
BusinessEntity businessEntity = new BusinessEntity();
businessEntity.setBusinessKey(null);
- businessEntity.addName(new Name("Sun Microsystems",Language.ENGLISH));
+ businessEntity.addName(new Name("Sun Microsystems"));
+ businessEntity.addBusinessService(businessService);
+ businessEntity.addCategory(new KeyedReference("version","production"));
+ businessEntity.addCategory(new KeyedReference(TModel.OPERATORS_TMODEL_KEY,"frequency","hourly"));
+ businessEntity.addCategory(new KeyedReference(TModel.GENERAL_KEYWORDS_TMODEL_KEY,"version","production"));
+ businessEntity.addCategory(new KeyedReference("","",""));
// generate a BusinessEntity Vector
Vector businessVector = new Vector();
1.2 +17 -14 ws-juddi/samples/src/FindBusinessSample.java
Index: FindBusinessSample.java
===================================================================
RCS file: /home/cvs/ws-juddi/samples/src/FindBusinessSample.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FindBusinessSample.java 30 May 2004 12:13:59 -0000 1.1
+++ FindBusinessSample.java 29 Jun 2004 13:36:01 -0000 1.2
@@ -14,10 +14,13 @@
* limitations under the License.
*/
+import java.io.FileInputStream;
import java.util.Properties;
import java.util.Vector;
import org.apache.juddi.IRegistry;
+import org.apache.juddi.datatype.CategoryBag;
+import org.apache.juddi.datatype.KeyedReference;
import org.apache.juddi.datatype.Name;
import org.apache.juddi.datatype.response.BusinessInfo;
import org.apache.juddi.datatype.response.BusinessInfos;
@@ -39,19 +42,19 @@
//IRegistry registry = new RegistryProxy();
// Option #2 (import proxy property values from a specified properties file)
- //Properties props = new Properties();
- //props.load(new FileInputStream(args[0]));
- //IRegistry registry = new RegistryProxy(props);
+ Properties props = new Properties();
+ props.load(new FileInputStream(args[0]));
+ IRegistry registry = new RegistryProxy(props);
// Option #3 (explicitly set the proxy property values)
- Properties props = new Properties();
- props.setProperty(RegistryProxy.ADMIN_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/admin");
- props.setProperty(RegistryProxy.INQUIRY_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/inquiry");
- props.setProperty(RegistryProxy.PUBLISH_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/publish");
- props.setProperty(RegistryProxy.TRANSPORT_CLASS_PROPERTY_NAME,"org.apache.juddi.proxy.AxisTransport");
- props.setProperty(RegistryProxy.SECURITY_PROVIDER_PROPERTY_NAME,"com.sun.net.ssl.internal.ssl.Provider");
- props.setProperty(RegistryProxy.PROTOCOL_HANDLER_PROPERTY_NAME,"com.sun.net.ssl.internal.www.protocol");
- IRegistry registry = new RegistryProxy(props);
+// Properties props = new Properties();
+// props.setProperty(RegistryProxy.ADMIN_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/admin");
+// props.setProperty(RegistryProxy.INQUIRY_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/inquiry");
+// props.setProperty(RegistryProxy.PUBLISH_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/publish");
+// props.setProperty(RegistryProxy.TRANSPORT_CLASS_PROPERTY_NAME,"org.apache.juddi.proxy.AxisTransport");
+// props.setProperty(RegistryProxy.SECURITY_PROVIDER_PROPERTY_NAME,"com.sun.net.ssl.internal.ssl.Provider");
+// props.setProperty(RegistryProxy.PROTOCOL_HANDLER_PROPERTY_NAME,"com.sun.net.ssl.internal.www.protocol");
+// IRegistry registry = new RegistryProxy(props);
// Option #4 (Microsoft Test Site)
// Properties props = new Properties();
@@ -67,10 +70,10 @@
try
{
- Vector inNames = new Vector();
- inNames.add(new Name(args[0]));
+ CategoryBag catBag = new CategoryBag();
+ catBag.addKeyedReference(new KeyedReference("version","production"));
- BusinessList list = registry.findBusiness(inNames,null,null,null,null,null,100);
+ BusinessList list = registry.findBusiness(null,null,null,catBag,null,null,100);
BusinessInfos infos = list.getBusinessInfos();
Vector businesses = infos.getBusinessInfoVector();