xdrs_impl.genericdb
Class DBImplementation

java.lang.Object
  extended byxdrs_impl.genericdb.DBImplementation
Direct Known Subclasses:
HSQLDBImplementation, MySQLDBImplementation, PostgreSQLDBImplementation

public abstract class DBImplementation
extends java.lang.Object

An interface representing a way to access a specific data storage system. All implementations should contain implementations for mappings, which are links between paths and nodes stored in locations that can be handled by handlers implemented for the specific data storage system. There should at least be one handler that can support any type in a generic way. Also, a mechanism for storing arbitrary tags in an attribute location should be implemented. This attribute system could be used to implement a very basic handler where all tags are stored as attributes.


Constructor Summary
DBImplementation()
           
 
Method Summary
abstract  void addDNForUser(java.sql.Connection connection, java.lang.String user, java.lang.String dn)
           
abstract  void addGroup(java.sql.Connection connection, java.lang.String group, java.lang.String superGroup)
           
 void addMapping(java.sql.Connection connection, Mapping mapping, java.lang.String root, java.lang.String type, java.lang.String typeNamespace, int id, java.lang.String owner, java.lang.Object p7)
          Method addMapping
abstract  void addMapping(java.sql.Connection connection, Mapping parent, java.lang.String path, java.lang.String type, java.lang.String typeNamespace, int id, java.lang.String owner, java.lang.String readWriteGroup, java.lang.String readOnlyGroup)
          Store the described mapping.
abstract  void addUserToGroup(java.sql.Connection connection, java.lang.String user, java.lang.String group)
           
abstract  int addXML(java.sql.Connection connection, org.gjt.xpp.XmlNode node)
           
abstract  void create(java.sql.Connection connection)
          Create all tables etc.
protected  void createHandlers(java.sql.Connection connection)
          Create all tables etc.
abstract  void deleteAllDNsForUser(java.sql.Connection connection, java.lang.String user)
           
abstract  void deleteDNForUser(java.sql.Connection connection, java.lang.String user, java.lang.String dn)
           
abstract  void deleteGroup(java.sql.Connection connection, java.lang.String group)
           
abstract  void deleteMapping(java.sql.Connection connection, java.lang.String path)
          Delete the path's mapping.
abstract  void deleteUser(java.sql.Connection connection, java.lang.String user)
           
abstract  void deleteXML(java.sql.Connection connection, int id)
           
abstract  void drop(java.sql.Connection connection)
          Drop all the tables etc.
 void dropHandlers(java.sql.Connection connection)
          Drop all the tables etc.
abstract  boolean existsXML(java.sql.Connection connection, int id)
           
abstract  void getGroups(java.sql.Connection connection, java.lang.String user, java.util.Vector vector)
           
 Handler getHandler(java.lang.String type, java.lang.String typeNamespace)
          Get the handler for the given type.
abstract  Mapping getMapping(java.sql.Connection connection, int id)
           
abstract  Mapping getMapping(java.sql.Connection connection, java.lang.String path)
          Get a Mapping for the given path.
abstract  Mapping[] getMappings(java.sql.Connection connection, int parent)
          Get all of the mappings who have the given parent.
abstract  java.lang.String getUserForDN(java.sql.Connection connection, java.lang.String dn)
           
abstract  org.gjt.xpp.XmlNode getXML(java.sql.Connection connection, int id)
           
abstract  boolean isGroup(java.sql.Connection connection, java.lang.String name)
           
abstract  boolean isUser(java.sql.Connection connection, java.lang.String name)
           
abstract  java.lang.String[] keywordSearch(java.sql.Connection connection, java.lang.String[] keywords, boolean doAnd, int maxResults)
           
abstract  java.util.Vector listGroups(java.sql.Connection connection)
           
abstract  void listSubGroupsOfGroup(java.sql.Connection connection, java.lang.String group, java.util.Vector groups, boolean recurse)
           
abstract  java.util.Vector listUsers(java.sql.Connection connection)
           
abstract  void listUsersOfGroup(java.sql.Connection connection, java.lang.String group, java.util.Vector users, boolean recurse)
           
abstract  boolean mappingExists(java.sql.Connection connection, java.lang.String path)
          Check to see if the path exists.
abstract  void modifyMapping(java.sql.Connection connection, int parentID, java.lang.String path, java.lang.String type, java.lang.String typeNamespace, int id, java.lang.String owner, java.lang.String readWriteGroup, java.lang.String readOnlyGroup)
           
static void registerDefaultHandler(Handler handler)
          Register the default handler.
static void registerHandler(java.lang.String type, java.lang.String typeNamespace, Handler handler)
          Register a handler for the given type and its namespace.
abstract  void removeUserFromGroup(java.sql.Connection connection, java.lang.String dn, java.lang.String group)
           
static void traceSqlFine(java.lang.String sql, java.lang.Object[] params)
           
static void traceSqlFiner(java.lang.String sql, java.lang.Object[] params)
           
static void traceSqlFinest(java.lang.String sql, java.lang.Object[] params)
           
static void traceSqlResultFinest(java.lang.String comment, java.sql.ResultSet rs)
           
static void traceSqlRowResultFine(soaprmi.util.logging.Level level, java.lang.String comment, java.sql.ResultSet rs, int nestingLevel)
          Write to log content of current row in ResultSet.
static void traceSqlRowResultFine(java.sql.ResultSet rs)
           
static void traceSqlRowResultFine(java.lang.String comment, java.sql.ResultSet rs)
           
static void traceSqlRowResultFiner(java.sql.ResultSet rs)
           
static void traceSqlRowResultFiner(java.lang.String comment, java.sql.ResultSet rs)
           
static void traceSqlRowResultFinest(java.sql.ResultSet rs)
           
abstract  void updateXML(java.sql.Connection connection, int id, org.gjt.xpp.XmlNode node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBImplementation

public DBImplementation()
Method Detail

addMapping

public void addMapping(java.sql.Connection connection,
                       Mapping mapping,
                       java.lang.String root,
                       java.lang.String type,
                       java.lang.String typeNamespace,
                       int id,
                       java.lang.String owner,
                       java.lang.Object p7)
Method addMapping

Parameters:
connection - a Connection
mapping - a Mapping
type - a String
typeNamespace - a String
id - an int
owner - a String
p7 - an Object

traceSqlRowResultFine

public static void traceSqlRowResultFine(java.lang.String comment,
                                         java.sql.ResultSet rs)
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

traceSqlRowResultFine

public static void traceSqlRowResultFine(java.sql.ResultSet rs)
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

traceSqlRowResultFiner

public static void traceSqlRowResultFiner(java.lang.String comment,
                                          java.sql.ResultSet rs)
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

traceSqlRowResultFiner

public static void traceSqlRowResultFiner(java.sql.ResultSet rs)
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

traceSqlResultFinest

public static void traceSqlResultFinest(java.lang.String comment,
                                        java.sql.ResultSet rs)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

traceSqlRowResultFinest

public static void traceSqlRowResultFinest(java.sql.ResultSet rs)
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

traceSqlRowResultFine

public static void traceSqlRowResultFine(soaprmi.util.logging.Level level,
                                         java.lang.String comment,
                                         java.sql.ResultSet rs,
                                         int nestingLevel)
                                  throws java.sql.SQLException
Write to log content of current row in ResultSet. Make sure to call this method after calling next().

Throws:
java.sql.SQLException

traceSqlFinest

public static void traceSqlFinest(java.lang.String sql,
                                  java.lang.Object[] params)

traceSqlFiner

public static void traceSqlFiner(java.lang.String sql,
                                 java.lang.Object[] params)

traceSqlFine

public static void traceSqlFine(java.lang.String sql,
                                java.lang.Object[] params)

registerHandler

public static final void registerHandler(java.lang.String type,
                                         java.lang.String typeNamespace,
                                         Handler handler)
Register a handler for the given type and its namespace. Note: Handlers can only be registered before createHandlers or dropHandlers is called.

Parameters:
type - The type.
typeNamespace - The type's namespace.
handler - The handler for the type + namespace.

registerDefaultHandler

public static final void registerDefaultHandler(Handler handler)
Register the default handler. The default handler should be a handler that can handle the Node type. If it cannot there may be a multitude of problems. Also, this needs to be set before getHandler() is ever called or an exception will be thrown if no handler is able to handle the type given to getHandler(). Note: The default handler can only be set before createHandlers or dropHandlers is called.

Parameters:
handler - The default handler.

getHandler

public final Handler getHandler(java.lang.String type,
                                java.lang.String typeNamespace)
Get the handler for the given type.

Parameters:
type - The type.
typeNamespace - The namespace for the type.
Returns:
A handler that can be used to store/access the given type.

create

public abstract void create(java.sql.Connection connection)
                     throws soaprmi.RemoteException,
                            java.sql.SQLException
Create all tables etc. needed for this implementation.

Parameters:
connection - A database connection.
Throws:
soaprmi.RemoteException
java.sql.SQLException

createHandlers

protected final void createHandlers(java.sql.Connection connection)
                             throws soaprmi.RemoteException,
                                    java.sql.SQLException
Create all tables etc. needed for this implementation by the registered handlers.

Parameters:
connection - A database connection.
Throws:
soaprmi.RemoteException
java.sql.SQLException

drop

public abstract void drop(java.sql.Connection connection)
                   throws soaprmi.RemoteException,
                          java.sql.SQLException
Drop all the tables etc. used for this implementation.

Parameters:
connection - A database connection.
Throws:
soaprmi.RemoteException
java.sql.SQLException

dropHandlers

public final void dropHandlers(java.sql.Connection connection)
                        throws soaprmi.RemoteException,
                               java.sql.SQLException
Drop all the tables etc. used for this implementation by registered handlers.

Parameters:
connection - A database connection.
Throws:
soaprmi.RemoteException
java.sql.SQLException

mappingExists

public abstract boolean mappingExists(java.sql.Connection connection,
                                      java.lang.String path)
                               throws soaprmi.RemoteException,
                                      java.sql.SQLException
Check to see if the path exists.

Parameters:
connection - A database connection.
path - The path to check.
Returns:
Whether the path exists or not.
Throws:
soaprmi.RemoteException
java.sql.SQLException

getMapping

public abstract Mapping getMapping(java.sql.Connection connection,
                                   java.lang.String path)
                            throws soaprmi.RemoteException
Get a Mapping for the given path.

Parameters:
connection - A database connection.
path - The path for which a mapping is requested.
Returns:
a Mapping
Throws:
soaprmi.RemoteException

getMapping

public abstract Mapping getMapping(java.sql.Connection connection,
                                   int id)
                            throws soaprmi.RemoteException
Throws:
soaprmi.RemoteException

getMappings

public abstract Mapping[] getMappings(java.sql.Connection connection,
                                      int parent)
                               throws soaprmi.RemoteException,
                                      java.sql.SQLException
Get all of the mappings who have the given parent.

Parameters:
connection - A database connection.
parent - The parent's id.
Returns:
An array of Mappings containing the given parent's children.
Throws:
soaprmi.RemoteException
java.sql.SQLException

getGroups

public abstract void getGroups(java.sql.Connection connection,
                               java.lang.String user,
                               java.util.Vector vector)
                        throws soaprmi.RemoteException,
                               java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

addUserToGroup

public abstract void addUserToGroup(java.sql.Connection connection,
                                    java.lang.String user,
                                    java.lang.String group)
                             throws soaprmi.RemoteException,
                                    java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

deleteUser

public abstract void deleteUser(java.sql.Connection connection,
                                java.lang.String user)
                         throws soaprmi.RemoteException,
                                java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

removeUserFromGroup

public abstract void removeUserFromGroup(java.sql.Connection connection,
                                         java.lang.String dn,
                                         java.lang.String group)
                                  throws soaprmi.RemoteException,
                                         java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

addGroup

public abstract void addGroup(java.sql.Connection connection,
                              java.lang.String group,
                              java.lang.String superGroup)
                       throws soaprmi.RemoteException,
                              java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

deleteGroup

public abstract void deleteGroup(java.sql.Connection connection,
                                 java.lang.String group)
                          throws soaprmi.RemoteException,
                                 java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

listUsersOfGroup

public abstract void listUsersOfGroup(java.sql.Connection connection,
                                      java.lang.String group,
                                      java.util.Vector users,
                                      boolean recurse)
                               throws soaprmi.RemoteException,
                                      java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

listSubGroupsOfGroup

public abstract void listSubGroupsOfGroup(java.sql.Connection connection,
                                          java.lang.String group,
                                          java.util.Vector groups,
                                          boolean recurse)
                                   throws soaprmi.RemoteException,
                                          java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

listGroups

public abstract java.util.Vector listGroups(java.sql.Connection connection)
                                     throws soaprmi.RemoteException,
                                            java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

listUsers

public abstract java.util.Vector listUsers(java.sql.Connection connection)
                                    throws soaprmi.RemoteException,
                                           java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

getUserForDN

public abstract java.lang.String getUserForDN(java.sql.Connection connection,
                                              java.lang.String dn)
                                       throws soaprmi.RemoteException,
                                              java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

addDNForUser

public abstract void addDNForUser(java.sql.Connection connection,
                                  java.lang.String user,
                                  java.lang.String dn)
                           throws soaprmi.RemoteException,
                                  java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

deleteDNForUser

public abstract void deleteDNForUser(java.sql.Connection connection,
                                     java.lang.String user,
                                     java.lang.String dn)
                              throws soaprmi.RemoteException,
                                     java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

deleteAllDNsForUser

public abstract void deleteAllDNsForUser(java.sql.Connection connection,
                                         java.lang.String user)
                                  throws soaprmi.RemoteException,
                                         java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

isGroup

public abstract boolean isGroup(java.sql.Connection connection,
                                java.lang.String name)
                         throws soaprmi.RemoteException,
                                java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

isUser

public abstract boolean isUser(java.sql.Connection connection,
                               java.lang.String name)
                        throws soaprmi.RemoteException,
                               java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

deleteMapping

public abstract void deleteMapping(java.sql.Connection connection,
                                   java.lang.String path)
                            throws soaprmi.RemoteException,
                                   java.sql.SQLException
Delete the path's mapping.

Parameters:
connection - A database connection.
path - The mapping's path.
Throws:
soaprmi.RemoteException
java.sql.SQLException

addMapping

public abstract void addMapping(java.sql.Connection connection,
                                Mapping parent,
                                java.lang.String path,
                                java.lang.String type,
                                java.lang.String typeNamespace,
                                int id,
                                java.lang.String owner,
                                java.lang.String readWriteGroup,
                                java.lang.String readOnlyGroup)
                         throws java.sql.SQLException
Store the described mapping.

Parameters:
connection - A database connection.
parent - The mapping's parent.
path - The path to the mapping.
type - The mapping's type.
typeNamespace - The mapping's type's namespace.
id - The mapping's id.
Throws:
java.sql.SQLException

modifyMapping

public abstract void modifyMapping(java.sql.Connection connection,
                                   int parentID,
                                   java.lang.String path,
                                   java.lang.String type,
                                   java.lang.String typeNamespace,
                                   int id,
                                   java.lang.String owner,
                                   java.lang.String readWriteGroup,
                                   java.lang.String readOnlyGroup)
                            throws java.sql.SQLException,
                                   soaprmi.RemoteException
Throws:
java.sql.SQLException
soaprmi.RemoteException

addXML

public abstract int addXML(java.sql.Connection connection,
                           org.gjt.xpp.XmlNode node)
                    throws java.sql.SQLException,
                           org.gjt.xpp.XmlPullParserException,
                           soaprmi.RemoteException
Throws:
java.sql.SQLException
org.gjt.xpp.XmlPullParserException
soaprmi.RemoteException

updateXML

public abstract void updateXML(java.sql.Connection connection,
                               int id,
                               org.gjt.xpp.XmlNode node)
                        throws java.sql.SQLException,
                               org.gjt.xpp.XmlPullParserException,
                               soaprmi.RemoteException
Throws:
java.sql.SQLException
org.gjt.xpp.XmlPullParserException
soaprmi.RemoteException

deleteXML

public abstract void deleteXML(java.sql.Connection connection,
                               int id)
                        throws java.sql.SQLException,
                               soaprmi.RemoteException
Throws:
java.sql.SQLException
soaprmi.RemoteException

getXML

public abstract org.gjt.xpp.XmlNode getXML(java.sql.Connection connection,
                                           int id)
                                    throws java.sql.SQLException,
                                           org.gjt.xpp.XmlPullParserException,
                                           soaprmi.RemoteException
Throws:
java.sql.SQLException
org.gjt.xpp.XmlPullParserException
soaprmi.RemoteException

existsXML

public abstract boolean existsXML(java.sql.Connection connection,
                                  int id)
                           throws java.sql.SQLException,
                                  soaprmi.RemoteException
Throws:
java.sql.SQLException
soaprmi.RemoteException

keywordSearch

public abstract java.lang.String[] keywordSearch(java.sql.Connection connection,
                                                 java.lang.String[] keywords,
                                                 boolean doAnd,
                                                 int maxResults)
                                          throws java.sql.SQLException,
                                                 soaprmi.RemoteException
Throws:
java.sql.SQLException
soaprmi.RemoteException