MobyGenerator is a simple GUI utility to generate JAXB annotated Moby Ontology.
The utility uses MobyCentral to connect to the MobyCentral and obtain the ontology information.
The usage is pretty simple - choose the Moby Central and select where to save generated datatypes.jar file.
Now generator generates "soap-encoded" services based on ejb3 endpoints.
The only thing someone needs to make ejb3 based endpoint is to generate it!
(and put MobyCore.jar and MobyCoreServer.jar into your application or the server).
Even the utility is not supposed to be used often, I have added the cache of datatypes and services, so there is no need to reload it every time you start the utility.
Cache is implemented as an xml file that you can find in $user_home$/.MobyCentralCache/ directory
Finally, I removed the MobyRegistry dependence and cleaned up the code...
Also I have added a panel to generate an accessor methods for the services. This generates static
methods to call "moby" services. Even this task may be easily done by hand-coding, this could be useful
to get a template for the service call.
/*
* Converts aminoacid FASTA sequences into a collection of aminoacid sequences
*/
public static List<AminoAcidSequence> fromFASTAToAminoAcidSequenceCollection(FASTA_AA_multi sequences) throws MobyExceptions, Exception
{
MobySimple __mobyDataElement = new MobySimple(sequences, "sequences");
MobyData __mobyData = new MobyData(__mobyDataElement, "sip_1");
MobyMessage __request = new MobyMessage(__mobyData);
MobyServiceEndpoint __service = new MobyServiceEndpoint("http://genome.imim.es/cgi-bin/moby/MobyServices.cgi", "fromFASTAToAminoAcidSequenceCollection");
MobyMessage __response = __service.call(__request);
if (__response.hasExceptions())
{
throw __response.getExceptions();
}
ArrayList<MobyData> __list = __response.getMobyDataList();
if (__list.isEmpty())
{
throw new Exception("Empty response!");
}
MobyData __mData = __list.iterator().next();
List<MobyDataElement> __mDataList = __mData.getMobyDataElements();
if (__mDataList == null)
{
throw new Exception("no answer! (expected 'sequences')");
}
MobyDataElement __theOnlyObject = __mDataList.iterator().next();
if (!(__theOnlyObject instanceof MobyCollection))
{
throw new Exception("wrong answer (expected MobyCollection '', found MobySimple)");
}
MobyCollection<MobySimple> __mCollection = (MobyCollection<MobySimple>)__theOnlyObject;
if (!"sequences".equals(__mCollection.getArticleName()))
{
System.out.println("the response contains wrong article name : '" + __mCollection.getArticleName() + "' (expected 'sequences')... ignored.");
}
List<AminoAcidSequence> sequences$out = new ArrayList<AminoAcidSequence>();
for (MobySimple __simple : __mCollection)
{
AminoAcidSequence __object = __simple.getObject();
sequences$out.add(__object);
}
return sequences$out;
}