The VisiBroker Server Manager allows client applications to monitor and manage object servers, view and set properties at runtime for those servers, and view and invoke methods on Server Manager objects. The Server Manager uses elements known as containers which represent each major ORB component. A container can contain properties, operations, and even other containers.
1 A server runner can choose to name the Server Manager using the property option vbroker.serverManager.name. For example, the command:
2 If the client has an object reference to some other object implemented by the server, then the client can perform _resolve_reference("ServerManager") on that object to obtain the ServerManager for the ORB corresponding to the object. Te following code fragment obtains the Server Manager's top-level container from the Bank::AccountManager object.The client code needs to include the servermgr_c.hh to use the Server Manager interfaces.The top-level container does not support any properties or operations but just contains the ORB container. The ORB container in turn contains few ORB properties, a shutdown method, and other containers like RootPOA, Agent, OAD, and so forth.See “The Container Interface” for information on how to interact with containers. “Server Manager examples” shows a Java example.Server Manager provides an abstract notion of storage that can be implemented in any fashion. Individual containers may choose to store their properties in the different ways. Some containers may choose to store their properties in a database, while others may choose to store them in files or in some other method. The Storage interface is defined in Server Manager IDL.Returns the names of all the properties in the contianer as a StringSequence.Returns the PropertySequence containing the names, values, and read-write status of all the properties in the container.Returns the value of the property name passed as an input parameter.Causes the container to actually store its properties to the associated storage. 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.Returns the parameter information of the operation specified by name which can be used to invoke the operation.public com.inprise.vbroker.ServerManager.ContainerPackage.
NamedContainer
get_container(String name) throws
com.inprise.vbroker.ServerManager.ContainerPackage.
NameInvalid;Returns the child container identified by the name parameter. If there is not any child container with this name, a NameInvalid exception is raised.public void add_container(
com.inprise.vbroker.ServerManager.ContainerPackage.
NamedContainer
container) throws com.inprise.vbroker.ServerManager.ContainerPackage.
NameAlreadyPresent,
com.inprise.vbroker.ServerManager.ContainerPackage.
ValueInvalid;public void set_container(String name, com.inprise.vbroker.ServerManager.Container value) throws
com.inprise.vbroker.ServerManager.ContainerPackage.
NameInvalid,
com.inprise.vbroker.ServerManager.ContainerPackage.
ValueInvalid,
com.inprise.vbroker.ServerManager.ContainerPackage.
ValueNotSettable;Sets the storage of this container. If recurse=true, it also sets the storage for all its children as well.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.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.public com.inprise.vbroker.ServerManager.ContainerPackage.
Property
read_property(String propertyName) throws com.inprise.vbroker.ServerManager.ContainerPackage.
NameInvalid,
com.inprise.vbroker.ServerManager.StorageException;Returns the property value for propertyName read from the storage.
Setting this property to True enables the Server Manager. Controls the permission to invoke operations in the containers. If set to false, the client will not be able to invoke do_operation on any container. This helps protect Server Manager from unintentional changes including shutting down the server by mistake. Controls the setting of properties from the client. If set to the false, clients cannot modify any of the container properties.
4 Invoke the shutdown() method on the ORB container.The following example uses the bank_agent server. This server should be started by passing the property storage file. Initially the property file contains the properties to enable the Server Manager and set its name. The file is used by the Server Manager to update the properties if the user changes them. The properties to enable the Server Manager and set its name can be passed as command-line options, but the property file is required if any of the properties are to be modified and saved during the session.This example uses the second, or bind method since the Server Manager has been started with a name (see “Obtaining a Server Manager reference”).The following example shows how get_all_properties, get_all_operations, and get_all_containers can be used to query all the properties and operations of all the containers below the current container recursively.The ORB container supports the operation shutdown. The operation can be obtained by calling get_operation on the container.The operation returned by the get_operation call has the default parameters. If the default values of the parameters are not the intended ones, these values should be modified before calling the do_operation method.
This property has a read-write status of READWRITE_ALL, so it can be modified and takes effect while the server is running. The purpose of this property is to make AccountManager unavailable for client applications. The initial value of this property is read by the server on startup and saved to the same file when server shuts down/restarts. This property has a read-write status of READONLY_ALL, so it can only be read. The purpose of this property is to provide the number of Accounts in the AccountManager. The value of this property is not written to the storage.
Shuts down the server without starting it again. Before shutdown, the manager.lockAllAccounts property is written (persisted) to the property file.If you want your application to implement its own storage, it has to implement the Storage interface defined in Server Manager IDL. The basic steps are same as implementing custom containers.