edu.vt.middleware.ed
Class NameReservation

java.lang.Object
  extended by edu.vt.middleware.ed.SimpleArbitratedName
      extended by edu.vt.middleware.ed.AbstractReservation
          extended by edu.vt.middleware.ed.NameReservation
All Implemented Interfaces:
ArbitratedName, DataObject, MutableDataObject, NamedDataObject, ReservationObject, Serializable, Cloneable, Comparable<ArbitratedName>

public final class NameReservation
extends AbstractReservation
implements NamedDataObject, Serializable, Comparable<ArbitratedName>, Cloneable

Contains attributes that specify one temporary reservation.

Version:
$Revision: 7374 $
Author:
Cathy Winfrey
See Also:
Serialized Form

Field Summary
static int CREATED_BY_MAXLENGTH
          Maximum length of created by
static ArbitratedDataSource DEFAULT_DATASOURCE
          data source default value
static Integer DEFAULT_RESERVE_LENGTH_MILLIS
          reservation duration default value
static String DEFAULT_SERVICE_NAME
          service attribute default value
static String EXPIRATION_DATE_PARAMETER
          Constant for named query
private  Calendar expirationDate
          expiration date
static String FIND_BY_EXPIRATION_DATE
          Constant for named query
static String FIND_BY_NAME
          Constant for named query
static String FIND_BY_NAME_AND_NAMESPACE
          Constant for named query
static String FIND_BY_NAME_CI
          Constant for named query
static String FIND_BY_NAME_CI_AND_NAMESPACE
          Constant for named query
static String FIND_BY_NAMESPACE
          Constant for named query
static String FIND_BY_RESERVE_HANDLE
          Constant for named query
static int MODIFIED_BY_MAXLENGTH
          Maximum length of modified by
static int NAME_MAXLENGTH
          Maximum length of name
static String NAME_PARAMETER
          Constant for named query
static String NAMESPACE_PARAMETER
          Constant for named query
static String RESERVE_HANDLE_PARAMETER
          Constant for named query
private  String reserveHandle
          reserve handle
private  Integer reserveMilliseconds
          reservation duration (milliseconds)
private static long serialVersionUID
          serial version UID
private  String service
          requesting service
static int SERVICE_NAME_MAXLENGTH
          Maximum length of service name
 
Fields inherited from class edu.vt.middleware.ed.AbstractReservation
DEFAULT_DATASOURCE_CLIENT
 
Constructor Summary
NameReservation()
          Default constructor.
NameReservation(ArbitratedNamespace namespace, String nameValue)
          Initializes for a reservation creation request.
 
Method Summary
 Integer computeReserveMilliseconds()
          Computes the duration of the reservation from the creation date and expiration date, if both dates are set.
private  Integer copyInteger(Integer sourceVal)
          Copies an Integer value into a new instance, to safely store the value from / return the value to a calling routine.
protected  String coreAttributesToString()
          Provides a string representation of the core attributes of the arbitrated entry.
 Calendar getExpirationDate()
          Gets the expiration date of the reservation.
 String getReserveHandle()
          Gets the handle assigned to the reservation.
 Integer getReserveMilliseconds()
          Gets the length of time (duration) that the reservation is required, in milliseconds.
 String getService()
          Gets the service that requested the reservation.
 Long getUid()
          This returns the uid.
 String getUuid()
          Gets the identifier for the reservation.
protected  String nonCoreAttributesToString()
          Provides a string representation of the non-core attributes of the arbitrated entry.
 void reset()
          Initializes the reservation instance to the empty state.
 void setExpirationDate(Calendar expirationDateValue)
          Sets the expiration date of the reservation.
 void setReserveHandle(String reserveHandleValue)
          Sets the handle assigned to the reservation.
 void setReserveMilliseconds(Integer reserveMillisecondsValue)
          Sets the length of time (duration) that the reservation is required, in milliseconds.
 void setService(String serviceValue)
          Sets the service that requested the reservation.
 void setUid(Long l)
          This sets the uid.
private  void updateComputedReserveMilliseconds()
          Updates the duration of the reservation by computing it from the creation date and expiration date.
 
Methods inherited from class edu.vt.middleware.ed.AbstractReservation
copyCalendar, getCreatedBy, getCreationDate, getModificationDate, getModifiedBy, setCreatedBy, setCreationDate, setModificationDate, setModifiedBy
 
Methods inherited from class edu.vt.middleware.ed.SimpleArbitratedName
clone, compareTo, getDataSource, getDn, getName, getNamespace, getRegistryNamespace, setDataSource, setDn, setName, setNamespace, setRegistryNamespace, toString, toStringFull, updateDataSource
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.vt.middleware.ed.MutableDataObject
getModificationDate, getModifiedBy, setModificationDate, setModifiedBy
 
Methods inherited from interface edu.vt.middleware.ed.DataObject
getCreatedBy, getCreationDate, setCreatedBy, setCreationDate
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface edu.vt.middleware.ed.ArbitratedName
clone, getDataSource, getDn, getName, getNamespace, setDataSource, setDn, setName, setNamespace, toStringFull, updateDataSource
 

Field Detail

FIND_BY_NAMESPACE

public static final String FIND_BY_NAMESPACE
Constant for named query

See Also:
Constant Field Values

FIND_BY_NAME

public static final String FIND_BY_NAME
Constant for named query

See Also:
Constant Field Values

FIND_BY_NAME_CI

public static final String FIND_BY_NAME_CI
Constant for named query

See Also:
Constant Field Values

FIND_BY_NAME_AND_NAMESPACE

public static final String FIND_BY_NAME_AND_NAMESPACE
Constant for named query

See Also:
Constant Field Values

FIND_BY_NAME_CI_AND_NAMESPACE

public static final String FIND_BY_NAME_CI_AND_NAMESPACE
Constant for named query

See Also:
Constant Field Values

FIND_BY_EXPIRATION_DATE

public static final String FIND_BY_EXPIRATION_DATE
Constant for named query

See Also:
Constant Field Values

FIND_BY_RESERVE_HANDLE

public static final String FIND_BY_RESERVE_HANDLE
Constant for named query

See Also:
Constant Field Values

EXPIRATION_DATE_PARAMETER

public static final String EXPIRATION_DATE_PARAMETER
Constant for named query

See Also:
Constant Field Values

NAME_PARAMETER

public static final String NAME_PARAMETER
Constant for named query

See Also:
Constant Field Values

NAMESPACE_PARAMETER

public static final String NAMESPACE_PARAMETER
Constant for named query

See Also:
Constant Field Values

RESERVE_HANDLE_PARAMETER

public static final String RESERVE_HANDLE_PARAMETER
Constant for named query

See Also:
Constant Field Values

DEFAULT_SERVICE_NAME

public static final String DEFAULT_SERVICE_NAME
service attribute default value

See Also:
Constant Field Values

DEFAULT_DATASOURCE

public static final ArbitratedDataSource DEFAULT_DATASOURCE
data source default value


DEFAULT_RESERVE_LENGTH_MILLIS

public static final Integer DEFAULT_RESERVE_LENGTH_MILLIS
reservation duration default value


CREATED_BY_MAXLENGTH

public static final int CREATED_BY_MAXLENGTH
Maximum length of created by

See Also:
Constant Field Values

MODIFIED_BY_MAXLENGTH

public static final int MODIFIED_BY_MAXLENGTH
Maximum length of modified by

See Also:
Constant Field Values

NAME_MAXLENGTH

public static final int NAME_MAXLENGTH
Maximum length of name

See Also:
Constant Field Values

SERVICE_NAME_MAXLENGTH

public static final int SERVICE_NAME_MAXLENGTH
Maximum length of service name

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
serial version UID

See Also:
Constant Field Values

reserveHandle

private String reserveHandle
reserve handle


reserveMilliseconds

private Integer reserveMilliseconds
reservation duration (milliseconds)


expirationDate

private Calendar expirationDate
expiration date


service

private String service
requesting service

Constructor Detail

NameReservation

public NameReservation()
Default constructor.


NameReservation

public NameReservation(ArbitratedNamespace namespace,
                       String nameValue)
Initializes for a reservation creation request. Stores the miminum set of attributes needed for a creation request, using default values where possible to simplify the process for the client application.

Parameters:
namespace - the namespace in which the reservation is to be created
nameValue - the name of the reservation
Method Detail

getUid

public Long getUid()
This returns the uid.

Specified by:
getUid in interface DataObject
Overrides:
getUid in class AbstractReservation
Returns:
Long - uid

setUid

public void setUid(Long l)
This sets the uid.

Specified by:
setUid in interface DataObject
Overrides:
setUid in class AbstractReservation
Parameters:
l - Long to set

getReserveHandle

public String getReserveHandle()
Gets the handle assigned to the reservation.

Returns:
the handle assigned to the reservation.

setReserveHandle

public void setReserveHandle(String reserveHandleValue)
Sets the handle assigned to the reservation.

Parameters:
reserveHandleValue - the handle assigned to the reservation.

getService

public String getService()
Gets the service that requested the reservation.

Returns:
the service that requested the reservation.

setService

public void setService(String serviceValue)
Sets the service that requested the reservation.

Parameters:
serviceValue - the service that requested the reservation.

getExpirationDate

public Calendar getExpirationDate()
Gets the expiration date of the reservation.

Specified by:
getExpirationDate in interface NamedDataObject
Returns:
the date the reservation is to be removed.

setExpirationDate

public void setExpirationDate(Calendar expirationDateValue)
Sets the expiration date of the reservation.

Specified by:
setExpirationDate in interface NamedDataObject
Parameters:
expirationDateValue - the date the reservation is to be removed.

getReserveMilliseconds

public Integer getReserveMilliseconds()
Gets the length of time (duration) that the reservation is required, in milliseconds.

Returns:
the number of milliseconds the reservation is to exist.

setReserveMilliseconds

public void setReserveMilliseconds(Integer reserveMillisecondsValue)
Sets the length of time (duration) that the reservation is required, in milliseconds.

Parameters:
reserveMillisecondsValue - the number of milliseconds the reservation is to exist. This value is used only if the duration can not be determined from the creation and expiration dates.

updateComputedReserveMilliseconds

private void updateComputedReserveMilliseconds()
Updates the duration of the reservation by computing it from the creation date and expiration date.


computeReserveMilliseconds

public Integer computeReserveMilliseconds()
Computes the duration of the reservation from the creation date and expiration date, if both dates are set.

Returns:
the computed number of milliseconds the reservation is to exist. If one or both of the dates have not been set yet, a null is returned.

getUuid

public String getUuid()
Gets the identifier for the reservation.

Specified by:
getUuid in interface NamedDataObject
Returns:
the reservation identifier

reset

public void reset()
Initializes the reservation instance to the empty state.

Overrides:
reset in class AbstractReservation

copyInteger

private Integer copyInteger(Integer sourceVal)
Copies an Integer value into a new instance, to safely store the value from / return the value to a calling routine.

Parameters:
sourceVal - value to copy
Returns:
copied value

coreAttributesToString

protected String coreAttributesToString()
Provides a string representation of the core attributes of the arbitrated entry.

Overrides:
coreAttributesToString in class AbstractReservation
Returns:
string of the form $Classname:: followed by a colon-separated list of 'attributeName'=|$attributeValue| pairs for selected attributes

nonCoreAttributesToString

protected String nonCoreAttributesToString()
Provides a string representation of the non-core attributes of the arbitrated entry.

Overrides:
nonCoreAttributesToString in class AbstractReservation
Returns:
string as a colon-separated list of 'attributeName'=|$attributeValue| pairs for each non-core attribute of the arbitrated entry
See Also:
SimpleArbitratedName.coreAttributesToString()


Copyright © 2008 Virginia Tech. All Rights Reserved.