Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002.

Similar presentations


Presentation on theme: "Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002."— Presentation transcript:

1 Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002

2 Agenda Motivation Overview of Design Overview of Implementation Status of Implementation Discussion of Future Plans

3 Motivation

4 Why another object layer? Design of new Annotation Tool –prompted a review of the current method for interacting with the database from Java –current annotator interface queries with JDBC and writes XML which is parsed and processed using a Perl ga-plugin –avoid having to update class files on client machines particularly since interacting with development database –avoid having SQL generated on client machines Long term goal of being able to serve generic objects to the public (for example using BioJava)

5 Options Considered SOAP Java Objects and CORBA Java Objects and Java RMI –Supports dynamic class loading –Automatic garbage collection –Decided to use –Port to use CORBA fairly straightforward, if desired

6 Object-Relational Layer Design

7 Overview of Design Based on Perl Object-Relational Layer Utility Classes Objects mapped to tables in GUS 3.0 Code Generator Relationships modeled as parent/child Accessible using Java RMI Remote Interface for the GUS Server Implementation of the remote GUS Server Client uses remote GUS Server to obtain GUS objects (by value)

8 Overview of Design (continued) Remote GUS Server GUSdev (GUS3.0) GUS Objects (Serializable) …

9 Overview of Implementation

10 Utility Classes cbil.gus.Objects.GUS30.util Code Generator GUS30::GUS_utils::JavaGenerator.pm Remote Interfaces RemoteGUSServer, RemoteGUSJDBCServer Running remote GUSServer and Client access

11 cbil.gus.Objects.GUS30.util GUSJDBCServerGUSObjectCache GUSRowGUSTableAttributeGUSTable GUSTableRelation Generated Subclasses of GUSRow for each table/view GUSServer SQLutils

12 Implementation: RemoteGUSServer public String openConnection(String usr, String pswd) throws RemoteException,GUSException; Verifies username/password Creates a GUSConnection, including an instance of GUSJDBCServer (connection to GUSdev) Saves off some information about the connection Returns a session id (String) public GUSRow retrieveObject(GUSSession session, String owner, String tname, Integer pk) throws RemoteException, GUSException, SQLException; Verifies valid session and password Queries database to retrieve requested row Returns an instance of owner.tablename (eg. Core.Workflow)

13 Implementation: RemoteGUSServer public GUSRow submitObject(GUSSession session, GUSRow obj) throws RemoteException, GUSException, SQLException; Verifies session and password Submits object to database Submits children to database Returns updated object public GUSRow createObject(GUSSession session, String pswd, String owner, String tname) throws RemoteException, GUSException; Verifies username/password Returns a new instance of the specified class (owner.tname)

14 Implementation: RemoteGUSServer public List getSessionHistory(GUSSession session) throws RemoteException, GUSException; Verifies session and password Returns a List of transactions in this session public void closeConnection(GUSSession session) throws RemoteException, GUSException; Verifies session and password Closes GUSConnection Etc. (getParent, getChildren, … )

15 Code Generation Execute command file: –CreateAllJavaObjects.cmd –should be executed from directory where want objects created Calls generateGusJavaObjects.pl –generateGusJavaObjects.pl --login GUSrw --database GUS30 --specialCases./gus_special_cases –Same as generateGusPerlObjects.pl, but uses different code generation package

16 Code Generation (continued) Uses JavaGenerator.pm Creates java source files: –./ /.java –./ /gen/ _gen.java –./ /gen/ _tbl.java Compiles all generated code –currently assumes java is in your path –hand_edited code not ported to Java yet

17 Starting Remote GUS Server // to generate stubs and skeletons rmic -d /home/diskins/java_dev/GUS/java/ GUSServer rmic -d /home/diskins/java_dev/GUS/java/ GUS_JDBC_Server // start the rmiregistry rmiregistry & // to start the remote GUSServer - without a codebase... java \ -Djava.security.policy=/home/diskins/RMIServer/policy.txt \ -Djava.rmi.server.logCalls=true \ GUSServer \ >& GUSServer.log &

18 GUSServer registered with rmiregistry public static void main(String[] args) { try { GUSServer server = new GUSServer(); String name = System.getProperty("gusservername", "GUSServer_1") ; Naming.rebind(name, server); System.out.println(name + " is bound in RMIRegistry and ready to serve."); } catch ( Exception e ) { System.err.println(e); System.err.println("Usage: java [-Dgusservername= ] " + "GUSServer"); System.exit(1); //force exit cause may be hanging RMI threads. }

19 Client access to remote GUSServer public static void main (String argv[]) {... try { // Get a reference to the Remote GUS Server object... System.out.println("Looking for remote GUS Server..."); String name = "rmi:///GUSServer_1";//here assumes local machine... RemoteGUSServer gi = (RemoteGUSServer)Naming.lookup(name); System.out.println("Obtained reference to remote GUS Server"); // Open a session with the remote GUS Server Object... String session = gi.openConnection(user, password); System.out.println("New Session is : " + session + "\n"); … }catch (Exception e) { System.err.println(e); e.printStackTrace(); }

20 Status of Implementation

21 What “works” now Code Generation (except hand edited) RMI Server accepting connections Create new objects (subclasses of GUSRow) Set attribute values Set / Get parent Set / Get child (ren) Simple submits: insert, update, delete –Deep submits not fully tested yet Basic error checking –Username/password, valid attributes, etc.

22 What still needs to be done More error checking/handling –Read/write permissions (config file initialization) Port “Hand edited” classes to Java Evidence and Similarity handling Test, test, test

23 Future Plans

24 Discussion of Possible Plans GUSApplication for Java –May help with submits –Could also just be handled by GUSServer –CBIL effort ? BioJava Wrappers to GUS Java Objects –Would aid in java interface implementations –Could be served to the public –Sanger (or joint) effort ? Sanger – BioJava expertise CBIL – Schema and GUS Java object expertise –Perhaps start with educated estimate of resource requirements


Download ppt "Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002."

Similar presentations


Ads by Google