orca.shirako.plugins.db
Class LdapDatabase

java.lang.Object
  extended by orca.util.db.DatabaseBase
      extended by orca.util.db.LdapBase
          extended by orca.shirako.plugins.db.LdapDatabase
All Implemented Interfaces:
IDatabase, IInitialize, IRecover, ISerialize
Direct Known Subclasses:
LdapClientDatabase

public class LdapDatabase
extends LdapBase
implements IDatabase


Field Summary
protected  java.lang.String actorName
          The name of the actor
static java.lang.String Brokers
           
protected  java.lang.String brokersDN
          DN for the brokers within the peer registry
static java.lang.String ConfigMappings
           
protected  java.lang.String configMappingsDN
          DN for mapping records
static java.lang.String Configs
           
protected  java.lang.String configsDN
          DN for XML ant files
static java.lang.String DefaultConfigUrl
           
static java.lang.String Inventory
           
protected  java.lang.String inventoryDN
          DN for hosts
static java.lang.String ObjectClassReservation
           
static java.lang.String ObjectClassSlice
           
static java.lang.String Peers
           
protected  java.lang.String peersDN
          DN for the peer registry
static java.lang.String PropertyNodeState
           
static java.lang.String PropertyReservationID
           
protected  java.util.HashSet<IStateChangeListener> reservationListeners
          Listeners for database reservation update events
static java.lang.String Reservations
           
static java.lang.String Slices
           
protected  java.lang.String slicesDN
          DN for slice records
static java.lang.String TypeBroker
           
static java.lang.String TypeConfigMapping
           
static java.lang.String TypeReservation
           
static java.lang.String TypeSlice
           
 
Fields inherited from class orca.util.db.LdapBase
AllEntries, baseDN, bindDN, bindPasswd, bindPasswdBytes, cn, cnE, create, dc, dcE, DefaultMaxPhysicalConnections, DefaultMaxSharesPerPhysicalConnection, ldapServer, logger, mapFile, mapper, maxPhysicalConnections, maxSharesPerPhysicalConnection, obCodCluster, objectClass, objectClassE, obMisc, obOU, obShirako, obTop, ou, ouE, pool, PropertyLdapBaseDN, PropertyLdapBindDN, PropertyLdapPassword, PropertyLdapServer, resetState
 
Fields inherited from class orca.util.db.DatabaseBase
PropertyDBClassName
 
Constructor Summary
LdapDatabase()
          Create a new instance using the default mapping file.
LdapDatabase(java.lang.String configFile)
          Create a new instance using the specified mapping file
 
Method Summary
 void actorAdded()
          Performs initialization actions as a result of the actor being added to the container.
 void addBroker(IBrokerProxy broker)
          Adds a new broker proxy record.
 void addConfigurationMapping(java.lang.String key, ConfigurationMapping map)
          Adds a new configuration mapping record.
 void addReservation(ResourceReservation reservation)
          Adds a new record to the database representing this reservation object.
 void addSlice(Slice slice)
          Adds a new record to the database representing this slice object.
protected  void createHierarchy(com.novell.ldap.LDAPConnection connection, java.lang.String topPrefix)
           
protected  void createSliceHierarchy(com.novell.ldap.LDAPConnection connection, Slice slice)
          Creates the slice hierarchy
 java.util.Vector<java.util.Properties> getAgentReservations()
          Retrieves all reservations for which this actor acts as a broker.
 java.util.Vector<java.util.Properties> getAuthorityReservations()
          Retrieves all reservations for which this actor acts as a site.
 java.lang.String getBrokerDN(IBrokerProxy broker)
          Returns the DN for the specified broker in the peer registry
 java.util.Vector<java.util.Properties> getBrokers()
          Retrieves all broker proxies.
 java.util.Vector<java.util.Properties> getClientReservations()
          Retrieves all reservations that represent clients of this actor.
 java.util.Vector<java.util.Properties> getClientSlices()
          Retrieves all client slice records.
 java.util.Vector<java.util.Properties> getConfigurationMapping(java.lang.String key)
          Retrieves the specified configuration mapping record.
 java.lang.String getConfigurationMappingDN(java.lang.String key)
           
 java.util.Vector<java.util.Properties> getConfigurationMappings()
          Retrieves all configuration mapping records.
 java.util.Vector<java.util.Properties> getHoldings()
          Retrieves all reservations representing resources held by this actor Broker/service manager.
 java.util.Vector<java.util.Properties> getInventorySlices()
          Retrieves all inventory slice records.
 java.util.Vector<java.util.Properties> getReservation(ReservationID rid)
          Retrieves the specified reservation record.
protected  java.lang.String getReservationDN(ReservationID rid)
          Returns the DN for the specified reservation
protected  java.lang.String getReservationDN(SliceID sliceID, ReservationID rid)
          Returns the DN for the specified reservation
 java.util.Vector<java.util.Properties> getReservations()
          Retrieves all reservation records.
 java.util.Vector<java.util.Properties> getReservations(SliceID sliceID)
          Retrieves all reservation records that belong to the specified slice.
protected  java.lang.String getReservationsDN(SliceID sliceID)
          Returns the Reservations DN for the specified slice
 java.util.Vector<java.util.Properties> getSlice(ResourceType type)
          Retrieves the specified slice record.
 java.util.Vector<java.util.Properties> getSlice(SliceID sliceID)
          Retrieves the specified slice record.
protected  java.lang.String getSliceDN(SliceID sliceID)
          Returns the DN for the specified slice
 java.util.Vector<java.util.Properties> getSlices()
          Retrieves all slice records.
protected  void initDNs()
           
 void initialize()
          Initializes the object.
protected  void notifyReservationListeners(IReservation r, ReservationState from, ReservationState to)
          Notifies the reservation listeners about the fact that a state change was successfully committed to the database
 void registerReservationListener(IStateChangeListener listener)
          Registers a state change listener
 void removeBroker(IBrokerProxy broker)
          Removes the specified broker proxy record.
 void removeConfigurationMapping(java.lang.String key)
          Removes the specified configuration mapping record.
 void removeReservation(ReservationID rid)
          Removes the corresponding reservation object.
 void removeSlice(SliceID sliceID)
          Removes the corresponding database slice record.
 void revisit(IActor actor, java.util.Properties properties)
          Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to.
 void setActorName(java.lang.String actorName)
          Sets the name of the actor this database belongs to.
 void unregisterReservationListener(IStateChangeListener listener)
          Unregisters the state change listener
 void updateBroker(IBrokerProxy broker)
          Updates the specified broker proxy record.
 void updateConfigurationMapping(java.lang.String key, ConfigurationMapping map)
          Updates the specified configuration mapping record.
 void updateReservation(ResourceReservation reservation)
          Updates the corresponding reservation object.
 void updateSlice(Slice slice)
          Updates the corresponding database slice record.
 
Methods inherited from class orca.util.db.LdapBase
checkBase, configure, deleteContainer, exists, getBaseDN, getBindDN, getConnection, getDatabaseData, getLogger, getPassword, getProperties, getServer, reset, returnConnection, save, save, search, searchBase, searchOne, searchSub, setBaseDN, setBindDN, setBindPassword, setLogger, setMaxPhysicalConnections, setMaxSharesPerPhysicalConnection, setResetState, setServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface orca.shirako.api.IDatabase
getLogger, setLogger, setResetState
 
Methods inherited from interface orca.shirako.api.ISerialize
reset, save, save
 

Field Detail

DefaultConfigUrl

public static final java.lang.String DefaultConfigUrl
See Also:
Constant Field Values

TypeSlice

public static final java.lang.String TypeSlice
See Also:
Constant Field Values

TypeReservation

public static final java.lang.String TypeReservation
See Also:
Constant Field Values

TypeBroker

public static final java.lang.String TypeBroker
See Also:
Constant Field Values

TypeConfigMapping

public static final java.lang.String TypeConfigMapping
See Also:
Constant Field Values

Slices

public static final java.lang.String Slices
See Also:
Constant Field Values

Reservations

public static final java.lang.String Reservations
See Also:
Constant Field Values

Inventory

public static final java.lang.String Inventory
See Also:
Constant Field Values

Peers

public static final java.lang.String Peers
See Also:
Constant Field Values

Brokers

public static final java.lang.String Brokers
See Also:
Constant Field Values

Configs

public static final java.lang.String Configs
See Also:
Constant Field Values

ConfigMappings

public static final java.lang.String ConfigMappings
See Also:
Constant Field Values

ObjectClassSlice

public static final java.lang.String ObjectClassSlice
See Also:
Constant Field Values

ObjectClassReservation

public static final java.lang.String ObjectClassReservation
See Also:
Constant Field Values

PropertyReservationID

public static final java.lang.String PropertyReservationID
See Also:
Constant Field Values

PropertyNodeState

public static final java.lang.String PropertyNodeState
See Also:
Constant Field Values

slicesDN

protected java.lang.String slicesDN
DN for slice records


inventoryDN

protected java.lang.String inventoryDN
DN for hosts


peersDN

protected java.lang.String peersDN
DN for the peer registry


brokersDN

protected java.lang.String brokersDN
DN for the brokers within the peer registry


configsDN

protected java.lang.String configsDN
DN for XML ant files


configMappingsDN

protected java.lang.String configMappingsDN
DN for mapping records


actorName

protected java.lang.String actorName
The name of the actor


reservationListeners

protected java.util.HashSet<IStateChangeListener> reservationListeners
Listeners for database reservation update events

Constructor Detail

LdapDatabase

public LdapDatabase()
Create a new instance using the default mapping file.


LdapDatabase

public LdapDatabase(java.lang.String configFile)
Create a new instance using the specified mapping file

Parameters:
configFile -
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: IInitialize
Initializes the object.

Specified by:
initialize in interface IInitialize
Overrides:
initialize in class LdapBase
Throws:
java.lang.Exception

actorAdded

public void actorAdded()
                throws java.lang.Exception
Description copied from interface: IDatabase
Performs initialization actions as a result of the actor being added to the container.

Specified by:
actorAdded in interface IDatabase
Throws:
java.lang.Exception

revisit

public void revisit(IActor actor,
                    java.util.Properties properties)
             throws java.lang.Exception
Description copied from interface: IRecover
Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to. The component can use the actor object to access other objects necessary for its complete recovery.

Specified by:
revisit in interface IRecover
Parameters:
actor - actor object the component belongs to
properties - properties list containing configuration data about the component
Throws:
java.lang.Exception

registerReservationListener

public void registerReservationListener(IStateChangeListener listener)
Registers a state change listener

Specified by:
registerReservationListener in interface IDatabase
Parameters:
listener -

unregisterReservationListener

public void unregisterReservationListener(IStateChangeListener listener)
Unregisters the state change listener

Specified by:
unregisterReservationListener in interface IDatabase
Parameters:
listener -

initDNs

protected void initDNs()
Overrides:
initDNs in class LdapBase

createHierarchy

protected void createHierarchy(com.novell.ldap.LDAPConnection connection,
                               java.lang.String topPrefix)
                        throws java.lang.Exception
Overrides:
createHierarchy in class LdapBase
Throws:
java.lang.Exception

addSlice

public void addSlice(Slice slice)
              throws java.lang.Exception
Description copied from interface: IDatabase
Adds a new record to the database representing this slice object.

Specified by:
addSlice in interface IDatabase
Parameters:
slice - Slice object
Throws:
java.lang.Exception

createSliceHierarchy

protected void createSliceHierarchy(com.novell.ldap.LDAPConnection connection,
                                    Slice slice)
                             throws java.lang.Exception
Creates the slice hierarchy

Parameters:
connection - connection object
slice - slice
Throws:
java.lang.Exception

updateSlice

public void updateSlice(Slice slice)
                 throws java.lang.Exception
Description copied from interface: IDatabase
Updates the corresponding database slice record.

Specified by:
updateSlice in interface IDatabase
Parameters:
slice - slice object
Throws:
java.lang.Exception

removeSlice

public void removeSlice(SliceID sliceID)
                 throws java.lang.Exception
Description copied from interface: IDatabase
Removes the corresponding database slice record.

Specified by:
removeSlice in interface IDatabase
Parameters:
sliceID - slice name
Throws:
java.lang.Exception

getSlices

public java.util.Vector<java.util.Properties> getSlices()
                                                 throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all slice records.

Specified by:
getSlices in interface IDatabase
Returns:
a vector containing one or more properties lists representing serialized slices
Throws:
java.lang.Exception

getInventorySlices

public java.util.Vector<java.util.Properties> getInventorySlices()
                                                          throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all inventory slice records.

Specified by:
getInventorySlices in interface IDatabase
Returns:
a vector containing one or more properties lists representing serialized inventory slices *
Throws:
java.lang.Exception

getClientSlices

public java.util.Vector<java.util.Properties> getClientSlices()
                                                       throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all client slice records.

Specified by:
getClientSlices in interface IDatabase
Returns:
a vector containing one or more properties lists representing serialized client slices
Throws:
java.lang.Exception

getSlice

public java.util.Vector<java.util.Properties> getSlice(SliceID sliceID)
                                                throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves the specified slice record.

Specified by:
getSlice in interface IDatabase
Parameters:
sliceID - slice name
Returns:
a vector containing a properties list
Throws:
java.lang.Exception

addReservation

public void addReservation(ResourceReservation reservation)
                    throws java.lang.Exception
Description copied from interface: IDatabase
Adds a new record to the database representing this reservation object.

Specified by:
addReservation in interface IDatabase
Throws:
java.lang.Exception

notifyReservationListeners

protected void notifyReservationListeners(IReservation r,
                                          ReservationState from,
                                          ReservationState to)
                                   throws java.lang.Exception
Notifies the reservation listeners about the fact that a state change was successfully committed to the database

Parameters:
r - reservation
from - state before
to - state after
Throws:
java.lang.Exception

removeReservation

public void removeReservation(ReservationID rid)
                       throws java.lang.Exception
Description copied from interface: IDatabase
Removes the corresponding reservation object.

Specified by:
removeReservation in interface IDatabase
Throws:
java.lang.Exception

updateReservation

public void updateReservation(ResourceReservation reservation)
                       throws java.lang.Exception
Description copied from interface: IDatabase
Updates the corresponding reservation object.

Specified by:
updateReservation in interface IDatabase
Throws:
java.lang.Exception

getReservations

public java.util.Vector<java.util.Properties> getReservations(SliceID sliceID)
                                                       throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all reservation records that belong to the specified slice.

Specified by:
getReservations in interface IDatabase
Returns:
Throws:
java.lang.Exception

getClientReservations

public java.util.Vector<java.util.Properties> getClientReservations()
                                                             throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all reservations that represent clients of this actor. For a broker, should return only agent reservations. For a site, should return both agent and authority reservations.

Specified by:
getClientReservations in interface IDatabase
Returns:
Throws:
java.lang.Exception

getHoldings

public java.util.Vector<java.util.Properties> getHoldings()
                                                   throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all reservations representing resources held by this actor Broker/service manager.

Specified by:
getHoldings in interface IDatabase
Returns:
Throws:
java.lang.Exception

getAgentReservations

public java.util.Vector<java.util.Properties> getAgentReservations()
                                                            throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all reservations for which this actor acts as a broker.

Specified by:
getAgentReservations in interface IDatabase
Returns:
Throws:
java.lang.Exception

getAuthorityReservations

public java.util.Vector<java.util.Properties> getAuthorityReservations()
                                                                throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all reservations for which this actor acts as a site.

Specified by:
getAuthorityReservations in interface IDatabase
Returns:
Throws:
java.lang.Exception

getReservations

public java.util.Vector<java.util.Properties> getReservations()
                                                       throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all reservation records.

Specified by:
getReservations in interface IDatabase
Returns:
Throws:
java.lang.Exception

getReservation

public java.util.Vector<java.util.Properties> getReservation(ReservationID rid)
                                                      throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves the specified reservation record.

Specified by:
getReservation in interface IDatabase
Parameters:
rid - Reservation identifier
Returns:
Throws:
java.lang.Exception

addBroker

public void addBroker(IBrokerProxy broker)
               throws java.lang.Exception
Description copied from interface: IDatabase
Adds a new broker proxy record.

Specified by:
addBroker in interface IDatabase
Throws:
java.lang.Exception

removeBroker

public void removeBroker(IBrokerProxy broker)
                  throws java.lang.Exception
Description copied from interface: IDatabase
Removes the specified broker proxy record.

Specified by:
removeBroker in interface IDatabase
Throws:
java.lang.Exception

updateBroker

public void updateBroker(IBrokerProxy broker)
                  throws java.lang.Exception
Description copied from interface: IDatabase
Updates the specified broker proxy record.

Specified by:
updateBroker in interface IDatabase
Throws:
java.lang.Exception

getBrokers

public java.util.Vector<java.util.Properties> getBrokers()
                                                  throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all broker proxies.

Specified by:
getBrokers in interface IDatabase
Returns:
Throws:
java.lang.Exception

getConfigurationMappingDN

public java.lang.String getConfigurationMappingDN(java.lang.String key)

getConfigurationMappings

public java.util.Vector<java.util.Properties> getConfigurationMappings()
                                                                throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves all configuration mapping records.

Specified by:
getConfigurationMappings in interface IDatabase
Returns:
a vector containing one or more properties lists representing configuration mapping records
Throws:
java.lang.Exception

getConfigurationMapping

public java.util.Vector<java.util.Properties> getConfigurationMapping(java.lang.String key)
                                                               throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves the specified configuration mapping record.

Specified by:
getConfigurationMapping in interface IDatabase
Parameters:
key - record key
Returns:
a vector containing a properties list
Throws:
java.lang.Exception

addConfigurationMapping

public void addConfigurationMapping(java.lang.String key,
                                    ConfigurationMapping map)
                             throws java.lang.Exception
Description copied from interface: IDatabase
Adds a new configuration mapping record.

Specified by:
addConfigurationMapping in interface IDatabase
Parameters:
key - key for the record
map - mapping object
Throws:
java.lang.Exception

updateConfigurationMapping

public void updateConfigurationMapping(java.lang.String key,
                                       ConfigurationMapping map)
                                throws java.lang.Exception
Description copied from interface: IDatabase
Updates the specified configuration mapping record.

Specified by:
updateConfigurationMapping in interface IDatabase
Parameters:
key - record key
map - mapping object
Throws:
java.lang.Exception

removeConfigurationMapping

public void removeConfigurationMapping(java.lang.String key)
                                throws java.lang.Exception
Description copied from interface: IDatabase
Removes the specified configuration mapping record.

Specified by:
removeConfigurationMapping in interface IDatabase
Parameters:
key - key
Throws:
java.lang.Exception

setActorName

public void setActorName(java.lang.String actorName)
Description copied from interface: IDatabase
Sets the name of the actor this database belongs to.

Specified by:
setActorName in interface IDatabase
Parameters:
actorName - actor name

getBrokerDN

public java.lang.String getBrokerDN(IBrokerProxy broker)
Returns the DN for the specified broker in the peer registry

Parameters:
broker -

getSliceDN

protected java.lang.String getSliceDN(SliceID sliceID)
Returns the DN for the specified slice

Parameters:
sliceName - s;ice name

getReservationsDN

protected java.lang.String getReservationsDN(SliceID sliceID)
Returns the Reservations DN for the specified slice

Parameters:
sliceName - slice name

getReservationDN

protected java.lang.String getReservationDN(ReservationID rid)
                                     throws java.lang.Exception
Returns the DN for the specified reservation

Parameters:
rid - reservation id
Returns:
Throws:
java.lang.Exception

getReservationDN

protected java.lang.String getReservationDN(SliceID sliceID,
                                            ReservationID rid)
Returns the DN for the specified reservation

Parameters:
sliceName - slice name
rid - reservation id
Returns:

getSlice

public java.util.Vector<java.util.Properties> getSlice(ResourceType type)
                                                throws java.lang.Exception
Description copied from interface: IDatabase
Retrieves the specified slice record.

Specified by:
getSlice in interface IDatabase
Parameters:
type - resource type associated with the slice
Returns:
a vector containing a properties list
Throws:
java.lang.Exception


Copyright © 2007 Network/Internet Computing Lab. All Rights Reserved.