org.PingOO.DLAI.slave.UGM
Class Request

java.lang.Object
  |
  +--org.PingOO.DLAI.slave.UGM.Request

final class Request
extends java.lang.Object

Asks question to the server by using the upper protocol.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)

Field Summary
private  javax.swing.JInternalFrame parentFrame
          The parent frame.
private  UpperProtocol protocol
          The object used to send to and receive messages from the server.
 
Constructor Summary
Request(UpperProtocol protocol, javax.swing.JInternalFrame parentFrame)
          Creates a new request object.
 
Method Summary
private  DirectoryComponent addComponent(DirectoryComponent parentNode, DirectoryComponent childNode)
          Adds a component in the directory tree.
 void changeUserPassword(UserSheet user)
          Changes the user' system password.
 void changeWebPassword(UserSheet user)
          Changes the user' web password.
 void copyComponent(DirectoryTree tree, DirectoryNode parentNode, java.lang.String name, DirectoryComponent targetComponent)
           
 AdministratorAlias createAdministratorAlias(DirectoryNode parentNode, AdministratorAlias childNode)
          Creates a new administrator alias.
 UserAlias createUserAlias(DirectoryNode parentNode, UserAlias childNode)
          Creates a new user alias.
 UserGroup createUserGroup(DirectoryNode parentNode, UserGroup childNode)
          Creates a new group node.
 UserSheet createUserSheet(DirectoryNode parentNode, UserSheet childNode)
          Creates a new user sheet.
 void getAttribute(DirectoryComponent component, java.lang.String key)
          Get one attribute from the server for the given object.
 java.lang.String[] getAvailablePrograms()
           
 DirectoryTree getDirectoryTree()
          Asks the server for a tree representation of the LDAP directory.
 int getMaxDepth()
          Return the max depth of the tree in the data base.
 void moveComponent(DirectoryComponent component, UserGroup targetNode)
          Moves a component to a new node.
 void removeComponent(DirectoryComponent component)
          Removes a component from the directory tree.
 void saveComponent(DirectoryComponent component)
          Save a component.
 void saveDirectory(DirectoryComponent root)
           
 void saveDirectory(DirectoryTree tree)
           
 void saveDirectory(DirectoryTreeModel model)
           
 void saveTree(DirectoryNode node)
          Saves the entire tree form a given root node.
 void saveTree(DirectoryTree tree)
          Saves the entire tree.
 void saveTree(DirectoryTreeModel model)
          Saves the entire tree.
 void setAttribute(DirectoryComponent component, java.lang.String key)
          Set one attribute for the given object on the server's database.
 void setAttribute(DirectoryComponent component, java.lang.String key, java.lang.Object value)
          Set one attribute for the given object on the server's database.
 void updateComponent(DirectoryComponent component)
          Updates the content of the component.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

protocol

private UpperProtocol protocol
The object used to send to and receive messages from the server.

parentFrame

private javax.swing.JInternalFrame parentFrame
The parent frame.
Constructor Detail

Request

public Request(UpperProtocol protocol,
               javax.swing.JInternalFrame parentFrame)
Creates a new request object.
Parameters:
protocol - The protocol to which send the requests.
Method Detail

getAvailablePrograms

public java.lang.String[] getAvailablePrograms()

getDirectoryTree

public DirectoryTree getDirectoryTree()
                               throws RequestFailedException,
                                      PingOOProtocolException
Asks the server for a tree representation of the LDAP directory.
Returns:
A directory tree representation of the LDAP directory, null il he server did not return any information (but did not refused the request).
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

getMaxDepth

public int getMaxDepth()
Return the max depth of the tree in the data base.
Returns:
The max depth of the tree in the data base.

addComponent

private DirectoryComponent addComponent(DirectoryComponent parentNode,
                                        DirectoryComponent childNode)
                                 throws RequestFailedException,
                                        PingOOProtocolException
Adds a component in the directory tree.
Parameters:
parentNode - The parent of the child.
childNode - The child to add.
Returns:
The component that was added or null if insertion was refused for some reason orther thant explicit server refusal.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

createUserGroup

public UserGroup createUserGroup(DirectoryNode parentNode,
                                 UserGroup childNode)
                          throws RequestFailedException,
                                 PingOOProtocolException
Creates a new group node.
Parameters:
parentNode - The node where to insert the new group.
childNode - The group to add.
Returns:
The object added or null if the insertion failed (without beeing rejected by the server).
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

createUserSheet

public UserSheet createUserSheet(DirectoryNode parentNode,
                                 UserSheet childNode)
                          throws RequestFailedException,
                                 PingOOProtocolException
Creates a new user sheet.
Parameters:
parentNode - The node where to insert the new user sheet.
childNode - The user to add.
Returns:
The object added or null if the insertion failed (without beeing rejected by the server).
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

createUserAlias

public UserAlias createUserAlias(DirectoryNode parentNode,
                                 UserAlias childNode)
                          throws RequestFailedException,
                                 PingOOProtocolException
Creates a new user alias.
Parameters:
parentNode - The node where to insert the new user alias.
childNode - The alias to add.
Returns:
The object added or null if the insertion failed (without beeing rejected by the server).
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

createAdministratorAlias

public AdministratorAlias createAdministratorAlias(DirectoryNode parentNode,
                                                   AdministratorAlias childNode)
                                            throws RequestFailedException,
                                                   PingOOProtocolException
Creates a new administrator alias.
Parameters:
parentNode - The node where to insert the new administrator alias.
childNode - The administrator to add.
Returns:
The object added or null if the insertion failed (without beeing rejected by the server).
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

updateComponent

public void updateComponent(DirectoryComponent component)
                     throws RequestFailedException,
                            PingOOProtocolException
Updates the content of the component.
Parameters:
component - The component to update.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

setAttribute

public void setAttribute(DirectoryComponent component,
                         java.lang.String key)
                  throws RequestFailedException,
                         PingOOProtocolException
Set one attribute for the given object on the server's database.

Forbidden to use to set passwords !!

Parameters:
component - The targeted component.
key - The key of the required attribute.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

setAttribute

public void setAttribute(DirectoryComponent component,
                         java.lang.String key,
                         java.lang.Object value)
                  throws RequestFailedException,
                         PingOOProtocolException
Set one attribute for the given object on the server's database.

Forbidden to use to set passwords !!

Parameters:
component - The targeted component.
key - The key of the required attribute.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

getAttribute

public void getAttribute(DirectoryComponent component,
                         java.lang.String key)
                  throws RequestFailedException,
                         PingOOProtocolException
Get one attribute from the server for the given object.

Forbidden to use to get passwords !!

Parameters:
component - The targeted component.
key - The key of the required attribute.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

removeComponent

public void removeComponent(DirectoryComponent component)
                     throws RequestFailedException,
                            PingOOProtocolException
Removes a component from the directory tree.
Parameters:
component - The component to remove.
Returns:
true if the operation was successfull, false otherwise.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

moveComponent

public void moveComponent(DirectoryComponent component,
                          UserGroup targetNode)
                   throws RequestFailedException,
                          PingOOProtocolException
Moves a component to a new node.
Parameters:
component - The component to move.
targetNode - The targeted component.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

saveComponent

public void saveComponent(DirectoryComponent component)
                   throws RequestFailedException,
                          PingOOProtocolException
Save a component.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

changeUserPassword

public void changeUserPassword(UserSheet user)
                        throws RequestFailedException,
                               PingOOProtocolException
Changes the user' system password.
Parameters:
user - The targeted user.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

changeWebPassword

public void changeWebPassword(UserSheet user)
                       throws RequestFailedException,
                              PingOOProtocolException
Changes the user' web password.
Parameters:
user - The targeted user.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

saveTree

public void saveTree(DirectoryTree tree)
              throws RequestFailedException,
                     PingOOProtocolException
Saves the entire tree.
Parameters:
tree - The tree to be saved.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

saveTree

public void saveTree(DirectoryTreeModel model)
              throws RequestFailedException,
                     PingOOProtocolException
Saves the entire tree.
Parameters:
model - The tree to be saved.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

saveTree

public void saveTree(DirectoryNode node)
              throws RequestFailedException,
                     PingOOProtocolException
Saves the entire tree form a given root node.
Parameters:
model - The node from where save the tree.
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).

saveDirectory

public void saveDirectory(DirectoryComponent root)

saveDirectory

public void saveDirectory(DirectoryTreeModel model)

saveDirectory

public void saveDirectory(DirectoryTree tree)

copyComponent

public void copyComponent(DirectoryTree tree,
                          DirectoryNode parentNode,
                          java.lang.String name,
                          DirectoryComponent targetComponent)
                   throws RequestFailedException,
                          PingOOProtocolException
Throws:
RequestFailedException - The server refused the request.
PingOOProtocolException - There was a network error (physical or logical).