interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

VOS::VobjectBase Class Reference
[libvos]

#include <vos/vos/vobjectbase.hh>

Inheritance diagram for VOS::VobjectBase:

VOS::Vobject VUtil::RefCounted VOS::Site List of all members.

Detailed Description

A base implementation class for virtual objects.

Except for a few implementation-specific added methods, the API is the same as Vobject.

Definition at line 95 of file vobjectbase.hh.

Public Member Functions

Static Public Member Functions

Protected Member Functions

Friends


Constructor & Destructor Documentation

virtual VOS::VobjectBase::~VobjectBase (  )  [virtual]


Member Function Documentation

virtual void VOS::VobjectBase::addChildListener ( ChildChangeListener cl,
bool  refresh = true 
) [inline, virtual]

Adds some object callback to be notified when the child list changes.

The

Parameters:
cl The listener object.
refresh if true, will queue up notification callbacks on the listener fully describing the current state.

Implements VOS::Vobject.

Definition at line 296 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addChildListener ( Vobject requester,
ChildChangeListener cl,
bool  refresh = true 
) [virtual]

virtual void VOS::VobjectBase::addFlag ( const std::string &  flag  )  [virtual]

Add a flag string.

Useful when doing recursive tree walks, to avoid cycles. This is local-only, it is not shared with other sites in any way.

Parameters:
flag the flag string

Implements VOS::Vobject.

template<class T>
static void VOS::VobjectBase::addMessageHandler ( const std::string &  method,
void(T::*)(Message *)  messageHandler 
) [inline, static]

Definition at line 146 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addMetaObjectExtension ( MetaObject m  )  [virtual]

virtual void VOS::VobjectBase::addParentListener ( ParentChangeListener pl,
bool  refresh = true 
) [inline, virtual]

Adds some object callback to be notified when the parent set changes.

Parameters:
pl the listener object
refresh if true, will queue up notification callbacks on the listener fully describing the current state.

Implements VOS::Vobject.

Definition at line 292 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addParentListener ( Vobject requester,
ParentChangeListener pl,
bool  refresh = true 
) [virtual]

virtual void VOS::VobjectBase::addToACL ( const std::string &  ACLname,
Group grp 
) [inline, virtual]

Add a group to an access control list (ACL).

If this group exists in another ACL, it will be removed from that ACL first.

Parameters:
ACLname the name of the ACL. This is a comma-separated list of the access control policies to apply for each domain. For example "core:read-only,property:accept-all". Order does not matter (it will be sorted) but this access control list name is distict from just "core:read-only"!
grp the Group to add

Implements VOS::Vobject.

Definition at line 337 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addToACL ( Vobject requester,
const std::string &  ACLname,
Group grp 
) [virtual]

virtual void VOS::VobjectBase::addToACL ( const std::string &  ACLname,
Identity id 
) [inline, virtual]

Add an identity to an access control list (ACL).

If this identity exists in another ACL, it will be removed from that ACL first.

Parameters:
ACLname the name of the ACL. This is a comma-separated list of the access control policies to apply for each domain. For example "core:read-only,property:accept-all". Order does not matter (it will be sorted) but this access control list name is distict from just "core:read-only"!
id the Identity to add

Implements VOS::Vobject.

Definition at line 333 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addToACL ( Vobject requester,
const std::string &  ACLname,
Identity id 
) [virtual]

virtual void VOS::VobjectBase::addType ( const std::string &  s  )  [inline, virtual]

Adds a new type to this object's type set.

This only changes the stored set of type name std::strings and does not necessarily affect the actual code behind the object. See the Local Site class for information about extending the actual functionality of an existing meta objects.

Parameters:
s the type std::string

Implements VOS::Vobject.

Definition at line 228 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addType ( Vobject requester,
const std::string &  s 
) [virtual]

virtual void VOS::VobjectBase::addTypeListener ( TypeChangeListener tl,
bool  refresh = true 
) [inline, virtual]

Adds some object callback to be notified when the type set changes.

Parameters:
tl the listener object.
refresh if true, will queue up notification callbacks on the listener fully describing the current state.

Implements VOS::Vobject.

Definition at line 288 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addTypeListener ( Vobject requester,
TypeChangeListener tl,
bool  refresh = true 
) [virtual]

template<class T>
static void VOS::VobjectBase::addUpdateHandler ( const std::string &  method,
void(T::*)(Message *)  messageHandler 
) [inline, static]

Definition at line 156 of file vobjectbase.hh.

virtual void VOS::VobjectBase::addVobjectExtension ( VobjectExtension vx  )  [virtual]

virtual void VOS::VobjectBase::cacheChildren ( bool  b  )  [virtual]

Specify if this vobject's child list should be cached locally.

Only meaningful for remote vobjects. This means that we become a listener of the remote vobject child list and receive updates. Calls to getChildren(), findChild() and findObject() will be serviced using the cached list and will not go out to the network.

Parameters:
b If true, use cache. If false, the list will not be cached (unless it is being listened to by another part of the program.)

virtual void VOS::VobjectBase::cacheParents ( bool  b  )  [virtual]

Specify if this vobject's parent set should be cached locally.

Only meaningful for remote vobjects. This means that we become a listener of the remote vobject parent set and receive updates. Calls to getParents() and findParent() will be serviced using the cached set and will not go out to the network.

Parameters:
b If true, use cache. If false, the set will not be cached (unless it is being listened to by another part of the program.)

virtual bool VOS::VobjectBase::checkFlag ( const std::string &  flag  )  [virtual]

Check the flag std::string.

Parameters:
flag the flag std::string
Returns:
whether the flag std::string is set

Implements VOS::Vobject.

virtual void VOS::VobjectBase::deleteACL ( const std::string &  policies  )  [inline, virtual]

Completely delete an ACL.

Parameters:
policies the name of the ACL. This is a comma-separated list of the access control policies to apply for each domain. For example "core:read-only,property:accept-all". Order does not matter (it will be sorted) but this access control list name is distict from just "core:read-only"!

Implements VOS::Vobject.

Definition at line 349 of file vobjectbase.hh.

virtual void VOS::VobjectBase::deleteACL ( Vobject requester,
const std::string &  policies 
) [virtual]

void VOS::VobjectBase::doAccessControlCheck ( VobjectEvent ve  ) 

virtual void VOS::VobjectBase::excise (  )  [virtual]

Ask that all known references to this object to release their references so the object can be deleted, by calling ObjectExciseListener::notifyObjectExcise().

Note:
This method is virtual and objects making use of this class will probably want to supply their own additional code to detach from linking data structures. Make sure to call RefCounted::excise() in yoru override method so that the excise listeners are called back. Overriding excise() will probably be sufficient for most uses; the purpose of the ObjectExciseListener facility is for plugin/application level hooks which may be beyond the scope of your immediate code.

Reimplemented from VUtil::RefCounted.

Reimplemented in VOS::Site.

virtual VUtil::vRef<ParentChildRelation> VOS::VobjectBase::findChild ( int  pos  )  [inline, virtual]

Get the child at a certain position.

This searchs for a single parent-child relation in the immediate child list of this object. See setChild() for more information about the possible numerical values of positions.

Parameters:
pos the child position
Returns:
the ParentChildRelation structure representing the relation of this parent and the requested child.
Exceptions:
NoSuchObjectError if the path is illegal
AccessControlError if a remote site reported the user is not allowed that information

Implements VOS::Vobject.

Definition at line 256 of file vobjectbase.hh.

virtual VUtil::vRef<ParentChildRelation> VOS::VobjectBase::findChild ( Vobject requester,
int  pos 
) [virtual]

virtual VUtil::vRef<ParentChildRelation> VOS::VobjectBase::findChild ( const std::string &  path  )  [inline, virtual]

Fetch a child.

This searchs for a single parent-child relation in the immediate child list of this object. It is distinguished from findObject in that it returns the full parent-child relation structure, and that it only accepts two forms of input: the child name, or the position in the child list. See setChild() for more information about the possible numerical values of positions. If there are multiple children with the same name, the one with the lowest position is returned.

Parameters:
path either the child name or the position as a string
Returns:
the ParentChildRelation structure representing the relation of this parent and the requested child.
Exceptions:
NoSuchObjectError if the path is illegal
AccessControlError if a remote site reported the user is not allowed that information

Implements VOS::Vobject.

Definition at line 252 of file vobjectbase.hh.

virtual VUtil::vRef<ParentChildRelation> VOS::VobjectBase::findChild ( Vobject requester,
const std::string &  path 
) [virtual]

virtual VUtil::vRef<Vobject> VOS::VobjectBase::findObject ( const std::string &  path  )  [inline, virtual]

Follows some path to find the Vobject.

Unlike findObjectFromRoot(), if the path does not start with "vop://" the path will be intepreted relative to this object. For example, "foo/bar" will find the first child object named "foo" of this object, then the first child named "bar" of "foo" object and return that. If there is a leading slash, the path is relative to the object's site, so "/foo/bar" means to find the Vobject with site name "foo", then find the first child of that object "bar" and return that. Instead of using child names, one may use the position by prefixing a hash mark to the numerical position. So "\#0" refers to the first child of this object, "\#1" to the second etc. If this is larger than the number of children, an exception will be raised. See setChild() for more information about the possible numerical values of positions.

Parameters:
path the path to the object we want to find
Returns:
the object, if found.
Exceptions:
NoSuchSiteError The DNS lookup for the site failed, the site is not listening on the expected port, site peering failed, for whatever other reason the site could not be contacted. Only thrown if there is a site specified in the path.)
NoSuchObjectError if that object path does not exist on the site
BadURLError if there is a syntax error in the supplied URL
AccessControlError if a remote site reported that the user is not allowed that information

Implements VOS::Vobject.

Definition at line 248 of file vobjectbase.hh.

virtual VUtil::vRef<Vobject> VOS::VobjectBase::findObject ( Vobject requester,
const std::string &  path 
) [virtual]

Referenced by main().

virtual VUtil::vRef<ParentChildRelation> VOS::VobjectBase::findParent ( Vobject parent  )  [inline, virtual]

Find a parent.

This tests to see if the supplied Vobject is a parent of this Vobject.

Parameters:
parent the parent object
Returns:
the parent-child relation.
Exceptions:
NoSuchObjectError if the object is NOT a parent
AccessControlError if a remote site reported the user is not allowed that information

Implements VOS::Vobject.

Definition at line 263 of file vobjectbase.hh.

virtual VUtil::vRef<ParentChildRelation> VOS::VobjectBase::findParent ( Vobject parent  )  [inline, virtual]

Definition at line 260 of file vobjectbase.hh.

virtual VUtil::vRef<ParentChildRelation> VOS::VobjectBase::findParent ( Vobject requester,
Vobject parent 
) [virtual]

template<class AccessControlType>
std::vector< AccessControlType * > VOS::VobjectBase::getAccessControlsFor ( Vobject requester,
PolicyDomain< AccessControlType > &  accessControlPolicies 
) [inline]

Definition at line 684 of file site.hh.

virtual ACLIterator VOS::VobjectBase::getAllACLs (  )  [virtual]

Returns:
all access control lists (ACL) that have been set.

Implements VOS::Vobject.

virtual ACLIterator VOS::VobjectBase::getAllACLs ( Vobject requester  )  [virtual]

virtual StringIterator VOS::VobjectBase::getAvailablePolicies ( const std::string &  domain  )  [inline, virtual]

Returns:
all policies in a particular policy domain that are available for use.

Implements VOS::Vobject.

Definition at line 329 of file vobjectbase.hh.

virtual StringIterator VOS::VobjectBase::getAvailablePolicies ( Vobject requester,
const std::string &  domain 
) [virtual]

virtual ChildListIterator VOS::VobjectBase::getChildren ( int  start = 0,
int  end = -1 
) [inline, virtual]

Get the children of this Vobject.

Permits fetching a "slice" of a child list by specifying starting and ending positions.

Parameters:
start the position of the first child to return (inclusive)
end the position of th elast child to return (inclusive)
Returns:
an Iterator over a list of parent-child relations

Implements VOS::Vobject.

Definition at line 240 of file vobjectbase.hh.

virtual ChildListIterator VOS::VobjectBase::getChildren ( Vobject requester,
int  start = 0,
int  end = -1 
) [virtual]

virtual std::string VOS::VobjectBase::getDefaultPolicy ( const std::string &  domain = ""  )  [inline, virtual]

Get the policy that is applied by default if the requester's identity or groups were not found in any ACL.

This is also the policy applied to anonymous users (users with no identity.)

Parameters:
domain the policy domain you are interested in. If blank, returns a comma-separated list of the policy in each domain.

Implements VOS::Vobject.

Definition at line 353 of file vobjectbase.hh.

virtual std::string VOS::VobjectBase::getDefaultPolicy ( Vobject requester,
const std::string &  domain 
) [virtual]

virtual MetaObjectIterator VOS::VobjectBase::getMetaObjectExtensions (  )  [virtual]

virtual ParentSetIterator VOS::VobjectBase::getParents (  )  [inline, virtual]

Get the set of parent-child relationships in which this object is the child.

Returns:
a set of parent-child relations

Implements VOS::Vobject.

Definition at line 236 of file vobjectbase.hh.

virtual ParentSetIterator VOS::VobjectBase::getParents ( Vobject requester  )  [virtual]

virtual StringIterator VOS::VobjectBase::getPolicy ( const std::string &  domain,
Identity id 
) [inline, virtual]

Do an access control lookup; for some identity requesting access, this will return the appropriate policy in some domain based on the current access control lists.

Access control lookup works like this:

  1. Check each ACL to see if it lists this Identity. If so, we use that ACL's policy.
  2. Otherwise, check each ACL for groups that this Identity belongs to. If the Identity is a member of several Groups that are in different ACLs, then return the policy for each relevant ACL. The caller should check *every* policy to determine pass or fail -- this is up to the caller, but commonly in VOS code if any policy grants permission then permission is given. This means that groups can be used to add permissions, but not take them away! Design you access control scheme accordingly (and make the default permissions as restrictive as possible).
  3. Otherwise, because neither the Identity nor any Group it is a member of appear in any ACL, the default access control is returned.

Parameters:
domain the policy domain of interest
id the identity requesting access

Implements VOS::Vobject.

Definition at line 325 of file vobjectbase.hh.

virtual StringIterator VOS::VobjectBase::getPolicy ( Vobject requester,
const std::string &  domain,
Identity id 
) [virtual]

virtual VUtil::vRef<Site> VOS::VobjectBase::getSite (  )  const [virtual]

Returns:
the site this object resides on.

Implements VOS::Vobject.

Reimplemented in VOS::Site.

virtual const std::string& VOS::VobjectBase::getSiteName (  )  const [inline, virtual]

Returns:
the site name of this object.

Implements VOS::Vobject.

Definition at line 139 of file vobjectbase.hh.

virtual TypeSetIterator VOS::VobjectBase::getTypes (  )  [inline, virtual]

Returns:
a set of type names for the types supported by this object.

Implements VOS::Vobject.

Definition at line 224 of file vobjectbase.hh.

virtual TypeSetIterator VOS::VobjectBase::getTypes ( Vobject requester  )  [virtual]

virtual const VUtil::URL& VOS::VobjectBase::getURL (  )  const [inline, virtual]

Returns:
the URL path as a URL object

Implements VOS::Vobject.

Definition at line 141 of file vobjectbase.hh.

Referenced by main().

virtual VUtil::vRef<VobjectBase> VOS::VobjectBase::getVobjectBase (  )  [inline, virtual]

Returns:
the VobjectBase object that actually implements this Vobject

Implements VOS::Vobject.

Definition at line 370 of file vobjectbase.hh.

VobjectState& VOS::VobjectBase::getVobjectState (  )  [inline]

Definition at line 137 of file vobjectbase.hh.

virtual void VOS::VobjectBase::insertChild ( int  position,
const std::string &  contextual_name,
Vobject child 
) [inline, virtual]

Insert a child at some position with a new object.

If the position is positive, the object is inserted such that it now occupies that position, and all objects starting from the previous occupant of that position onward are moved up one. If the position in negative, the object is similarly inserted so that it now occupies that position. For example, position -1 will append the object to the end of the list, position -2 will insert the object in the second-to-last position, etc. See setChild() for more discussion on positions.

Parameters:
position the position
contextual_name This is the name, specific to this parent-child relation, used for refering to this object by path.
child the child object, in question
Exceptions:
AccessControl if this is a remote object and the remote site has denied the requsted action

Implements VOS::Vobject.

Definition at line 273 of file vobjectbase.hh.

virtual void VOS::VobjectBase::insertChild ( Vobject requester,
int  position,
const std::string &  contextual_name,
Vobject child 
) [virtual]

virtual bool VOS::VobjectBase::isLocal (  )  [inline, virtual]

Returns:
true if this object is local, false if not

Implements VOS::Vobject.

Definition at line 142 of file vobjectbase.hh.

virtual bool VOS::VobjectBase::isRemote (  )  [inline, virtual]

Returns:
true if this object is remote, false if not

Implements VOS::Vobject.

Definition at line 143 of file vobjectbase.hh.

virtual void VOS::VobjectBase::msgSendImpl ( boost::mutex &  usehandlers_mutex,
HandlerMap &  usehandlers,
Message msg 
) [protected, virtual]

virtual int VOS::VobjectBase::numChildren (  )  [inline, virtual]

Returns:
the number of children that this Vobject has. This is more efficient than calling getChildren().size() because if this is a remote object it does not actually fetch the children.

Implements VOS::Vobject.

Definition at line 244 of file vobjectbase.hh.

virtual int VOS::VobjectBase::numChildren ( Vobject requester  )  [virtual]

template<class C>
C* VOS::VobjectBase::queryExtension (  )  [inline]

Definition at line 384 of file vobjectbase.hh.

template<class C>
VUtil::vRef<C> VOS::VobjectBase::queryInterface (  )  [inline]

Definition at line 373 of file vobjectbase.hh.

virtual void VOS::VobjectBase::removeChild ( ParentChildRelation pcr,
bool  strict = true 
) [inline, virtual]

Remove the child at some position.

See setChild() for more information on positions.

Parameters:
pcr ParentChildRelation object describing the child entry to remove.
strict Should the position in the supplied parent child relation be strictly followed? If strict is false, then if the parent-child entry at the supplied position does NOT match the contextual name and/or child object, but there is exactly one other entry in the child list which does match the contextual name and child we want to remove, then that entry will be removed instead. If strict is true, an AccessControlError is raised in this situation.
Exceptions:
AccessControl if this is a remote object and the remote site has denied the requsted action

Implements VOS::Vobject.

Definition at line 277 of file vobjectbase.hh.

virtual void VOS::VobjectBase::removeChild ( Vobject requester,
ParentChildRelation pcr,
bool  strict = true 
) [virtual]

virtual void VOS::VobjectBase::removeChildListener ( ChildChangeListener cl  )  [inline, virtual]

Removes an object callback, previously added with addChildListener().

Parameters:
cl the listener object

Implements VOS::Vobject.

Definition at line 308 of file vobjectbase.hh.

virtual void VOS::VobjectBase::removeChildListener ( Vobject requester,
ChildChangeListener cl 
) [virtual]