Table of Contents
OIL2 Class Standard.ObjectCreator
class Standard . ObjectCreator {
oid restrictedOID;
} inherits from Object;
DESCRIPTION
Class ObjectCreator provides the facilities by which new objects are
instantiated within an FARGOS/VISTA Object Management Environment.
One and only one object of this class will be instantiated within
a given address space. This is done automatically by the boot process
of a FARGOS/VISTA OME daemon and the Object Id of the created object is made
available to all threads as the predefined thread variable
ObjectCreator.
The object Id is also registered as the local service
"ObjectCreator".
The ObjectCreator object represents a globally unique Id for
each instance of a FARGOS/VISTA Object Management Environment daemon.
METHODS
Standard.ObjectCreator:createObject
ObjectCreator:createObject(any className, assoc acl, optional any arg1, optional any arg2)
Method Description
The createObject method is the typical mechanism by which
new objects are created. It takes a minimum of two arguments:
- a class name specification
- an access control list
Any additional arguments are passed as argument to the create
method of the indicated class. The className is almost always
specified as a string argument that denotes the name of the class. With
this usage, all name spaces are searched and and the most recent version
of the class is used. The alternate form is to pass a three-element array:
- 0
- a string that specifies the name space
- 1
- a string that specifies the class name
- 2
- an integer that specifies the version Id of the class
Return Value
This method returns the object Id of the newly created object.
Possible Exceptions
If the specified class does not exist or the class inherits from an unknown
class, the possibility exists that the request could be satisfied if
the missing class was dynamically loaded. If the AutomaticClassLoader
service is registered, then the processing of the create will be
delegated using a findAndLoadClass request
against the AutomaticClassLoader object.
If no AutomaticClassLoader service is registered or it was unable
to locate the needed class, then there is possibility of recovery and
a noSuchClass exception will
be raised. Note that exceptions are handled by an object's
handleException method.
Standard.ObjectCreator:createObjectAndNotifyWhenDone
ObjectCreator:createObjectAndNotifyWhenDone(oid notifyObj, any className, assoc acl, optional any arg1, optional any arg2)
Method Description
The createObjectAndNotifyWhenDone method is almost identical
in operation to createObject. It takes an additional, initial argument
that provides the Object Id of the object that should be notified when the
creation of the new object is complete. That object is sent a
threadTerminated notification when the last thread involved with the
creation of the new object terminates.
Return Value
This method returns the object Id of the newly created object.
Possible Exceptions
If the specified class does not exist or the class inherits from an unknown
class, the possibility exists that the request could be satisfied if
the missing class was dynamically loaded. If the AutomaticClassLoader
service is registered, then the processing of the create will be
delegated using a findAndLoadClass request
against the AutomaticClassLoader object.
If no AutomaticClassLoader service is registered or it was unable
to locate the needed class, then there is possibility of recovery and
a noSuchClass exception will
be raised. Note that exceptions are handled by an object's
handleException method.
Standard.ObjectCreator:importObject
ObjectCreator:importObject(string data)
Method Description
The importObject method takes an object snapshot, which was previously
generated by Object:encodeObject, and re-creates the object state.
The object Id assigned is the same as that used to obtain the encoding.
Return Value
The object Id of the object is returned; a nil value indicates an error.
Standard.ObjectCreator:duplicateObject
ObjectCreator:duplicateObject(string data)
Method Description
The duplicateObject method takes an object snapshot,
which was previously generated by Object:encodeObject,
and re-creates the object state.
This is almost identical in function to importObject, with the
difference being that a new object Id is assigned to the newly instantiated
object data. The access control list will be the same as that of the
original object.
Return Value
The new object Id of the object is returned; a nil value indicates
an error.
Standard.ObjectCreator:invokeLocally
ObjectCreator:invokeLocally(string method, array args, any dest, any fromObj)
Method Description
The invokeLocally method provides a convenient mechanism to
import and forward remote invocations within a local FARGOS/VISTA
Object Management Environment process.
It takes four arguments:
- the method name
- an array of arguments to be passed to the method
- a destination object Id or service name
- an object Id, service name or nil specification for
the fromObject associated with the method invocation.
Note: if the fromObj argument is not specified,
it defaults to fromObject.
Standard.ObjectCreator:setClassMetaObject
ObjectCreator:setClassMetaObject(any className, oid meta)
Method Description
Whereas Object:setMeta sets a meta object for a single object,
the ObjectCreator:setClassMetaObject method sets a
class-specific meta object for all objects of the indicated class.
The className is almost always specified
as a string argument that denotes the name of the class. With this usage,
all name spaces are searched and and the most recent version of the class
is used. The alternate form is to pass a three-element array:
- 0
- a string that specifies the name space
- 1
- a string that specifies the class name
- 2
- an integer that specifies the version Id of the class
Return Value
This method returns an integer value that indicates if the operation
was successful: 0 indicates success, -1 indicates an error.