org.isam.exehda.services.ox
Class OXManagerImpl

java.lang.Object
  |
  +--org.isam.exehda.services.AbstractService
        |
        +--org.isam.exehda.services.ox.OXManagerImpl
All Implemented Interfaces:
OXManager, Service

public class OXManagerImpl
extends AbstractService
implements OXManager

Author:
frainer

Field Summary
(package private) static java.lang.String PROP_CIB_URI
           
(package private) static java.lang.String PROP_OX_URI
           
 
Fields inherited from interface org.isam.exehda.services.ox.OXManager
ATT_READ, ATT_WRITE, SERVICE_NAME
 
Constructor Summary
OXManagerImpl()
          Creates a new instance of OXManagerImpl
 
Method Summary
 OXHandle createHandle(ObjectId oid)
          Create handle is used to create a new OXHandle for the OX with the given ObjectId.
 OXHandle grantOwnership(OXHandle ox)
          Grant ownership invalidates the ownership of the given OXHandle, allowing a new node to request the ownership of this OXHanlde.
 void realeaseHandle(OXHandle ox)
          Realease handle takes away the given handle from the handle list.
 OXHandle requestOwnership(OXHandle ox)
          requestWnershp grants the ownership of the given OXHandle to the calling HostId as long as that OXHandle is not currently owned by another host.
 void start()
           
 void stop()
           
 OXHandle updateAttributes(OXHandle ox, java.lang.String[] att, byte[] op)
          OXhandle updates the attributes of the given ox.
 
Methods inherited from class org.isam.exehda.services.AbstractService
log, log, log, log, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_OX_URI

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

PROP_CIB_URI

static final java.lang.String PROP_CIB_URI
See Also:
Constant Field Values
Constructor Detail

OXManagerImpl

public OXManagerImpl()
Creates a new instance of OXManagerImpl

Method Detail

start

public void start()
Specified by:
start in interface Service

stop

public void stop()
Specified by:
stop in interface Service

createHandle

public OXHandle createHandle(ObjectId oid)
Create handle is used to create a new OXHandle for the OX with the given ObjectId. Wheter a new MasterOXHanlde or a new ProxyOXhandle will be created depends on wheter an OXHandle had already been created for the given OX or not

Specified by:
createHandle in interface OXManager
Parameters:
oid - a ObjectId representing the OX to which the OXHandle to be created will refer
Returns:
a new OXHandle

grantOwnership

public OXHandle grantOwnership(OXHandle ox)
                        throws HandleNotFoundException,
                               NotMasterHandleException
Grant ownership invalidates the ownership of the given OXHandle, allowing a new node to request the ownership of this OXHanlde. While the OXHandle ownership is undefined all calls to that handle get queed until a new ownership is requested. To be used when an OXhandle migrates from one node to another.

Specified by:
grantOwnership in interface OXManager
Parameters:
ox - a OXHandle whose ownership is being granted
Returns:
a OXhandle
HandleNotFoundException
NotMasterHandleException

realeaseHandle

public void realeaseHandle(OXHandle ox)
Realease handle takes away the given handle from the handle list. Only to be uswed when the OX is no longer necessary.

Specified by:
realeaseHandle in interface OXManager
Parameters:
ox - a OXHandle that is to be realeased
Returns:
void

requestOwnership

public OXHandle requestOwnership(OXHandle ox)
                          throws HandleNotFoundException,
                                 WrongHandleException,
                                 NotMasterHandleException,
                                 WrongOwnershipCodeException
requestWnershp grants the ownership of the given OXHandle to the calling HostId as long as that OXHandle is not currently owned by another host.

Specified by:
requestOwnership in interface OXManager
Parameters:
ox - a OXHandle whose ownership is beign requested
Returns:
a OXHandle value
HandleNotFoundException
WrongHandleException
NotMasterHandleException
WrongOwnershipCodeException

updateAttributes

public OXHandle updateAttributes(OXHandle ox,
                                 java.lang.String[] att,
                                 byte[] op)
                          throws HandleNotFoundException
OXhandle updates the attributes of the given ox. The attributes to be updated are defined in a String array. What type of update is to be done (read or write) is defined in an byte array.

Specified by:
updateAttributes in interface OXManager
Parameters:
ox - a OXHanlde whose attributes are to be updated
att - an String[] defining what attributes are to be updated
Returns:
a OXHandle that is the OXHandle passed as parameter with it's attributes updated
HandleNotFoundException