Version: 1.1.1

org.biomoby.service.generator
Class ServicesGenerator

java.lang.Object
  extended by org.biomoby.service.generator.Generator
      extended by org.biomoby.service.generator.ServicesGenerator

public class ServicesGenerator
extends Generator

A generator generating skeleton classes for Biomoby services. Such skeletons can be extended by a service-provider and she or he just fills there "business logic" (the real work of a service) without worrying about how to parse and create data in a Biomoby specific XML format.

The generated classes uses Biomoby data types that were also generated (see DataTypesGenerator).

Both services and data types are generated using information stored in a Biomoby registry. In other words, generating is possible only for entities that had been registered.

The best way how to find what it does for you is to use command-line client MosesGenerators and let it generate some classes, browse them and try to extend them. The examples and information which methods are available, and which methods must be implemented are in BaseService where all generated skeletons inherit from.

Start MosesGenerators either from a command-line using a script:

 build/run/run-generator -h
 
or using Ant:
 ant -Dmoses.service=MyService moses-services
 
The name MyService is the name under a service was registered in a Biomoby registry.

Version:
$Id: ServicesGenerator.java,v 1.8 2008/03/03 11:34:17 senger Exp $
Author:
Martin Senger

Field Summary
 
Fields inherited from class org.biomoby.service.generator.Generator
GPROP_AUTH, GPROP_DOTLOCATION, GPROP_FILTER, GPROP_NOGEN, GPROP_NOGRAPHS, GPROP_OUTDIR, GPROP_SERVICE, GPROP_VERBOSE
 
Constructor Summary
ServicesGenerator()
           
ServicesGenerator(CentralCached worker)
           
ServicesGenerator(String cacheDir)
           
ServicesGenerator(String registryEndpoint, String registryURI, String cacheDir)
           
 
Method Summary
 void generate(Properties props)
          Generate classes for service(s) from a given Biomoby registry.
 Map<String,File> getTemplateNames()
          Getting names of templates is isolated here so a sub-class can override it (but any new teplate still needs to follow the same patterns as the original template - so it is not too flexible, anyway).
 
Methods inherited from class org.biomoby.service.generator.Generator
getWorker, makeDirs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServicesGenerator

public ServicesGenerator()

ServicesGenerator

public ServicesGenerator(String cacheDir)
                  throws MobyException
Throws:
MobyException

ServicesGenerator

public ServicesGenerator(String registryEndpoint,
                         String registryURI,
                         String cacheDir)
                  throws MobyException
Throws:
MobyException

ServicesGenerator

public ServicesGenerator(CentralCached worker)
Method Detail

getTemplateNames

public Map<String,File> getTemplateNames()
Description copied from class: Generator
Getting names of templates is isolated here so a sub-class can override it (but any new teplate still needs to follow the same patterns as the original template - so it is not too flexible, anyway).

The values of returned Map are files. It their names are relative (which is the best way) then they are looked for in the CLASSPATH (including all jar files there).

Make sure that the returned path is correct for the system where JVM is running.

Specified by:
getTemplateNames in class Generator

generate

public void generate(Properties props)
              throws MobyException
Generate classes for service(s) from a given Biomoby registry. This is the main method.

Specified by:
generate in class Generator
Parameters:
props - are properties influencing the generated results
Throws:
MobyException - if anything goes wrong
See Also:
property GPROP_SERVICE, property GPROP_AUTH, property GPROP_OUTDIR, property GPROP_VERBOSE, property GPROP_NOGRAPHS, property GPROP_DOTLOCATION

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010