xdrs_impl.genericdb
Class GenericXDirectoryService

java.lang.Object
  extended bysoaprmi.server.RemoteObject
      extended byxdrs_impl.genericdb.GenericXDirectoryService
All Implemented Interfaces:
NodeAuthorization, javax.naming.Referenceable, soaprmi.Remote, soaprmi.server.RemoteRef, UserManagement, XDirectoryService
Direct Known Subclasses:
ServiceImpl, ServiceImpl, ServiceImpl

public abstract class GenericXDirectoryService
extends soaprmi.server.RemoteObject
implements XDirectoryService

This class is a XDirectoryService implementation that is backed by a database.

Version:
$Revision: 1.1 $ $Date: 2005/05/06 21:31:05 $ (GMT)
Author:
matt, Gopi Kandaswamy

Field Summary
 
Fields inherited from class soaprmi.server.RemoteObject
port
 
Fields inherited from interface xdrs.XDirectoryService
NAMESPACE, ROOT
 
Fields inherited from interface xdrs.authorization.NodeAuthorization
ADMIN, EVERYBODY, NOBODY
 
Constructor Summary
protected GenericXDirectoryService(DBImplementation db)
           
 
Method Summary
 void addDNForUser(java.lang.String user, java.lang.String dn)
           
 void addGroupToSuperGroup(java.lang.String group, java.lang.String superGroup)
           
 void addNode(java.lang.String path, org.gjt.xpp.XmlNode nodeXml)
          Add the given node as a child of the node associated with the given path.
 void addUsersToGroup(java.lang.String[] users, java.lang.String group)
           
 void addUserToGroup(java.lang.String user, java.lang.String group)
           
 void checkReadAccess(java.lang.String user, java.lang.String path)
           
protected  void closeConnection(java.sql.Connection connection)
           
 void copyNodes(java.lang.String[] sourcePaths, java.lang.String targetPath)
          Copy a set of nodes from one location to another.
 void createUser(java.lang.String user, java.lang.String dn)
           
 void deleteAllDNsForUser(java.lang.String user)
           
 void deleteDNForUser(java.lang.String user, java.lang.String dn)
           
 void deleteGroup(java.lang.String group)
           
 void deleteGroups(java.lang.String[] groups)
           
 void deleteNodes(java.lang.String dirPath, java.lang.String[] childrenNames)
          Delete children nodes that are continaed in directory identified by path.
 void deleteUser(java.lang.String user)
           
 void deleteUsers(java.lang.String[] users)
           
 org.gjt.xpp.XmlNode[] getChildrenWithoutHtml(java.lang.String path)
          Get list of XML nodes that are contained inside directory.
 java.lang.String[] getGroups(java.lang.String user)
           
 org.gjt.xpp.XmlNode getNode(java.lang.String path)
          Get an XmlNode representation of whatever is at the given path.
 java.lang.String getNodeHtml(java.lang.String path)
          Get an XmlNode representation for the given path's html.
 java.lang.String getUserForDN(java.lang.String name)
           
 void isAuthorized(java.security.Principal dn, org.xmlpull.v1.builder.XmlElement xsulEnvelope)
           
 java.lang.String[] keywordSearch(java.lang.String[] keywords, boolean doAnd, int maxResults)
          Search using keywords to find nodes.
 java.lang.String[] listGroups()
           
 java.lang.String[] listSubGroupsOfGroup(java.lang.String group, boolean recurse)
           
 java.lang.String[] listUsers()
           
 java.lang.String[] listUsersOfGroup(java.lang.String group, boolean recurse)
           
protected abstract  void loadDriver()
           
 void modifyNode(java.lang.String path, org.gjt.xpp.XmlNode nodeXml)
          Update the values of a node, pointed to by the given path, with those in the given node.
 void moveNodes(java.lang.String[] sourcePaths, java.lang.String targetPath)
          Move a set of nodes from one location to another.
protected abstract  java.sql.Connection openConnection()
           
 void removeGroupFromSuperGroup(java.lang.String group, java.lang.String superGroup)
           
 void removeUserFromGroup(java.lang.String user, java.lang.String group)
           
 void removeUsersFromGroup(java.lang.String[] users, java.lang.String group)
           
 void setPermissions(java.lang.String path, java.lang.String owner, java.lang.String readWriteGroup, java.lang.String readOnlyGroup, boolean recurse)
           
 
Methods inherited from class soaprmi.server.RemoteObject
equals, getReference, getSoapRMIPort, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericXDirectoryService

protected GenericXDirectoryService(DBImplementation db)
                            throws java.sql.SQLException,
                                   java.lang.InstantiationException,
                                   java.lang.IllegalAccessException,
                                   java.lang.ClassNotFoundException,
                                   org.gjt.xpp.XmlPullParserException,
                                   soaprmi.RemoteException
Method Detail

loadDriver

protected abstract void loadDriver()
                            throws java.lang.InstantiationException,
                                   java.lang.IllegalAccessException,
                                   java.lang.ClassNotFoundException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

openConnection

protected abstract java.sql.Connection openConnection()
                                               throws java.sql.SQLException
Throws:
java.sql.SQLException

closeConnection

protected void closeConnection(java.sql.Connection connection)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getChildrenWithoutHtml

public org.gjt.xpp.XmlNode[] getChildrenWithoutHtml(java.lang.String path)
                                             throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Get list of XML nodes that are contained inside directory. Returned nodes does not contain HTML.

Specified by:
getChildrenWithoutHtml in interface XDirectoryService
Returns:
List of XmlNode representations for children of this directory. If directory has no children
Throws:
soaprmi.RemoteException - If the given path does not exist, node identified by path is not direcotry.

getNodeHtml

public java.lang.String getNodeHtml(java.lang.String path)
                             throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Get an XmlNode representation for the given path's html.

Specified by:
getNodeHtml in interface XDirectoryService
Parameters:
path - The path whose html will be returned.
Returns:
An XmlNode representation for the given path's html.
Throws:
soaprmi.RemoteException - If the given path does not exist, there is a problem generating the XmlNode, or the node associated with the given path does not have html.

deleteNodes

public void deleteNodes(java.lang.String dirPath,
                        java.lang.String[] childrenNames)
                 throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Delete children nodes that are continaed in directory identified by path.

Specified by:
deleteNodes in interface XDirectoryService
Parameters:
dirPath - The path to the direcotry node
childrenNames - list of children nodes to delete.
Throws:
soaprmi.RemoteException - If the given path does not exist, there is a problem deleting the node, or if there is an attempt to delete the ROOT.

addNode

public void addNode(java.lang.String path,
                    org.gjt.xpp.XmlNode nodeXml)
             throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Add the given node as a child of the node associated with the given path. Due to the fact that nodes can only be added to existing paths, a default, root, path always exists and can be accessed through the ROOT class variable.

Specified by:
addNode in interface XDirectoryService
Parameters:
path - The proposed parent for the given node.
nodeXml - The node that will be added.
Throws:
soaprmi.RemoteException - If the given path does not exist, the given path plus the given node's name already exists, the given node is not of a supported type, or the given path points to a node that cannot have children.

modifyNode

public void modifyNode(java.lang.String path,
                       org.gjt.xpp.XmlNode nodeXml)
                throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Update the values of a node, pointed to by the given path, with those in the given node.

Specified by:
modifyNode in interface XDirectoryService
Parameters:
path - The path to the node to be modified.
nodeXml - A node containing new values for specific fields.
Throws:
soaprmi.RemoteException - If the given path does not exist, the type of the given node's type does not match the type of the node associated with the given path, or the given node tries to change the name of the node associated with the given path.

moveNodes

public void moveNodes(java.lang.String[] sourcePaths,
                      java.lang.String targetPath)
               throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Move a set of nodes from one location to another. The sourcePaths can be any type of nodes. If targetPath exists and is a directory node then the nodes associated with the sourcePaths are moved into the targetPath, as children. NOTE: In the future it would be nice to rename things as they are moved.

Specified by:
moveNodes in interface XDirectoryService
Parameters:
sourcePaths - The paths to the nodes to be moved.
Throws:
soaprmi.RemoteException - If the given sourcePaths do not exist, or the targetPath exists and is not a directory.

getNode

public org.gjt.xpp.XmlNode getNode(java.lang.String path)
                            throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Get an XmlNode representation of whatever is at the given path.

Specified by:
getNode in interface XDirectoryService
Parameters:
path - The path from which to extract an XmlNode.
Returns:
An XmlNode representation for the given path.
Throws:
soaprmi.RemoteException - If the given path does not exist, or there is a problem generating the XmlNode.

copyNodes

public void copyNodes(java.lang.String[] sourcePaths,
                      java.lang.String targetPath)
               throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Copy a set of nodes from one location to another. The sourcePaths can be any type of nodes. If targetPath exists and is a directory node then the nodes associated with the sourcePaths are copied into the targetPath, as children. NOTE: In the future it would be nice to rename things as they are copied.

Specified by:
copyNodes in interface XDirectoryService
Parameters:
sourcePaths - The paths to the nodes to be copied.
Throws:
soaprmi.RemoteException - If the given sourcePaths do not exist, or the targetPath exists and is not a directory.

keywordSearch

public java.lang.String[] keywordSearch(java.lang.String[] keywords,
                                        boolean doAnd,
                                        int maxResults)
                                 throws soaprmi.RemoteException
Description copied from interface: XDirectoryService
Search using keywords to find nodes.

Specified by:
keywordSearch in interface XDirectoryService
Parameters:
keywords - The keywords for which to search.
doAnd - Whether to AND the keywrods together or not.
maxResults - The max number of results to return.
Returns:
An array of paths that can be given to getNode().
Throws:
soaprmi.RemoteException

setPermissions

public void setPermissions(java.lang.String path,
                           java.lang.String owner,
                           java.lang.String readWriteGroup,
                           java.lang.String readOnlyGroup,
                           boolean recurse)
                    throws soaprmi.RemoteException
Specified by:
setPermissions in interface NodeAuthorization
Throws:
soaprmi.RemoteException

isAuthorized

public void isAuthorized(java.security.Principal dn,
                         org.xmlpull.v1.builder.XmlElement xsulEnvelope)
                  throws xsul.XsulException
Throws:
xsul.XsulException

checkReadAccess

public void checkReadAccess(java.lang.String user,
                            java.lang.String path)
                     throws soaprmi.RemoteException,
                            java.sql.SQLException
Throws:
soaprmi.RemoteException
java.sql.SQLException

createUser

public void createUser(java.lang.String user,
                       java.lang.String dn)
                throws soaprmi.RemoteException
Specified by:
createUser in interface UserManagement
Throws:
soaprmi.RemoteException

addUserToGroup

public void addUserToGroup(java.lang.String user,
                           java.lang.String group)
                    throws soaprmi.RemoteException
Specified by:
addUserToGroup in interface UserManagement
Throws:
soaprmi.RemoteException

addUsersToGroup

public void addUsersToGroup(java.lang.String[] users,
                            java.lang.String group)
                     throws soaprmi.RemoteException
Specified by:
addUsersToGroup in interface UserManagement
Throws:
soaprmi.RemoteException

addGroupToSuperGroup

public void addGroupToSuperGroup(java.lang.String group,
                                 java.lang.String superGroup)
                          throws soaprmi.RemoteException
Specified by:
addGroupToSuperGroup in interface UserManagement
Throws:
soaprmi.RemoteException

deleteUser

public void deleteUser(java.lang.String user)
                throws soaprmi.RemoteException
Specified by:
deleteUser in interface UserManagement
Throws:
soaprmi.RemoteException

deleteUsers

public void deleteUsers(java.lang.String[] users)
                 throws soaprmi.RemoteException
Specified by:
deleteUsers in interface UserManagement
Throws:
soaprmi.RemoteException

removeUserFromGroup

public void removeUserFromGroup(java.lang.String user,
                                java.lang.String group)
                         throws soaprmi.RemoteException
Specified by:
removeUserFromGroup in interface UserManagement
Throws:
soaprmi.RemoteException

removeUsersFromGroup

public void removeUsersFromGroup(java.lang.String[] users,
                                 java.lang.String group)
                          throws soaprmi.RemoteException
Specified by:
removeUsersFromGroup in interface UserManagement
Throws:
soaprmi.RemoteException

removeGroupFromSuperGroup

public void removeGroupFromSuperGroup(java.lang.String group,
                                      java.lang.String superGroup)
                               throws soaprmi.RemoteException
Specified by:
removeGroupFromSuperGroup in interface UserManagement
Throws:
soaprmi.RemoteException

deleteGroup

public void deleteGroup(java.lang.String group)
                 throws soaprmi.RemoteException
Specified by:
deleteGroup in interface UserManagement
Throws:
soaprmi.RemoteException

deleteGroups

public void deleteGroups(java.lang.String[] groups)
                  throws soaprmi.RemoteException
Specified by:
deleteGroups in interface UserManagement
Throws:
soaprmi.RemoteException

listUsersOfGroup

public java.lang.String[] listUsersOfGroup(java.lang.String group,
                                           boolean recurse)
                                    throws soaprmi.RemoteException
Specified by:
listUsersOfGroup in interface UserManagement
Throws:
soaprmi.RemoteException

listSubGroupsOfGroup

public java.lang.String[] listSubGroupsOfGroup(java.lang.String group,
                                               boolean recurse)
                                        throws soaprmi.RemoteException
Specified by:
listSubGroupsOfGroup in interface UserManagement
Throws:
soaprmi.RemoteException

listGroups

public java.lang.String[] listGroups()
                              throws soaprmi.RemoteException
Specified by:
listGroups in interface UserManagement
Throws:
soaprmi.RemoteException

getGroups

public java.lang.String[] getGroups(java.lang.String user)
                             throws soaprmi.RemoteException
Specified by:
getGroups in interface UserManagement
Throws:
soaprmi.RemoteException

listUsers

public java.lang.String[] listUsers()
                             throws soaprmi.RemoteException
Specified by:
listUsers in interface UserManagement
Throws:
soaprmi.RemoteException

getUserForDN

public java.lang.String getUserForDN(java.lang.String name)
                              throws soaprmi.RemoteException
Specified by:
getUserForDN in interface UserManagement
Throws:
soaprmi.RemoteException

addDNForUser

public void addDNForUser(java.lang.String user,
                         java.lang.String dn)
                  throws soaprmi.RemoteException
Specified by:
addDNForUser in interface UserManagement
Throws:
soaprmi.RemoteException

deleteDNForUser

public void deleteDNForUser(java.lang.String user,
                            java.lang.String dn)
                     throws soaprmi.RemoteException
Specified by:
deleteDNForUser in interface UserManagement
Throws:
soaprmi.RemoteException

deleteAllDNsForUser

public void deleteAllDNsForUser(java.lang.String user)
                         throws soaprmi.RemoteException
Specified by:
deleteAllDNsForUser in interface UserManagement
Throws:
soaprmi.RemoteException