net.ponder2
Class P2ManagedObject

java.lang.Object
  extended by net.ponder2.P2ManagedObject
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, Ponder2Message

public class P2ManagedObject
extends java.lang.Object
implements Ponder2Message, java.io.Externalizable

The base class for all Managed Objects within the system. The parent and policy sets are maintained here. All RPC calls come through this interface, the RPC is checked against the policies and then propagated to the actual object to perform the action.

Version:
$Id: P2ManagedObject.java,v 1.22 2006/03/15 14:52:18 kpt Exp $
Author:
Kevin Twidle
See Also:
Serialized Form

Constructor Summary
P2ManagedObject()
          Constructor for serialisation
P2ManagedObject(P2Object p2Object)
          The base class for all Managed Objects within the system.
 
Method Summary
protected  void addParent(P2ManagedObject mo)
          adds a parent managed object as a parent of this one
 void applyPolicy(AuthorisationPolicy policy)
          applies a policy to this managed object
 void applyPolicy(EventListener policy)
          applies a policy to this managed object
 void attachRemotePolicy(P2Object remote)
           
 P2Object create(P2Object source, java.lang.String operation, P2Object... args)
           
 boolean equals(java.lang.Object obj)
           
 java.util.Set<AuthorisationPolicy> getAuthorisationPolicies()
          get all the authorisation policies applying to this managed object
protected  java.util.Set<EventListener> getEventListeners()
          get all the obligation policies applying to this managed object
 OID getOID()
          gets the object identifier for this object
 P2Object getP2Object()
          gets the object identifier for this object
 java.util.Set<P2ManagedObject> getParentSet()
           
 int hashCode()
           
 boolean isDomain()
           
 P2Object operation(P2Object source, java.lang.String operation, P2Object... args)
           
 P2Object operation(P2Object source, java.lang.String operation, java.lang.String arg1, java.lang.String... args)
           
 int parentCount()
          returns the number of parents that this managed object has
 void readExternal(java.io.ObjectInput arg0)
           
protected  java.lang.Object readResolve()
          Called by the serialization routines after readExternal as been called.
protected  void removeParent(P2ManagedObject mo)
          removes a parent object from this object's parent set
 void removePolicy(AuthorisationPolicy policy)
          removes a policy from this managed object's policy set
 void removePolicy(EventListener policy)
          removes a policy from this managed object's policy set
 void sendEvent(Event event)
          sends an event to policies attached to this managed object and above
 void writeExternal(java.io.ObjectOutput arg0)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

P2ManagedObject

public P2ManagedObject(P2Object p2Object)
The base class for all Managed Objects within the system. The parent and policy sets are maintained here. All RPC calls come through this interface, the RPC is checked against the policies and then propagated to the actual object to perform the action.


P2ManagedObject

public P2ManagedObject()
Constructor for serialisation

Method Detail

getOID

public OID getOID()
gets the object identifier for this object

Returns:
this object's identifier

isDomain

public boolean isDomain()

getP2Object

public P2Object getP2Object()
gets the object identifier for this object

Returns:
this object's identifier

addParent

protected void addParent(P2ManagedObject mo)
adds a parent managed object as a parent of this one

Parameters:
mo - the parent to be added

removeParent

protected void removeParent(P2ManagedObject mo)
removes a parent object from this object's parent set

Parameters:
mo - the parent to be removed

getParentSet

public java.util.Set<P2ManagedObject> getParentSet()

parentCount

public int parentCount()
returns the number of parents that this managed object has

Returns:
the number of parents

getEventListeners

protected java.util.Set<EventListener> getEventListeners()
get all the obligation policies applying to this managed object

Returns:
a Set containing the policies

getAuthorisationPolicies

public java.util.Set<AuthorisationPolicy> getAuthorisationPolicies()
get all the authorisation policies applying to this managed object

Returns:
a Set containing the policies

applyPolicy

public void applyPolicy(EventListener policy)
applies a policy to this managed object

Parameters:
policy - the policy to be applied

applyPolicy

public void applyPolicy(AuthorisationPolicy policy)
applies a policy to this managed object

Parameters:
policy - the policy to be applied

removePolicy

public void removePolicy(EventListener policy)
removes a policy from this managed object's policy set

Parameters:
policy - the policy to be removed

removePolicy

public void removePolicy(AuthorisationPolicy policy)
removes a policy from this managed object's policy set

Parameters:
policy - the policy to be removed

attachRemotePolicy

public void attachRemotePolicy(P2Object remote)

sendEvent

public void sendEvent(Event event)
sends an event to policies attached to this managed object and above

Parameters:
event - the event to be sent to the policies
Throws:
Ponder2Exception

create

public P2Object create(P2Object source,
                       java.lang.String operation,
                       P2Object... args)
                throws Ponder2Exception
Specified by:
create in interface Ponder2Message
Throws:
Ponder2Exception

operation

public P2Object operation(P2Object source,
                          java.lang.String operation,
                          P2Object... args)
                   throws Ponder2Exception
Specified by:
operation in interface Ponder2Message
Throws:
Ponder2Exception

operation

public P2Object operation(P2Object source,
                          java.lang.String operation,
                          java.lang.String arg1,
                          java.lang.String... args)
                   throws Ponder2Exception
Specified by:
operation in interface Ponder2Message
Throws:
Ponder2Exception

readExternal

public void readExternal(java.io.ObjectInput arg0)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Called by the serialization routines after readExternal as been called.

Returns:
the newly read in OID, actually probably an old one.
Throws:
java.io.ObjectStreamException

writeExternal

public void writeExternal(java.io.ObjectOutput arg0)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2008 Imperial College. All Rights Reserved.