[MOBY-guts] biomoby commit

senger@ebi.ac.uk senger at pub.open-bio.org
Sun Mar 2 20:48:26 UTC 2003


senger
Sun Mar  2 15:48:26 EST 2003
Update of /home/repository/moby/moby-live/Java/org/biomoby/shared
In directory pub.open-bio.org:/tmp/cvs-serv25704/org/biomoby/shared

Modified Files:
	Central.java Makefile Utils.java 
Added Files:
	MobyDataType.java MobyException.java MobyNamespace.java 
	MobyService.java MobyServiceType.java NoSuccessException.java 
	package.html 
Removed Files:
	BiomobyException.java 
Log Message:
updated Moby in Java, add new client, add documentation
moby-live/Java/org/biomoby/shared MobyDataType.java,NONE,1.1 MobyException.java,NONE,1.1 MobyNamespace.java,NONE,1.1 MobyService.java,NONE,1.1 MobyServiceType.java,NONE,1.1 NoSuccessException.java,NONE,1.1 package.html,NONE,1.1 Central.java,1.1,1.2 Makefile,1.1,1.2 Utils.java,1.1,1.2 BiomobyException.java,1.1,NONE
===================================================================
RCS file: /home/repository/moby/moby-live/Java/org/biomoby/shared/Central.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/org/biomoby/shared/Central.java	2003/02/27 16:28:29	1.1
+++ /home/repository/moby/moby-live/Java/org/biomoby/shared/Central.java	2003/03/02 20:48:26	1.2
@@ -12,11 +12,11 @@
 import java.net.*;
 
 /**
- * An interface to the Moby Registry service.
+ * An interface to the Moby Registry.
  *<p>
  *
  * The Moby Registry service (or Moby Central service) is used to do
- * various transactions, including registering new Object and Service
+ * various transactions, including registering new Data and Service
  * types, querying for these types, registering new Services, or
  * querying for available services given certain input/output or
  * service type constraints.
@@ -26,8 +26,7 @@
  * functionality in Java language, and to hide complexity of the
  * parameters required by the Moby Registry. The Moby Registry gets
  * most parameters as small XML documents while this interface defines
- * the same parameters as various Java method signatures. For
- * example:... TBD
+ * the same parameters as various Java method signatures.
  *<p>
  *
  * For details describing and explaining the methods see the original documentation at
@@ -45,123 +44,223 @@
     /**************************************************************************
      * Get a (redundant) list of all registered service names.
      *<p>
-     * @throws BiomobyException if communication with the Moby Registry fails
+     * @return a hash table where keys are names of services while
+     *         values are their authorities
+     * @throws MobyException if communication with the Moby Registry fails
      *************************************************************************/
-    String[] retrieveServiceNames()
-	throws BiomobyException;
+    Map getServiceNames()
+	throws MobyException;
 
-//     /**************************************************************************
-//      * Get the list of all provider's AuthURI's.
-//      *<p>
-//      * @throws BiomobyException if communication with the Moby Registry fails
-//      *************************************************************************/
-//     String[] retrieveServiceProviders()
-// 	throws BiomobyException;
+    /**************************************************************************
+     * Get the list of all providers (each provider is represented by an
+     * authority's URI.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     *************************************************************************/
+    String[] getProviders()
+	throws MobyException;
 
-//     /**************************************************************************
-//      * Get the list of all registered service types.
-//      *<p>
-//      * @throws BiomobyException if communication with the Moby Registry fails
-//      *************************************************************************/
-//     String[] retrieveServiceTypes()
-// 	throws BiomobyException;
+    /**************************************************************************
+     * Get the list of all registered service types.
+     *<p>
+     * @return a hash table where keys are names of service types while
+     *         values are their descriptions
+     * @throws MobyException if communication with the Moby Registry fails
+     *************************************************************************/
+    Map getServiceTypes()
+	throws MobyException;
 
-//     /**************************************************************************
-//      * Get the list of all registered namespaces.
-//      *<p>
-//      * @throws BiomobyException if communication with the Moby Registry fails
-//      *************************************************************************/
-//     String[] retrieveNamespaces()
-// 	throws BiomobyException;
+    /**************************************************************************
+     * Get the list of all registered namespaces.
+     *<p>
+     * @return a hash table where keys are names of namespaces while
+     *         values are their descriptions
+     * @throws MobyException if communication with the Moby Registry fails
+     *************************************************************************/
+    Map getNamespaces()
+	throws MobyException;
 
-//     /**************************************************************************
-//      * Get the list of all registered Object types.
-//      *<p>
-//      * @throws BiomobyException if communication with the Moby Registry fails
-//      *************************************************************************/
-//     String[] retrieveObjectNames()
-// 	throws BiomobyException;
+    /**************************************************************************
+     * Get the list of all registered data types.
+     *<p>
+     * @return a hash table where keys are names of data types while
+     *         values are their descriptions
+     * @throws MobyException if communication with the Moby Registry fails
+     *************************************************************************/
+    Map getDataTypeNames()
+	throws MobyException;
 
+    /*************************************************************************
+     * Get XML Schema definition of the given data type.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if 'dataTypeName' was not found
+     *************************************************************************/
+    String getDataType (String dataTypeName)
+	throws MobyException, NoSuccessException;
 
+    /*************************************************************************
+     * Get WSDL defining a service given by its name and its authority.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if such service was not found
+     *************************************************************************/
+    String getServiceWSDL (String serviceName, String authority)
+	throws MobyException, NoSuccessException;
 
-//     /**************************************************************************
-//      * Get the service names/descriptions for a particular type of
-//      * Service (and child-types).
-//      *************************************************************************/
-//     String locateServiceByType (MobyCentral moby,
-// 				String serviceType,
-// 				int maxReturn,
-// 				int expand);
+    /*************************************************************************
+     * Get WSDL defining a service given by its name.
+     * The method asks for all services first and then uses the first one
+     * matches the given name.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if such service was not found
+     * @see #getServiceWSDL(String,String)
+     *************************************************************************/
+    String getServiceWSDL (String serviceName)
+	throws MobyException, NoSuccessException;
+
+    /*************************************************************************
+     * Register new data type. It also updates 'dataType' with an ID given
+     * by the registration process - this ID will be the only way how to
+     * de-register this data type later.
+     *<p>
+     * If the same data type is already registered, it is overwritten.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if registration failed
+     *************************************************************************/
+    void registerDataType (MobyDataType dataType)
+	throws MobyException, NoSuccessException;
 
-//     /**************************************************************************
-//      * Get the names/descriptions for services that use certain INPUT's.
-//      *************************************************************************/
-//     String locateServiceByInput (MobyCentral moby,
-//                                  String[] inputTypes,
-// 				 String[] namespaces,
-// 				 String serviceType,
-// 				 String providerName,
-// 				 int maxReturn,
-// 				 int fullObjects,
-// 				 int fullServices);
+    /*************************************************************************
+     * Unregister given Moby data type. Note that it may not work if the
+     * given object does not contain registration ID. But this may change
+     * in the future.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if unregistration failed
+     *************************************************************************/
+    void unregisterDataType (MobyDataType dataType)
+	throws MobyException, NoSuccessException;
 
-//     /**************************************************************************
-//      * Get the names/descriptions for services that use certain OUTPUT.
-//      *************************************************************************/
-//     String locateServiceByoutput (MobyCentral moby,
-// 				  String outputType,
-// 				  String[] namespaces,
-// 				  String serviceType,
-// 				  String providerName,
-// 				  int maxReturn,
-// 				  int fullObjects,
-// 				  int fullServices);
+    /*************************************************************************
+     * Register new service type. It also updates 'serviceType' with an ID
+     * given by the registration process - this ID will be the only way how to
+     * de-register this service type later.
+     *<p>
+     * If the same service type is already registered, it is <b>not</b>
+     * overwritten but an exception is raised.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if registration failed
+     *************************************************************************/
+    void registerServiceType (MobyServiceType serviceType)
+	throws MobyException, NoSuccessException;
 
-//     /**************************************************************************
-//      * Get the WSDL descriptions for services with this service name.
-//      *************************************************************************/
-//     String retrieveService (MobyCentral moby,
-// 			    String providerName,
-// 			    String serviceName);
+    /*************************************************************************
+     * Unregister given Moby service type. Note that it may not work if the
+     * given object does not contain registration ID. But this may change
+     * in the future.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if unregistration failed
+     *************************************************************************/
+    void unregisterServiceType (MobyServiceType serviceType)
+	throws MobyException, NoSuccessException;
 
-//     /**************************************************************************
-//      * Get the object xsd.
-//      *************************************************************************/
-//     String retrieveObject (MobyCentral moby,
-// 			   String objectName);
+    /*************************************************************************
+     * Register new namespace. It also updates 'namespace' with an ID
+     * given by the registration process - this ID will be the only way how to
+     * de-register this namespace later.
+     *<p>
+     * If the same namespace is already registered, it is overwritten.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if registration failed
+     *************************************************************************/
+    void registerNamespace (MobyNamespace namespace)
+	throws MobyException, NoSuccessException;
 
-    /**************************************************************************
-     * Register a new Object type, and its relationships, or modify existing.
+    /*************************************************************************
+     * Unregister given Moby namespace. Note that it may not work if the
+     * given object does not contain registration ID. But this may change
+     * in the future.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if unregistration failed
      *************************************************************************/
-    /* ... registerObject (MobyCentral moby, ...) */
+    void unregisterNamespace (MobyNamespace namespace)
+	throws MobyException, NoSuccessException;
 
-    /**************************************************************************
-     * De-register an Object type, and its relationships.
+    /*************************************************************************
+     * Register a new service. It also updates 'service' with an ID
+     * given by the registration process - this ID will be the only way how to
+     * de-register this service later.
+     *<p>
+     * If the same service type is already registered, it is <b>not</b>
+     * overwritten but an exception is raised.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if registration failed
      *************************************************************************/
-    /* ... deregisterObject (MobyCentral moby, ...) */
+    void registerService (MobyService service)
+	throws MobyException, NoSuccessException;
 
-    /**************************************************************************
-     * Register a new Service type, and its relationships.
+    /*************************************************************************
+     * Unregister given Moby service. Note that it may not work if the
+     * given object does not contain registration ID. But this may change
+     * in the future.
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+     * @throws NoSuccessException if unregistration failed
      *************************************************************************/
-    /* ... registerServiceType (MobyCentral moby, ...) */
+    void unregisterService (MobyService service)
+	throws MobyException, NoSuccessException;
 
     /**************************************************************************
-     * Register a new Namespace.
+     * Find services of the given type and its sub-types.
+     *<p>
+     * @return services of the given type and all sub-typesd,
+     *         or an empty array if none was found
+     * @throws MobyException if communication with the Moby Registry fails
      *************************************************************************/
-    /* ... registerNamespace (MobyCentral moby, ...) */
+    MobyService[] findService (String serviceType)
+	throws MobyException;
 
     /**************************************************************************
-     * Register a new MOBY Service.
-     *************************************************************************/
-    /* ... registerService (MobyCentral moby, ...) */
+     * Find services by given keywords. More keywords are treated as
+     * logical OR.
+     *<p>
+     * @return services containing given keywords,
+     *         or an empty array if none was found
+     * @throws MobyException if communication with the Moby Registry fails
+     *************************************************************************/
+    MobyService[] findService (String[] keywords)
+	throws MobyException;
 
     /**************************************************************************
-     * Register a new Service type, and its relationships, via WSDL.
-     *************************************************************************/
-    /* ... registerServiceWSDL (MobyCentral moby, ...) */
+     * Find services by their input and/or output data types. If the 'pattern'
+     * has a non-empty array of input data types, it looks for services with
+     * such inputs. If the 'pattern' has a non-empty array of output data
+     * types, it looks for services with such outputs. If both input and
+     * output data types are present, the returned set is a intersection.
+     *<p>
+     * Note that some other fields of the 'pattern' must be filled as well
+     * (at the moment of writting this these fields are: type and authority).
+     *<p>
+     * @throws MobyException if communication with the Moby Registry fails
+    *************************************************************************/
+    MobyService[] findService (MobyService pattern)
+	throws MobyException;
 
     /**************************************************************************
-     * Deregister a Service.
+     * Call Moby registry's method with given XML as input and return whatever
+     * you get back. If 'inputXML' is null or empty, the method is called
+     * without any parameters.
+     *<p>
+     * Meant for debugging and may be deprecated anytime...
      *************************************************************************/
-    /* ... deregisterService (MobyCentral moby, ...) */
+    String call (String methodName, String inputXML)
+	throws MobyException;
 }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/org/biomoby/shared/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/org/biomoby/shared/Makefile	2003/02/27 16:28:29	1.1
+++ /home/repository/moby/moby-live/Java/org/biomoby/shared/Makefile	2003/03/02 20:48:26	1.2
@@ -4,8 +4,10 @@
 #
 # -----------------------------------------------------------------------------
 
-SOURCE += BiomobyException
+SOURCE += MobyException NoSuccessException
 SOURCE += Utils
+SOURCE += MobyDataType MobyNamespace
+SOURCE += MobyServiceType MobyService
 SOURCE += Central
 
 # submodules

===================================================================
RCS file: /home/repository/moby/moby-live/Java/org/biomoby/shared/Utils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/org/biomoby/shared/Utils.java	2003/02/27 16:28:29	1.1
+++ /home/repository/moby/moby-live/Java/org/biomoby/shared/Utils.java	2003/03/02 20:48:26	1.2
@@ -15,7 +15,7 @@
 
 /**
  * This is a set of several utility methods which may be useful for
- * writting both registry and client code. Some methods are specific
+ * writing both registry and client code. Some methods are specific
  * for Apache Axis framework.
  *<P>
  * @author <A HREF="mailto:senger at ebi.ac.uk">Martin Senger</A>
@@ -26,16 +26,19 @@
 
     /** Java property name ('dom.parser').
      *  The property value is a fully qualified name of a class of type
-     *  <tt>dom.ParserWrapper</tt>.
+     *  <tt>org.biomoby.shared.dom.ParserWrapper</tt>.
      */
     public static final String PROP_PARSER_WRAPPER = "dom.parser";
 
     /** Default parser wrapper. */
-    protected static final String DEFAULT_PARSER_WRAPPER =
+    public static final String DEFAULT_PARSER_WRAPPER =
 	"org.biomoby.shared.dom.wrappers.Xerces";
 
     /*************************************************************************
      * Format an exception 'e' and return it back.
+     *<p>
+     * @param e an exception to e formatted
+     * @return a formatted exception
      *************************************************************************/
     public static String formatFault (AxisFault e) {
 	return formatFault (e, null, null);
@@ -45,7 +48,12 @@
      * Return a nicely formatted exception 'e' with few additional details
      * taken from 'endpoint' (where is the called service) and 'method'
      * (what method caused this exception).
-     *************************************************************************/
+     *<p>
+     * @param e an exception to e formatted
+     * @param endpoint of a service that caused the exception
+     * @param method that caused the exception
+     * @return a formatted exception
+    *************************************************************************/
     public static String formatFault (AxisFault e,
 				      String endpoint, QName method) {
 	StringBuffer buf = new StringBuffer();
@@ -94,14 +102,39 @@
     }
 
     /*************************************************************************
-     * Get a DOM parser - the one specified by a Java property
-     * {@link #PROP_PARSER_WRAPPER}, or the one specified by 'parserClassName',
-     * or a default one {@link #DEFAULT_PARSER_WRAPPER} (in this order).
-     * <p>
-     * @throws
+     * Find and return an instance of a DOM parser wrapper. A parser
+     * wrapper is a class allowing a uniform access to DOM parsers -
+     * because it defines a way how a Document is created and returned
+     * (see details in interface
+     * <tt>org.biomoby.shared.dom.ParseWrappers</tt>, or in samples in
+     * the distribution of Apache Xerces-2 where this is all taken
+     * from).
+     *<p>
+     *
+     * The DOM parser wrapper class name is taken from, in this order:
+     * <ol>
+     *  <li> Java property {@link #PROP_PARSER_WRAPPER}
+     *  <li> parameter <tt>parserClassName</tt>
+     *  <li> default value {@link #DEFAULT_PARSER_WRAPPER}
+     * </ol>
+     *<p>
+     *
+     * This is based on the samples shown int the Apache Xerces-2 distribution.
+     * See more details there. This implementation differ from those samples
+     * in few not too crucial details:
+     * <ul>
+     *  <li> It can take parser class name also from a Java property
+     *       ({@link #DEFAULT_PARSER_WRAPPER})
+     *  <li> It raises Moby specific exception
+     * </ul>
+     *<p>
+     * @param parserClassName is a class to be instatiated (unless there is
+     *        a Java property {@link #PROP_PARSER_WRAPPER})
+     * @return an instance of a DOM parser wrapper
+     * @throws MobyException if unable to instantiate specified DOM parser
      *************************************************************************/
     public static ParserWrapper getDOMParser (String parserClassName)
-	throws BiomobyException {
+	throws MobyException {
 
 	// which parser do we want
 	String name = System.getProperty (PROP_PARSER_WRAPPER);
@@ -115,12 +148,21 @@
 	    return (ParserWrapper)Class.forName (parserClassName).newInstance();
 	}
 	catch (Exception e) {
-	    throw new BiomobyException ("Unable to instantiate parser (" + parserClassName +")");
+	    throw new MobyException ("Unable to instantiate parser (" + parserClassName +")");
 	}
     }
 
+    /*************************************************************************
+     * Find and return an instance of a DOM parser wrapper.
+     * It does the same as method {@link #getDOMParser(String)} except that it
+     * does not get any parser class name in the parameter.
+     *<p>
+     * @return an instance of a DOM parser wrapper
+     * @see #getDOMParser(String)
+     * @throws MobyException if unable to instantiate specified DOM parser
+     *************************************************************************/
     public static ParserWrapper getDOMParser()
-	throws BiomobyException {
+	throws MobyException {
 	return getDOMParser (null);
     }
 }

rcsdiff: /home/repository/moby/moby-live/Java/org/biomoby/shared/RCS/BiomobyException.java,v: No such file or directory



More information about the MOBY-guts mailing list