com.fuse.storage.sql
Class SQLDatabaseImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by com.fuse.storage.sql.SQLDatabaseImpl
All Implemented Interfaces:
FUSEDatabase, java.io.Serializable, java.rmi.Remote

public class SQLDatabaseImpl
extends java.rmi.server.UnicastRemoteObject
implements FUSEDatabase

SQLDatabase implements a simple database which stores data into SQL database thru JDBC.

See Also:
FUSEDataObject, Serialized Form

Field Summary
protected  java.util.Hashtable classCache
           
protected  DatabaseConnectionManager connMgr
           
protected static SQLDatabaseImpl localInstance
           
protected  java.util.Vector objectPackages
           
protected  java.util.Properties properties
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SQLDatabaseImpl(java.lang.String propFile)
           
 
Method Summary
 FUSEDataObject createNew(java.lang.String type)
          Constructs a FUSEDataObject of given type, which is compatible with the database implementation.
 void delete(FUSEDataObject dbObject)
          Deletes an object from the database
static SQLDatabaseImpl getLocalInstance()
           
 FUSEDataObject insert(FUSEDataObject dbObject)
          Stores an object
static void main(java.lang.String[] args)
          Starts up the SQLDatabaseImpl Usage: java .com.fuse.storage.SQL.SQLDatabaseImpl [rmiUrl]
 java.util.Vector query(ObjectQueryBean bean)
          Makes a query of data object from the database.
 java.lang.Object querySummary(SummaryQueryBean bean)
          Makes a query which returns some numeric information.
 FUSEDataObject update(FUSEDataObject dbObject)
          Updates an object in the database
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

connMgr

protected DatabaseConnectionManager connMgr

classCache

protected java.util.Hashtable classCache

objectPackages

protected java.util.Vector objectPackages

properties

protected java.util.Properties properties

localInstance

protected static SQLDatabaseImpl localInstance
Constructor Detail

SQLDatabaseImpl

public SQLDatabaseImpl(java.lang.String propFile)
                throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

main

public static void main(java.lang.String[] args)
Starts up the SQLDatabaseImpl Usage: java .com.fuse.storage.SQL.SQLDatabaseImpl [rmiUrl]


getLocalInstance

public static SQLDatabaseImpl getLocalInstance()

createNew

public FUSEDataObject createNew(java.lang.String type)
                         throws java.lang.ClassNotFoundException,
                                java.rmi.RemoteException
Constructs a FUSEDataObject of given type, which is compatible with the database implementation. The loaded object is typically named .: for example, if type is "FUSEUser" and we are using SQL implementation, the class is com.fuse.storage.sql.FUSEUserSQL

Specified by:
createNew in interface FUSEDatabase
Parameters:
type - object type, such as "FUSEUser" or "logentry"
Throws:
java.lang.ClassNotFoundException - if object not found
java.rmi.RemoteException

insert

public FUSEDataObject insert(FUSEDataObject dbObject)
                      throws DatabaseException,
                             java.rmi.RemoteException
Stores an object

Specified by:
insert in interface FUSEDatabase
Parameters:
dbObject - the object to store
Throws:
DatabaseException - if insertion failed
java.rmi.RemoteException

delete

public void delete(FUSEDataObject dbObject)
            throws DatabaseException,
                   java.rmi.RemoteException
Deletes an object from the database

Specified by:
delete in interface FUSEDatabase
Parameters:
dbObject - the data object to delete
Throws:
DatabaseException - if deleting failed
java.rmi.RemoteException

update

public FUSEDataObject update(FUSEDataObject dbObject)
                      throws DatabaseException,
                             java.rmi.RemoteException
Updates an object in the database

Specified by:
update in interface FUSEDatabase
Parameters:
dbObject - the data object to update
Throws:
DatabaseException
java.rmi.RemoteException

query

public java.util.Vector query(ObjectQueryBean bean)
                       throws DatabaseException,
                              java.rmi.RemoteException
Makes a query of data object from the database. The actual query is done by the ObjectQueryBean

Specified by:
query in interface FUSEDatabase
Parameters:
bean - the objectQueryBean which implements the query
Throws:
DatabaseException
java.rmi.RemoteException

querySummary

public java.lang.Object querySummary(SummaryQueryBean bean)
                              throws DatabaseException,
                                     java.rmi.RemoteException
Makes a query which returns some numeric information.

Specified by:
querySummary in interface FUSEDatabase
Parameters:
bean - the bean which implements the query
Throws:
DatabaseException
java.rmi.RemoteException