VisiBroker for C++ API Reference Guide : Server Manager Interfaces and Classes

Server Manager Interfaces and Classes
This section describes the VisiBroker for C++ Server Manager interfaces and classes. For additional information about the Server Manager, see “Using the VisiBroker Server Manager” in the VisiBroker for C++ Developer's Guide.
The Container Interface
class _VISSVMGREXPORT Container : public virtual CORBA_Object
A container can hold properties, operations, and other containers. Each major ORB component is represented as a container. The top-level container does not support any properties or operations but contains child containers, such as the ORB container. The ORB container in turn contains ORB properties, a shutdown method, and other containers like RootPOA, Agent, DebugLogger, ServerEngines and so forth.
Include file
Include the file servermgr_c.hh when using this class.
The Container Interface
This section explains the C++ methods that can be executed on the container interface. There are four categories:
Methods related to property manipulation and queries
virtual CORBA::StringSequence* list_all_properties();
Returns the names of all the properties in the container as a StringSequence.
virtual PropertySequence* get_all_properties();
Returns the PropertySequence containing the names, values, and read-write status of all the properties in the container.
virtual Property* get_property(const char * name);
Returns the value of the property name passed as an input parameter.
It throws NameInvalid exception if the parameter passed is not a valid property name.
virtual void set_property(const char* name, CORBA::Any& value);
Sets the value of the property name to the requested value.
It can throw these exceptions:
NameInvalid if the property name is invalid, for example if the property does not exist in the container.
ValueInvalid if the property value is not valid.
ValueNotSettable if the property value cannot be set, for example if the property is read-only.
virtual void persist_properties(CORBA::Boolean recurse);
Causes the container to actually store its properties to the associated “Storage Interface Methods for C++”. If no storage is associated with the container, a StorageException will be raised. When it is invoked with the parameter recurse=true, the properties of the children containers are also stored into the storage. It is up to the container to decide if it has to store all the properties or only the changed properties.
Indicates whether the sub-containers' persist_properties should be called recursively.
It throws StorageException exception if an error occurs while persisting the properties.
virtual void restore_properties(CORBA::Boolean recurse);
Instructs the container to obtain its properties from the storage. A container knows exactly what properties is manages and it attempts to read those properties from the storage. The containers shipped with the ORB do not support restoring from the storage. You must create containers that support this feature yourself.
Indicates whether the sub-containers' restore_properties should be called recursively.
It throws StorageException exception if an error occurs while restoring the properties.
Methods related to operations
virtual CORBA::StringSeqence* list_all_operations();
Returns the names of all the operations supported in the container.
virtual OperationSequence* get_all_operations();
Returns all the operations along with the parameters and the type code of the parameters so that the operation can be invoked with the appropriate parameters.
virtual Operation* get_operation(const char* name);
Returns the parameter information of the operation specified by name which can be used to invoke the operation.
It can throw NameInvalid exception if the parameter specifies an operation which is not supported.
CORBA::Any* do_operation(const Operation& op);
Invokes the method in the operation and returns the result.
It can throw these exceptions:
NameInvalid if the operation is not defined on the container.
OperationFailed if the operation failed to execute.
ValueInvalid if the value for any of the parameter is not of the expected type.
Methods related to children containers
virtual CORBA::StringSequence* list_all_containers();
Returns the names of all the children containers of the current container.
virtual NamedContainerSequence* get_all_containers();
Returns all the named children containers.
virtual NamedContainer* get_container(const char * name) ;
Returns the named child container identified by the name parameter.
If there is no child container with this name, a NameInvalid exception is raised.
virtual void add_container(const NamedContainer& container);
Adds the container as a child container of this container.
It throws NameAlreadyPresent exception if a container with the specified name already exists. It throws ValueInvalid exception if the named container value is invalid.
virtual void set_container (const char * name, Container_ptr value);
Modifies the child container identified by the name parameter to one in the value parameter.
It can throw these exceptions:
NameInvalid if no container with the specified name exists.
ValueNotSettable if the i the container could not be replaced, for example if the original container is created to be irreplaceable.
ValueInvalid if the named container value is invalid.
Methods related to storage
virtual void set_storage(Storage_ptr s, CORBA::Boolean recurse);
Sets the storage of this container. If recurse=true, it also sets the storage for all its children as well.
virtual Storage_ptr get_storage();
Returns the current storage of the container.
The Storage Interface
class _VISSVMGREXPORT Storage : public virtual CORBA_Object
The Server Manager provides an abstract notion of storage that can be implemented in any fashion. Individual containers may choose to store their properties in databases, flat files, or some other means. The storage implementation included with the VisiBroker ORB uses a flat-file-based approach.
Include file
Include the file servermgr_c.hh when using this class.
Storage Interface Methods for C++
virtual void open();
Opens the storage and makes it ready for reading and writing the properties. For the database-based implementation, logging into the database is performed in this method.
It can throw StorageException if the storage could not be opened for any reasons.
virtual void close();
Closes the storage. This method also updates the storage with any properties that have been changed since the last Container::persist_properties call. In database implementations, this method closes the database connection.
It can throw StorageException if the closing fails for any reasons.
virtual Container::PropertySequence* read_properties();
Reads all the properties from the storage. It can throw StorageException if the properties could not be read from the Storage.
virtual Container::Property* read_property(const char * propertyName);
Returns the property value for propertyName read from the storage.
It throws NameInvalid. exception if the property name is not known to the container. It throws StorageException if an error occurs while reading the property from the storage.
virtual void write_properties( const Container::PropertySequence& p);
Saves the property sequence into the storage.
It can throw StorageException if an error occurs while writing the properties to storage.
virtual void write_property( const Container::Property& p);
Saves the single property into the storage.
It can throw StorageException if an error occurs while writing the property to storage.