PAGE TITLE
Connections
ZeroC’s Newsletter for the Ice community
Page 4 Issue 5, August 2005 Page 5Issue 5, August 2005
Connections
ZeroC’s Newsletter for the Ice community
Connections
ZeroC’s Newsletter for the Ice community
Page 4 Issue 5, August 2005 Page 5Issue 5, August 2005
Connections
ZeroC’s Newsletter for the Ice community
Using IcePack, applications can locate objects in three ways.
1. Object identity
Given the object identity, the application queries IcePack and
locates the given object.
2. Object type
Given an object type-id, IcePack returns all objects that
implement this type.
3. Object identity @ adapter id
Given the object identity and an adapter id, the application
queries IcePack and locates the given object adapter.
Server Deployment
Deployment descriptors make your application very easy to man-
age: you describe a deployment once and deploy many times with
potentially different deployment scenarios, such as deployment for
a test suite and deployment for production. A deployment descrip-
tor is an XML file that describes the structure of your application.
Deployment of your application does the following:
• creates server configuration files
• initializes any required Freeze database environments
• registers servers with the appropriate IcePack node daemon
• adds object adapters to the IcePack registry
• adds well-known objects and their identities to the IcePack
registry
Preparing the Chat Session Server
Strictly speaking, the server can be managed by IcePack as it is.
However, in order to fully take advantage of IcePack, we must
make a few changes. IcePack generates configuration files from a
server’s deployment descriptor, so we must remove the hard-coded
configuration file.
// C++
int
main(int argc, char* argv[])
{
ChatSessionServer app;
return app.main(argc, argv);
}
Since we want to use indirect binding, we can remove the IceStorm
TopicManager proxy from the configuration file and instead look
up the object by identity. The code originally was:
// C++
string str = communicator->getProperties()
->getProperty("IceStorm.TopicManager.Proxy");
_manager = IceStorm::TopicManagerPrx::
checkedCast(communicator->stringToProxy(str));
The code now becomes:
// C++
_manager = IceStorm::TopicManagerPrx::
checkedCast(communicator->
stringToProxy("IceStorm/TopicManager"));
Under the covers this locates the object by identity using IcePack.
It is equivalent to the following code:
// C++
IcePack::QueryPtr query = IcePack::Query::
uncheckedCast(communicator->
stringToProxy("IcePack/Query"));
Identity id;
id.name = "IceStorm/TopicManager";
_manager = IceStorm::TopicManagerPrx::
checkedCast(query->findObjectById(id));
How does the application know how to locate the IcePack registry?
This is configured in the configuration property Ice.Default.
Locator and is provided automatically by IcePack to any IcePack
managed servers.
These are all the changes that are nec-
essary to enable the chat server to be an
IcePack-managed server. Next we need
to write the deployment descriptor.
Deployment Descriptors
An IcePack deployment descriptor con-
tains a description of:
• nodes on which the servers are deployed
• servers that run on the nodes
• IceBox services that are hosted by a
server, if applicable
• object adapters, and well known objects
and their type hosted by the servers and
services
Figure 4: Indirect Binding
INTRODUCTION TO ICEPACK