summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-09-17 21:24:51 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-09-17 21:24:51 +0000
commit77f2ff38b10a12f7189ab10dba239f7b53417986 (patch)
treee203c24868f907dc8c3f8e5525e1c4c68aa308fb /cpp
parentAdded support for --case-sensitive option (attribute casesensitive). (diff)
downloadice-77f2ff38b10a12f7189ab10dba239f7b53417986.tar.bz2
ice-77f2ff38b10a12f7189ab10dba239f7b53417986.tar.xz
ice-77f2ff38b10a12f7189ab10dba239f7b53417986.zip
Added ${parent} variable to get the name of the parent component.
Added attribute targets to server and service elements. More clean up.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp11
-rw-r--r--cpp/src/IcePack/ActivatorI.cpp7
-rw-r--r--cpp/src/IcePack/ActivatorI.h5
-rw-r--r--cpp/src/IcePack/AdminI.cpp4
-rw-r--r--cpp/src/IcePack/ApplicationBuilder.cpp14
-rw-r--r--cpp/src/IcePack/ApplicationBuilder.h3
-rw-r--r--cpp/src/IcePack/ComponentBuilder.cpp113
-rw-r--r--cpp/src/IcePack/ComponentBuilder.h9
-rw-r--r--cpp/src/IcePack/IcePackNode.cpp25
-rw-r--r--cpp/src/IcePack/ServerAdapterI.cpp7
-rw-r--r--cpp/src/IcePack/ServerBuilder.cpp87
-rw-r--r--cpp/src/IcePack/ServerBuilder.h5
-rw-r--r--cpp/src/IcePack/ServerDeployerI.cpp25
-rw-r--r--cpp/src/IcePack/ServerI.cpp4
-rw-r--r--cpp/src/IcePack/ServiceBuilder.cpp38
-rw-r--r--cpp/src/IcePack/ServiceBuilder.h7
-rw-r--r--cpp/test/IcePack/deployer/AllTests.cpp58
-rw-r--r--cpp/test/IcePack/deployer/Server.cpp2
-rw-r--r--cpp/test/IcePack/deployer/Service.cpp10
-rw-r--r--cpp/test/IcePack/deployer/application.xml2
-rw-r--r--cpp/test/IcePack/deployer/freezeservice.xml7
-rw-r--r--cpp/test/IcePack/deployer/icebox.xml4
-rw-r--r--cpp/test/IcePack/deployer/server.xml14
-rw-r--r--cpp/test/IcePack/deployer/service.xml7
24 files changed, 288 insertions, 180 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index 04abd723fbf..7cd8fcec978 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -245,12 +245,19 @@ IceInternal::LocatorInfo::getEndpoints(const ReferencePtr& ref, bool& cached)
endpoints = object->__reference()->endpoints;
}
}
- catch(const LocalException&)
+ catch(const LocalException& ex)
{
//
- // Ignore. The proxy will most likely get empty
+ // Just trace the failure. The proxy will most likely get empty
// endpoints and raise a NoEndpointException().
//
+ if(ref->instance->traceLevels()->location >= 1)
+ {
+ Trace out(ref->instance->logger(), ref->instance->traceLevels()->locationCat);
+ out << "couldn't contact the locator to retrieve adapter endpoints\n";
+ out << "adapter = " << ref->adapterId << "\n";
+ out << "reason = " << ex;
+ }
}
//
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp
index 8525e5eebeb..77bb18c6736 100644
--- a/cpp/src/IcePack/ActivatorI.cpp
+++ b/cpp/src/IcePack/ActivatorI.cpp
@@ -51,8 +51,9 @@ private:
}
-IcePack::ActivatorI::ActivatorI(const TraceLevelsPtr& traceLevels) :
+IcePack::ActivatorI::ActivatorI(const TraceLevelsPtr& traceLevels, const PropertiesPtr& properties) :
_traceLevels(traceLevels),
+ _properties(properties),
_deactivating(false)
{
int fds[2];
@@ -126,7 +127,7 @@ IcePack::ActivatorI::activate(const ServerPtr& server)
//
// Compute arguments.
//
- int argc = server->description.theArgs.size() + 2;
+ int argc = server->description.theArgs.size() + 3;
char** argv = static_cast<char**>(malloc(argc * sizeof(char*)));
argv[0] = strdup(path.c_str());
unsigned int i = 0;
@@ -135,6 +136,8 @@ IcePack::ActivatorI::activate(const ServerPtr& server)
{
argv[i + 1] = strdup(q->c_str());
}
+ string locatorArg = "--Ice.Default.Locator=" + _properties->getProperty("Ice.Default.Locator");
+ argv[argc - 2] = strdup(locatorArg.c_str());
argv[argc - 1] = 0;
if(_traceLevels->activator > 1)
diff --git a/cpp/src/IcePack/ActivatorI.h b/cpp/src/IcePack/ActivatorI.h
index fc694f17779..c2b1e871f62 100644
--- a/cpp/src/IcePack/ActivatorI.h
+++ b/cpp/src/IcePack/ActivatorI.h
@@ -25,7 +25,7 @@ class ActivatorI : public Activator, public IceUtil::Monitor< IceUtil::Mutex>
{
public:
- ActivatorI(const TraceLevelsPtr&);
+ ActivatorI(const TraceLevelsPtr&, const Ice::PropertiesPtr&);
virtual ~ActivatorI();
virtual bool activate(const ::IcePack::ServerPtr&);
@@ -56,6 +56,7 @@ private:
};
TraceLevelsPtr _traceLevels;
+ Ice::PropertiesPtr _properties;
std::vector<Process> _processes;
bool _deactivating;
@@ -65,8 +66,6 @@ private:
IceUtil::ThreadPtr _thread;
};
-typedef IceUtil::Handle<ActivatorI> ActivatorIPtr;
-
}
#endif
diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp
index c39d458b7cd..f09b89c5f96 100644
--- a/cpp/src/IcePack/AdminI.cpp
+++ b/cpp/src/IcePack/AdminI.cpp
@@ -50,7 +50,7 @@ IcePack::AdminI::addServer(const string& node, const string& name, const string&
const string& descriptor, const Targets& targets, const Current&)
{
ApplicationBuilder builder(_communicator, _nodeRegistry, targets);
- builder.addServer(name, node, descriptor, path, ldpath);
+ builder.addServer(name, node, descriptor, path, ldpath, "");
builder.execute();
}
@@ -63,7 +63,7 @@ IcePack::AdminI::removeServer(const string& name, const Current&)
ServerDescription desc = server->getServerDescription();
ApplicationBuilder builder(_communicator, _nodeRegistry, desc.theTargets);
- builder.addServer(name, desc.node, desc.descriptor, desc.path, "");
+ builder.addServer(name, desc.node, desc.descriptor, desc.path, "", "");
builder.undo();
}
catch(const Ice::ObjectNotExistException&)
diff --git a/cpp/src/IcePack/ApplicationBuilder.cpp b/cpp/src/IcePack/ApplicationBuilder.cpp
index 687a1e11150..2725670d1ea 100644
--- a/cpp/src/IcePack/ApplicationBuilder.cpp
+++ b/cpp/src/IcePack/ApplicationBuilder.cpp
@@ -164,11 +164,13 @@ IcePack::ApplicationHandler::startElement(const XMLCh* name, AttributeList& attr
throw DeploySAXParseException("Server element is not allowed outside the scope of a node element",
_locator);
}
+
string name = getAttributeValue(attrs, "name");
string descriptor = _builder.toLocation(getAttributeValue(attrs, "descriptor"));
string binpath = _builder.toLocation(getAttributeValueWithDefault(attrs, "binpath", ""));
string libpath = getAttributeValueWithDefault(attrs, "libpath", "");
- _builder.addServer(name, _currentNode, descriptor, binpath, libpath);
+ string targets = getAttributeValueWithDefault(attrs, "targets", "");
+ _builder.addServer(name, _currentNode, descriptor, binpath, libpath, targets);
}
}
@@ -192,7 +194,7 @@ IcePack::ApplicationHandler::endElement(const XMLCh* name)
IcePack::ApplicationBuilder::ApplicationBuilder(const Ice::CommunicatorPtr& communicator,
const NodeRegistryPtr& nodeRegistry,
const vector<string>& targets) :
- ComponentBuilder(communicator, "", targets),
+ ComponentBuilder(communicator, map<string, string>(), targets),
_nodeRegistry(nodeRegistry)
{
}
@@ -210,7 +212,8 @@ IcePack::ApplicationBuilder::addServer(const string& name,
const string& nodeName,
const string& descriptor,
const string& binpath,
- const string& libpath)
+ const string& libpath,
+ const string& additionalTargets)
{
if(name.empty())
{
@@ -224,6 +227,9 @@ IcePack::ApplicationBuilder::addServer(const string& name,
{
throw DeploySAXParseException("descriptor attribute value is empty", _locator);
}
+
+ vector<string> targets = toTargets(additionalTargets);
+ copy(_targets.begin(), _targets.end(), back_inserter(targets));
NodePrx node;
try
@@ -242,7 +248,7 @@ IcePack::ApplicationBuilder::addServer(const string& name,
try
{
ServerDeployerPrx deployer = node->getServerDeployer();
- _tasks.push_back(new AddServer(deployer, nodeName, name, descriptor, binpath, libpath, _targets));
+ _tasks.push_back(new AddServer(deployer, nodeName, name, descriptor, binpath, libpath, targets));
}
catch(::Ice::LocalException&)
{
diff --git a/cpp/src/IcePack/ApplicationBuilder.h b/cpp/src/IcePack/ApplicationBuilder.h
index fb000bf491a..ed70effe776 100644
--- a/cpp/src/IcePack/ApplicationBuilder.h
+++ b/cpp/src/IcePack/ApplicationBuilder.h
@@ -25,7 +25,8 @@ public:
void parse(const std::string&);
- void addServer(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&);
+ void addServer(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&,
+ const std::string&);
void setBaseDir(const std::string&);
private:
diff --git a/cpp/src/IcePack/ComponentBuilder.cpp b/cpp/src/IcePack/ComponentBuilder.cpp
index 6346cbc4bea..8598a0c74f8 100644
--- a/cpp/src/IcePack/ComponentBuilder.cpp
+++ b/cpp/src/IcePack/ComponentBuilder.cpp
@@ -355,16 +355,27 @@ IcePack::ComponentHandler::startElement(const XMLCh *const name, AttributeList &
}
else if(str == "adapter")
{
- if(!_currentAdapter.empty())
+ if(!_currentAdapterId.empty())
{
throw DeploySAXParseException("Adapter element enclosed in an adapter element is not allowed", _locator);
}
- _currentAdapter = getAttributeValue(attrs, "name");
+
+ //
+ // If the id is not specified, we ask the builder to generate
+ // an id for us based on the adapter name.
+ //
+ string name = getAttributeValue(attrs, "name");
+ if(name.empty())
+ {
+ throw DeploySAXParseException("empty adapter name", _locator);
+ }
+ _currentAdapterId = getAttributeValueWithDefault(attrs, "id", _builder.getDefaultAdapterId(name));
}
else if(str == "offer")
{
- _builder.addOffer(getAttributeValue(attrs, "interface"), _currentAdapter,
- getAttributeValue(attrs, "identity"));
+ _builder.addOffer(getAttributeValue(attrs, "interface"),
+ _currentAdapterId,
+ getAttributeValue(attrs, "identity"));
}
else if(str == "target")
{
@@ -392,7 +403,7 @@ IcePack::ComponentHandler::endElement(const XMLCh *const name)
{
if(str == "adapter")
{
- _currentAdapter = "";
+ _currentAdapterId = "";
}
}
}
@@ -482,24 +493,13 @@ IcePack::ComponentHandler::isCurrentTargetDeployable() const
}
IcePack::ComponentBuilder::ComponentBuilder(const Ice::CommunicatorPtr& communicator,
- const string& componentPath,
+ const map<string, string>& variables,
const vector<string>& targets) :
_communicator(communicator),
_properties(Ice::createProperties()),
- _componentPath(componentPath),
+ _variables(variables),
_targets(targets)
{
- Ice::PropertiesPtr properties = _communicator->getProperties();
-
- //
- // TODO: this probably doesn't belong to ComponentBuilder since
- // it's also used by the registry...
- //
- string serversPath = properties->getProperty("IcePack.Node.Data");
- if(!serversPath.empty())
- {
- _variables["datadir"] = serversPath + (serversPath[serversPath.length() - 1] == '/' ? "" : "/") + "servers";
- }
}
void
@@ -544,7 +544,7 @@ IcePack::ComponentBuilder::parse(const string& xmlFile, ComponentHandler& handle
os << xmlFile << ":" << e.getLineNumber() << ": " << toString(e.getMessage());
ParserDeploymentException ex;
- ex.component = _componentPath;
+ ex.component = _variables["fqn"];
ex.reason = os.str();
throw ex;
}
@@ -556,7 +556,7 @@ IcePack::ComponentBuilder::parse(const string& xmlFile, ComponentHandler& handle
os << xmlFile << ": SAXException: " << toString(e.getMessage());
ParserDeploymentException ex;
- ex.component = _componentPath;
+ ex.component = _variables["fqn"];
ex.reason = os.str();
throw ex;
}
@@ -568,7 +568,7 @@ IcePack::ComponentBuilder::parse(const string& xmlFile, ComponentHandler& handle
os << xmlFile << ": XMLException: " << toString(e.getMessage());
ParserDeploymentException ex;
- ex.component = _componentPath;
+ ex.component = _variables["fqn"];
ex.reason = os.str();
throw ex;
}
@@ -580,7 +580,7 @@ IcePack::ComponentBuilder::parse(const string& xmlFile, ComponentHandler& handle
os << xmlFile << ": unknown exception while parsing file";
ParserDeploymentException ex;
- ex.component = _componentPath;
+ ex.component = _variables["fqn"];
ex.reason = os.str();
throw ex;
}
@@ -591,7 +591,7 @@ IcePack::ComponentBuilder::parse(const string& xmlFile, ComponentHandler& handle
if(rc > 0)
{
ParserDeploymentException ex;
- ex.component = _componentPath;
+ ex.component = _variables["fqn"];
ex.reason = xmlFile + ": parse error";
throw ex;
}
@@ -606,6 +606,10 @@ IcePack::ComponentBuilder::setDocumentLocator(const Locator* locator)
bool
IcePack::ComponentBuilder::isTargetDeployable(const string& target) const
{
+ map<string, string>::const_iterator p = _variables.find("fqn");
+ assert(p != _variables.end());
+ const string fqn = p->second;
+
for(vector<string>::const_iterator p = _targets.begin(); p != _targets.end(); ++p)
{
if((*p) == target)
@@ -619,17 +623,18 @@ IcePack::ComponentBuilder::isTargetDeployable(const string& target) const
while(end != string::npos)
{
//
- // Add the first component name to the component target
- // path.
+ // Add the first component name from the component
+ // fully qualified name to the target and see if
+ // matches.
//
- end = _componentPath.find('.', end);
+ end = fqn.find('.', end);
if(end == string::npos)
{
- componentTarget = _componentPath + "." + target;
+ componentTarget = fqn + "." + target;
}
else
{
- componentTarget = _componentPath.substr(0, end) + "." + target;
+ componentTarget = fqn.substr(0, end) + "." + target;
++end;
}
@@ -658,7 +663,7 @@ IcePack::ComponentBuilder::execute()
{
if(ex.component.empty())
{
- ex.component = _componentPath;
+ ex.component = _variables["fqn"];
}
undoFrom(p);
throw;
@@ -678,7 +683,7 @@ IcePack::ComponentBuilder::undo()
catch(const DeploymentException& ex)
{
ostringstream os;
- os << "exception while removing component " << (ex.component.empty() ? _componentPath : ex.component);
+ os << "exception while removing component " << (ex.component.empty() ? _variables["fqn"] : ex.component);
os << ":\n" << ex << ": " << ex.reason;
_communicator->getLogger()->warning(os.str());
@@ -708,9 +713,9 @@ IcePack::ComponentBuilder::addProperty(const string& name, const string& value)
}
void
-IcePack::ComponentBuilder::addOffer(const string& offer, const string& adapter, const string& identity)
+IcePack::ComponentBuilder::addOffer(const string& offer, const string& adapterId, const string& identity)
{
- assert(!adapter.empty());
+ assert(!adapterId.empty());
if(!_yellowAdmin)
{
@@ -718,7 +723,7 @@ IcePack::ComponentBuilder::addOffer(const string& offer, const string& adapter,
throw DeploySAXParseException(msg, _locator);
}
- Ice::ObjectPrx object = _communicator->stringToProxy(identity + "@" + adapter);
+ Ice::ObjectPrx object = _communicator->stringToProxy(identity + "@" + adapterId);
assert(object);
_tasks.push_back(new RegisterOffer(_yellowAdmin, offer, object));
@@ -738,6 +743,18 @@ IcePack::ComponentBuilder::overrideBaseDir(const string& basedir)
}
//
+// Compute an adapter id for a given adapter name.
+//
+string
+IcePack::ComponentBuilder::getDefaultAdapterId(const string& name)
+{
+ //
+ // Concatenate the component name to the adapter name.
+ //
+ return name + "-" + _variables["name"];
+}
+
+//
// Returns a path including the base directory if path is a relative
// path.
//
@@ -787,6 +804,34 @@ IcePack::ComponentBuilder::substitute(const string& v) const
return value;
}
+vector<string>
+IcePack::ComponentBuilder::toTargets(const string& targets) const
+{
+ vector<string> result;
+
+ if(!targets.empty())
+ {
+ const string delim = " \t\n\r";
+
+ string::size_type beg = 0;
+ string::size_type end = 0;
+ do
+ {
+ end = targets.find_first_of(delim, end);
+ if(end == string::npos)
+ {
+ end = targets.size();
+ }
+
+ result.push_back(targets.substr(beg, end - beg));
+ beg = ++end;
+ }
+ while(end < targets.size());
+ }
+
+ return result;
+}
+
void
IcePack::ComponentBuilder::undoFrom(vector<TaskPtr>::iterator p)
{
@@ -801,7 +846,7 @@ IcePack::ComponentBuilder::undoFrom(vector<TaskPtr>::iterator p)
catch(const DeploymentException& ex)
{
ostringstream os;
- os << "exception while removing component " << _componentPath << ": " << ex.reason << ":" << endl;
+ os << "exception while removing component " << _variables["fqn"] << ": " << ex.reason << ":" << endl;
os << ex;
_communicator->getLogger()->warning(os.str());
diff --git a/cpp/src/IcePack/ComponentBuilder.h b/cpp/src/IcePack/ComponentBuilder.h
index 90b15a537b4..28bda3b1048 100644
--- a/cpp/src/IcePack/ComponentBuilder.h
+++ b/cpp/src/IcePack/ComponentBuilder.h
@@ -113,7 +113,7 @@ protected:
ComponentBuilder& _builder;
std::stack<std::string> _elements;
- std::string _currentAdapter;
+ std::string _currentAdapterId;
std::string _currentTarget;
bool _isCurrentTargetDeployable;
@@ -137,7 +137,9 @@ class ComponentBuilder : public Task
{
public:
- ComponentBuilder(const Ice::CommunicatorPtr&, const std::string&, const std::vector<std::string>&);
+ ComponentBuilder(const Ice::CommunicatorPtr&,
+ const std::map<std::string, std::string>&,
+ const std::vector<std::string>&);
virtual void execute();
virtual void undo();
@@ -155,8 +157,10 @@ public:
void addOffer(const std::string&, const std::string&, const std::string&);
void overrideBaseDir(const std::string&);
+ virtual std::string getDefaultAdapterId(const std::string&);
std::string toLocation(const std::string&) const;
std::string substitute(const std::string&) const;
+ std::vector<std::string> toTargets(const std::string&) const;
void undoFrom(std::vector<TaskPtr>::iterator);
protected:
@@ -168,7 +172,6 @@ protected:
std::map<std::string, std::string> _variables;
std::vector<TaskPtr> _tasks;
std::string _configFile;
- std::string _componentPath;
std::vector<std::string> _targets;
const Locator* _locator;
diff --git a/cpp/src/IcePack/IcePackNode.cpp b/cpp/src/IcePack/IcePackNode.cpp
index 4dad7b90bba..44064a1fd17 100644
--- a/cpp/src/IcePack/IcePackNode.cpp
+++ b/cpp/src/IcePack/IcePackNode.cpp
@@ -182,7 +182,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator, const Free
//
// Create the activator.
//
- activator = new ActivatorI(traceLevels);
+ activator = new ActivatorI(traceLevels, properties);
//
// Creates the server factory. The server factory creates server
@@ -354,6 +354,17 @@ main(int argc, char* argv[])
Ice::PropertiesPtr properties = communicator->getProperties();
//
+ // Disable server idle time. Otherwise, the adapter would be
+ // shutdown permaturaly and the deactivation would
+ // fail. Deactivation of the node relies on the object adapter
+ // to be active since it needs to terminate servers.
+ //
+ // TODO: implement Ice.ServerIdleTime in the activator
+ // termination listener instead?
+ //
+ properties->setProperty("Ice.ServerIdleTime", "0");
+
+ //
// Remove IcePack and Freeze command line options from argv.
//
Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
@@ -385,16 +396,8 @@ main(int argc, char* argv[])
//
// Set the Ice.Default.Locator property to point to the
- // collocated locator (this property is used in the server
- // builder when generating server configuration files).
- //
- // TODO: Actually I don't think think this is really
- // correct. We shouldn't put the Ice.Default.Locator in
- // the generated server configuration file. If for some
- // reasons the locator endpoint change we would need to
- // re-generated everything. Instead, we should pass this
- // property to the activator and pass it to the server
- // through the command line.
+ // collocated locator (this property is passed by the
+ // activator to each activated server).
//
string locatorPrx = "IcePack/Locator:" + properties->getProperty("IcePack.Registry.Locator.Endpoints");
properties->setProperty("Ice.Default.Locator", locatorPrx);
diff --git a/cpp/src/IcePack/ServerAdapterI.cpp b/cpp/src/IcePack/ServerAdapterI.cpp
index e26e8432ecb..0ae0c8f2f03 100644
--- a/cpp/src/IcePack/ServerAdapterI.cpp
+++ b/cpp/src/IcePack/ServerAdapterI.cpp
@@ -97,11 +97,14 @@ IcePack::ServerAdapterI::setDirectProxy(const Ice::ObjectPrx& prx, const Ice::Cu
//
// If the adapter proxy is not null the given proxy can only be
// null. We don't allow to overide an existing proxy by another
- // non null proxy.
+ // non null proxy if the server is active.
//
if(prx && _proxy)
{
- throw AdapterActiveException();
+ if(theServer->getState() == Active)
+ {
+ throw AdapterActiveException();
+ }
}
_proxy = prx;
diff --git a/cpp/src/IcePack/ServerBuilder.cpp b/cpp/src/IcePack/ServerBuilder.cpp
index c79d32889d1..159c4b20014 100644
--- a/cpp/src/IcePack/ServerBuilder.cpp
+++ b/cpp/src/IcePack/ServerBuilder.cpp
@@ -257,7 +257,9 @@ IcePack::ServerHandler::startElement(const XMLCh *const name, AttributeList &att
//
_builder.addProperty("IceBox.ServiceManager.Identity", _builder.substitute("${name}/ServiceManager"));
- _builder.registerAdapter("IceBox.ServiceManager", getAttributeValue(attrs, "endpoints"), "");
+ _builder.registerAdapter("IceBox.ServiceManager",
+ getAttributeValue(attrs, "endpoints"),
+ _builder.getDefaultAdapterId("IceBox.ServiceManager"));
}
else if(kind == "java-icebox")
{
@@ -270,20 +272,23 @@ IcePack::ServerHandler::startElement(const XMLCh *const name, AttributeList &att
//
_builder.addProperty("IceBox.ServiceManager.Identity", _builder.substitute("${name}/ServiceManager"));
- _builder.registerAdapter("IceBox.ServiceManager", getAttributeValue(attrs, "endpoints"), "");
+ _builder.registerAdapter("IceBox.ServiceManager",
+ getAttributeValue(attrs, "endpoints"),
+ _builder.getDefaultAdapterId("IceBox.ServiceManager"));
}
}
else if(str == "service")
{
string name = getAttributeValue(attrs, "name");
string descriptor = getAttributeValue(attrs, "descriptor");
- _builder.addService(name, descriptor);
+ string targets = getAttributeValueWithDefault(attrs, "targets", "");
+ _builder.addService(name, descriptor, targets);
}
else if(str == "adapter")
{
- _builder.registerAdapter(getAttributeValue(attrs, "name"),
- getAttributeValue(attrs, "endpoints"),
- getAttributeValueWithDefault(attrs, "id", ""));
+ assert(!_currentAdapterId.empty());
+ string name = getAttributeValue(attrs, "name");
+ _builder.registerAdapter(name, getAttributeValue(attrs, "endpoints"), _currentAdapterId);
}
else if(str == "activation")
{
@@ -325,36 +330,31 @@ IcePack::ServerHandler::endElement(const XMLCh *const name)
IcePack::ServerBuilder::ServerBuilder(const NodeInfoPtr& nodeInfo,
const map<string, string>& variables,
- const string& componentPath,
const vector<string>& targets) :
- ComponentBuilder(nodeInfo->getCommunicator(), componentPath, targets),
+ ComponentBuilder(nodeInfo->getCommunicator(), variables, targets),
_nodeInfo(nodeInfo)
{
+ assert(_variables.find("parent") != _variables.end());
+ assert(_variables.find("name") != _variables.end());
+ assert(_variables.find("fqn") != _variables.end());
+ assert(_variables.find("datadir") != _variables.end());
+ assert(_variables.find("binpath") != _variables.end());
+ assert(_variables.find("libpath") != _variables.end());
+
+ //
+ // Required for the component builder.
+ //
_yellowAdmin = _nodeInfo->getYellowAdmin();
-
- map<string, string>::const_iterator p = variables.find("name");
- assert(p != variables.end());
-
- _variables["name"] = p->second;
- _variables["datadir"] += "/" + _variables["name"];
+ //
+ // Begin to populate the server description.
+ //
+ _description.name = _variables["name"];
+ _description.path = _variables["binpath"];
+ _libraryPath = _variables["libpath"];
_description.node = nodeInfo->getNode()->getName();
- _description.name = p->second;
_description.theTargets = targets;
_description.activation = OnDemand;
-
- //
- // TODO: variables should be passed to the component handler. We
- // should also get rid of the _componentPath variable and instead
- // use a "parent" variable.
- //
- p = variables.find("binpath");
- assert(p != variables.end());
- _description.path = p->second;
-
- p = variables.find("libpath");
- assert(p != variables.end());
- _libraryPath = p->second;
}
void
@@ -382,12 +382,6 @@ IcePack::ServerBuilder::parse(const std::string& descriptor)
_properties->setProperty("Yellow.Query",
_nodeInfo->getCommunicator()->proxyToString(_nodeInfo->getYellowQuery()));
- //
- // TODO: we shouldn't generate this in the configuration. See
- // comment in main() in IcePackNode.cpp
- //
- _properties->setProperty("Ice.Default.Locator", props->getProperty("Ice.Default.Locator"));
-
if(_kind == ServerKindJavaServer || _kind == ServerKindJavaIceBox)
{
if(!_libraryPath.empty())
@@ -553,31 +547,29 @@ IcePack::ServerBuilder::registerAdapter(const string& name, const string& endpoi
{
throw DeploySAXParseException("empty adapter endpoints", _locator);
}
+ if(adapterId.empty())
+ {
+ throw DeploySAXParseException("empty adapter id", _locator);
+ }
//
- // If the adapter id is not specified, generate one from the
- // server and adapter name.
- //
- string id = adapterId.empty() ? name + "-" + _variables["name"] : adapterId;
-
- //
// A server adapter object will be created with the server when
// the server is created (see ServerBuilder::execute()
// method). The RegisterServerAdapter task will get the server
// adapter proxy through the builder method getServerAdapter().
//
- _serverAdapterNames.push_back(id);
- _tasks.push_back(new RegisterServerAdapterTask(adapterRegistry, id, *this));
+ _serverAdapterNames.push_back(adapterId);
+ _tasks.push_back(new RegisterServerAdapterTask(adapterRegistry, adapterId, *this));
//
// Generate adapter configuration properties.
//
addProperty(name + ".Endpoints", endpoints);
- addProperty(name + ".AdapterId", id);
+ addProperty(name + ".AdapterId", adapterId);
}
void
-IcePack::ServerBuilder::addService(const string& name, const string& descriptor)
+IcePack::ServerBuilder::addService(const string& name, const string& descriptor, const string& additionalTargets)
{
if(_kind != ServerKindCppIceBox && _kind != ServerKindJavaIceBox)
{
@@ -597,11 +589,14 @@ IcePack::ServerBuilder::addService(const string& name, const string& descriptor)
// Setup new variables for the service, overides the name value.
//
std::map<std::string, std::string> variables = _variables;
+ variables["parent"] = _variables["name"];
variables["name"] = name;
+ variables["fqn"] = _variables["fqn"] + "." + name;
- string componentPath = _componentPath + "." + name;
+ vector<string> targets = toTargets(additionalTargets);
+ copy(_targets.begin(), _targets.end(), back_inserter(targets));
- ServiceBuilder* task = new ServiceBuilder(_nodeInfo, *this, variables, componentPath, _targets);
+ ServiceBuilder* task = new ServiceBuilder(_nodeInfo, *this, variables, targets);
try
{
task->parse(toLocation(descriptor));
diff --git a/cpp/src/IcePack/ServerBuilder.h b/cpp/src/IcePack/ServerBuilder.h
index e96ac3c5143..c9df3eba349 100644
--- a/cpp/src/IcePack/ServerBuilder.h
+++ b/cpp/src/IcePack/ServerBuilder.h
@@ -30,7 +30,8 @@ public:
ServerKindJavaServer
};
- ServerBuilder(const NodeInfoPtr&, const std::map<std::string, std::string>&, const std::string&,
+ ServerBuilder(const NodeInfoPtr&,
+ const std::map<std::string, std::string>&,
const std::vector<std::string>&);
void parse(const std::string&);
@@ -42,7 +43,7 @@ public:
void setWorkingDirectory(const std::string&);
void registerServer();
void registerAdapter(const std::string&, const std::string&, const std::string&);
- void addService(const std::string&, const std::string&);
+ void addService(const std::string&, const std::string&, const std::string&);
void addOption(const std::string&);
void addJavaOption(const std::string&);
void setKind(ServerKind);
diff --git a/cpp/src/IcePack/ServerDeployerI.cpp b/cpp/src/IcePack/ServerDeployerI.cpp
index 7ed57ba3da5..b337a72be3f 100644
--- a/cpp/src/IcePack/ServerDeployerI.cpp
+++ b/cpp/src/IcePack/ServerDeployerI.cpp
@@ -30,18 +30,20 @@ void
IcePack::ServerDeployerI::add(const string& name, const string& descriptor, const string& binPath,
const string& libPath, const Targets& targets, const Ice::Current&)
{
+ //
+ // Setup required variables.
+ //
map<string, string> variables;
+ variables["parent"] = _nodeInfo->getNode()->getName();
variables["name"] = name;
+ variables["fqn"] = _nodeInfo->getNode()->getName() + "." + name;
variables["binpath"] = binPath;
variables["libpath"] = libPath;
-
- //
- // Component path is used to identify the component. For example:
- // node1.server1.service3
- //
- string componentPath = _nodeInfo->getNode()->getName() + "." + name;
- ServerBuilder builder(_nodeInfo, variables, componentPath, targets);
+ string dataDir = _nodeInfo->getCommunicator()->getProperties()->getProperty("IcePack.Node.Data");
+ variables["datadir"] = dataDir + (dataDir[dataDir.length() - 1] == '/' ? "" : "/") + "servers/" + name;
+
+ ServerBuilder builder(_nodeInfo, variables, targets);
//
// Parse the server deployment descriptors.
@@ -107,11 +109,16 @@ IcePack::ServerDeployerI::remove(const string& name, const Ice::Current&)
}
map<string, string> variables;
+ variables["parent"] = _nodeInfo->getNode()->getName();
variables["name"] = name;
- variables["binpath"] = desc.path; // Required for parsing to succeed.
+ variables["fqn"] = _nodeInfo->getNode()->getName() + "." + name;
+ variables["binpath"] = desc.path;
variables["libpath"] = "";
- ServerBuilder builder(_nodeInfo, variables, componentPath, desc.theTargets);
+ string dataDir = _nodeInfo->getCommunicator()->getProperties()->getProperty("IcePack.Node.Data");
+ variables["datadir"] = dataDir + (dataDir[dataDir.length() - 1] == '/' ? "" : "/") + "servers/" + name;
+
+ ServerBuilder builder(_nodeInfo, variables, desc.theTargets);
//
// Parse the server deployment descriptors.
diff --git a/cpp/src/IcePack/ServerI.cpp b/cpp/src/IcePack/ServerI.cpp
index b98b7c9a453..f572e47ab0a 100644
--- a/cpp/src/IcePack/ServerI.cpp
+++ b/cpp/src/IcePack/ServerI.cpp
@@ -293,8 +293,8 @@ IcePack::ServerI::terminated(const Ice::Current&)
}
catch(const Ice::LocalException& ex)
{
- cerr << (*p)->__reference()->toString() << endl;
- cerr << ex << endl;
+ //cerr << (*p)->__reference()->toString() << endl;
+ //cerr << ex << endl;
throw;
}
}
diff --git a/cpp/src/IcePack/ServiceBuilder.cpp b/cpp/src/IcePack/ServiceBuilder.cpp
index 37adeaed70a..129a3a1e464 100644
--- a/cpp/src/IcePack/ServiceBuilder.cpp
+++ b/cpp/src/IcePack/ServiceBuilder.cpp
@@ -75,34 +75,29 @@ IcePack::ServiceHandler::startElement(const XMLCh *const name, AttributeList &at
}
else if(str == "adapter")
{
+ assert(!_currentAdapterId.empty());
string name = getAttributeValue(attrs, "name");
- string id = getAttributeValueWithDefault(attrs, "id", "");
-
- //
- // If the adapter id is not specified or empty, generate one
- // from the server, service and adapter name: <adapter
- // name>-<server name>-<service name>
- //
- if(id.empty())
- {
- id = name + "-" + _builder.getServerBuilder().substitute("${name}") + _builder.substitute("${name}");
- }
- _builder.getServerBuilder().registerAdapter(name, getAttributeValue(attrs, "endpoints"), id);
+ _builder.getServerBuilder().registerAdapter(name, getAttributeValue(attrs, "endpoints"), _currentAdapterId);
}
}
IcePack::ServiceBuilder::ServiceBuilder(const NodeInfoPtr& nodeInfo,
ServerBuilder& serverBuilder,
const map<string, string>& variables,
- const string& componentPath,
const vector<string>& targets) :
- ComponentBuilder(nodeInfo->getCommunicator(), componentPath, targets),
+ ComponentBuilder(nodeInfo->getCommunicator(), variables, targets),
_nodeInfo(nodeInfo),
_serverBuilder(serverBuilder)
{
- _yellowAdmin = nodeInfo->getYellowAdmin();
+ assert(_variables.find("parent") != _variables.end());
+ assert(_variables.find("name") != _variables.end());
+ assert(_variables.find("fqn") != _variables.end());
+ assert(_variables.find("datadir") != _variables.end());
- _variables = variables;
+ //
+ // Required for the component builder.
+ //
+ _yellowAdmin = nodeInfo->getYellowAdmin();
}
void
@@ -168,3 +163,14 @@ IcePack::ServiceBuilder::setDBEnv(const string& dir)
_serverBuilder.addProperty("IceBox.DBEnvName." + _variables["name"], path);
}
+//
+// Compute an adapter id for a given adapter name.
+//
+string
+IcePack::ServiceBuilder::getDefaultAdapterId(const string& name)
+{
+ //
+ // Concatenate the server and service name to the adapter name.
+ //
+ return name + "-" + _variables["parent"] + "." + _variables["name"];
+}
diff --git a/cpp/src/IcePack/ServiceBuilder.h b/cpp/src/IcePack/ServiceBuilder.h
index 166ec0baca0..69ecc7ecd84 100644
--- a/cpp/src/IcePack/ServiceBuilder.h
+++ b/cpp/src/IcePack/ServiceBuilder.h
@@ -29,8 +29,9 @@ public:
ServiceKindFreeze
};
- ServiceBuilder(const NodeInfoPtr&, ServerBuilder&, const std::map<std::string, std::string>&,
- const std::string&, const std::vector<std::string>&);
+ ServiceBuilder(const NodeInfoPtr&, ServerBuilder&,
+ const std::map<std::string, std::string>&,
+ const std::vector<std::string>&);
void parse(const std::string&);
@@ -40,6 +41,8 @@ public:
void setEntryPoint(const std::string&);
void setDBEnv(const std::string&);
+ virtual std::string getDefaultAdapterId(const std::string&);
+
private:
NodeInfoPtr _nodeInfo;
diff --git a/cpp/test/IcePack/deployer/AllTests.cpp b/cpp/test/IcePack/deployer/AllTests.cpp
index 3960afe5fd9..6982ca8764f 100644
--- a/cpp/test/IcePack/deployer/AllTests.cpp
+++ b/cpp/test/IcePack/deployer/AllTests.cpp
@@ -47,11 +47,11 @@ allCommonTests(const Ice::CommunicatorPtr& communicator)
cout << "testing adapter registration... " << flush;
Ice::StringSeq adapterNames = admin->getAllAdapterNames();
- test(find(adapterNames.begin(), adapterNames.end(), "Server1Adapter") != adapterNames.end());
- test(find(adapterNames.begin(), adapterNames.end(), "Server2Adapter") != adapterNames.end());
- test(find(adapterNames.begin(), adapterNames.end(), "IceBox1Service1Adapter") != adapterNames.end());
+ test(find(adapterNames.begin(), adapterNames.end(), "Server-Server1") != adapterNames.end());
+ test(find(adapterNames.begin(), adapterNames.end(), "Server-Server2") != adapterNames.end());
+ test(find(adapterNames.begin(), adapterNames.end(), "Service1-IceBox1.Service1") != adapterNames.end());
test(find(adapterNames.begin(), adapterNames.end(), "IceBox1Service2Adapter") != adapterNames.end());
- test(find(adapterNames.begin(), adapterNames.end(), "IceBox2Service1Adapter") != adapterNames.end());
+ test(find(adapterNames.begin(), adapterNames.end(), "Service1-IceBox2.Service1") != adapterNames.end());
test(find(adapterNames.begin(), adapterNames.end(), "IceBox2Service2Adapter") != adapterNames.end());
cout << "ok" << endl;
@@ -63,10 +63,10 @@ allCommonTests(const Ice::CommunicatorPtr& communicator)
Ice::ObjectProxySeq offers = yellow->lookupAll("::Test");
test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"Server1")) != offers.end());
test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"Server2")) != offers.end());
- test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox1Service1")) != offers.end());
- test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox1Service2")) != offers.end());
- test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox2Service1")) != offers.end());
- test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox2Service2")) != offers.end());
+ test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox1-Service1")) != offers.end());
+ test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox1-Service2")) != offers.end());
+ test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox2-Service1")) != offers.end());
+ test(find_if(offers.begin(), offers.end(), bind2nd(ProxyIdentityEqual(),"IceBox2-Service2")) != offers.end());
cout << "ok" << endl;
}
@@ -88,35 +88,39 @@ allTests(const Ice::CommunicatorPtr& communicator)
TestPrx obj;
- obj = TestPrx::checkedCast(communicator->stringToProxy("Server1@Server1Adapter"));
- obj = TestPrx::checkedCast(communicator->stringToProxy("Server2@Server2Adapter"));
- obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1Service1@IceBox1Service1Adapter"));
- obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1Service2@IceBox1Service2Adapter"));
- obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox2Service1@IceBox2Service1Adapter"));
- obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox2Service2@IceBox2Service2Adapter"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("Server1@Server-Server1"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("Server2@Server-Server2"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1-Service1@Service1-IceBox1.Service1"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1-Service2@IceBox1Service2Adapter"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox2-Service1@Service1-IceBox2.Service1"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox2-Service2@IceBox2Service2Adapter"));
cout << "ok" << endl;
cout << "testing server configuration... " << flush;
- obj = TestPrx::checkedCast(communicator->stringToProxy("Server1@Server1Adapter"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("Server1@Server-Server1"));
test(obj->getProperty("Type") == "Server");
test(obj->getProperty("Name") == "Server1");
+ obj = TestPrx::checkedCast(communicator->stringToProxy("Server2@Server-Server2"));
+ test(obj->getProperty("Target1") == "1");
+ test(obj->getProperty("Target2") == "1");
+
cout << "ok" << endl;
cout << "testing service configuration... " << flush;
- obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1Service1@IceBox1Service1Adapter"));
- test(obj->getProperty("IceBox1Service1.Type") == "standard");
- test(obj->getProperty("IceBox1Service1.ServiceName") == "IceBox1Service1");
+ obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1-Service1@Service1-IceBox1.Service1"));
+ test(obj->getProperty("Service1.Type") == "standard");
+ test(obj->getProperty("Service1.ServiceName") == "Service1");
- obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox2Service2@IceBox2Service2Adapter"));
- test(obj->getProperty("IceBox2Service2.Type") == "freeze");
- test(obj->getProperty("IceBox2Service2.ServiceName") == "IceBox2Service2");
+ obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox2-Service2@IceBox2Service2Adapter"));
+ test(obj->getProperty("Service2.Type") == "freeze");
+ test(obj->getProperty("Service2.ServiceName") == "Service2");
- test(obj->getProperty("IceBox2Service2.DebugProperty") == "");
- test(obj->getProperty("IceBox1Service1.DebugProperty") == "");
+ test(obj->getProperty("Service2.DebugProperty") == "");
+ test(obj->getProperty("Service1.DebugProperty") == "");
cout << "ok" << endl;
}
@@ -138,7 +142,7 @@ allTestsWithTarget(const Ice::CommunicatorPtr& communicator)
TestPrx obj;
try
{
- obj = TestPrx::checkedCast(communicator->stringToProxy("Server1@Server1Adapter"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("Server1@Server-Server1"));
test(false);
}
catch(const Ice::LocalException&)
@@ -146,14 +150,14 @@ allTestsWithTarget(const Ice::CommunicatorPtr& communicator)
}
admin->startServer("Server1");
- obj = TestPrx::checkedCast(communicator->stringToProxy("Server2@Server2Adapter"));
+ obj = TestPrx::checkedCast(communicator->stringToProxy("Server2@Server-Server2"));
cout << "ok" << endl;
cout << "testing service configuration... " << flush;
- obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1Service1@IceBox1Service1Adapter"));
- test(obj->getProperty("IceBox1Service1.DebugProperty") == "debug");
+ obj = TestPrx::checkedCast(communicator->stringToProxy("IceBox1-Service1@Service1-IceBox1.Service1"));
+ test(obj->getProperty("Service1.DebugProperty") == "debug");
cout << "ok" << endl;
}
diff --git a/cpp/test/IcePack/deployer/Server.cpp b/cpp/test/IcePack/deployer/Server.cpp
index 8613974b79a..d6360d212fa 100644
--- a/cpp/test/IcePack/deployer/Server.cpp
+++ b/cpp/test/IcePack/deployer/Server.cpp
@@ -28,7 +28,7 @@ int
Ice::PropertiesPtr properties = communicator()->getProperties();
string name = properties->getProperty("Ice.ProgramName");
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter(name);
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Server");
Ice::ObjectPtr object = new TestI(adapter, properties);
adapter->add(object, Ice::stringToIdentity(name));
adapter->activate();
diff --git a/cpp/test/IcePack/deployer/Service.cpp b/cpp/test/IcePack/deployer/Service.cpp
index fd0d7b0fce6..bfc3871444c 100644
--- a/cpp/test/IcePack/deployer/Service.cpp
+++ b/cpp/test/IcePack/deployer/Service.cpp
@@ -84,9 +84,11 @@ ServiceI::start(const string& name,
const CommunicatorPtr& communicator,
const StringSeq& args)
{
+ Ice::PropertiesPtr properties = communicator->getProperties();
+
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name);
- Ice::ObjectPtr object = new TestI(adapter, communicator->getProperties());
- adapter->add(object, Ice::stringToIdentity(name));
+ Ice::ObjectPtr object = new TestI(adapter, properties);
+ adapter->add(object, Ice::stringToIdentity(properties->getProperty(name + ".Identity")));
adapter->activate();
}
@@ -114,9 +116,11 @@ FreezeServiceI::start(const string& name,
//
Freeze::DBPtr db = dbEnv->openDB("testdb", true);
+ Ice::PropertiesPtr properties = communicator->getProperties();
+
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name);
Ice::ObjectPtr object = new TestI(adapter, communicator->getProperties());
- adapter->add(object, Ice::stringToIdentity(name));
+ adapter->add(object, Ice::stringToIdentity(properties->getProperty(name + ".Identity")));
adapter->activate();
}
diff --git a/cpp/test/IcePack/deployer/application.xml b/cpp/test/IcePack/deployer/application.xml
index aab926b79f6..89fe1061479 100644
--- a/cpp/test/IcePack/deployer/application.xml
+++ b/cpp/test/IcePack/deployer/application.xml
@@ -6,7 +6,7 @@
<server name="IceBox1" descriptor="icebox.xml"/>
<server name="IceBox2" descriptor="icebox.xml"/>
<server name="Server1" binpath="./server" descriptor="server.xml"/>
- <server name="Server2" binpath="./server" descriptor="server.xml"/>
+ <server name="Server2" binpath="./server" descriptor="server.xml" targets="target1 target2"/>
</node>
diff --git a/cpp/test/IcePack/deployer/freezeservice.xml b/cpp/test/IcePack/deployer/freezeservice.xml
index e39427c1caa..52ceaba69b4 100644
--- a/cpp/test/IcePack/deployer/freezeservice.xml
+++ b/cpp/test/IcePack/deployer/freezeservice.xml
@@ -1,12 +1,15 @@
<service kind="freeze" entry="TestService:createFreezeService">
<adapters>
- <adapter name="${name}" endpoints="default" id="${name}Adapter">
- <offer interface="::Test" identity="${name}"/>
+ <adapter name="${name}" endpoints="default" id="${parent}${name}Adapter">
+ <!-- The identity needs to be unique, here we concatenate the
+ server name (${parent}) with the service name. -->
+ <offer interface="::Test" identity="${parent}-${name}"/>
</adapter>
</adapters>
<properties>
+ <property name="${name}.Identity" value="${parent}-${name}"/>
<property name="${name}.Type" value="freeze"/>
<property name="${name}.ServiceName" value="${name}"/>
</properties>
diff --git a/cpp/test/IcePack/deployer/icebox.xml b/cpp/test/IcePack/deployer/icebox.xml
index a1115a3a3ab..853e8f6511c 100644
--- a/cpp/test/IcePack/deployer/icebox.xml
+++ b/cpp/test/IcePack/deployer/icebox.xml
@@ -1,7 +1,7 @@
<server kind="cpp-icebox" endpoints="default">
- <service name="${name}Service1" descriptor="service.xml"/>
- <service name="${name}Service2" descriptor="freezeservice.xml"/>
+ <service name="Service1" descriptor="service.xml"/>
+ <service name="Service2" descriptor="freezeservice.xml"/>
<properties>
<property name="Ice.ConnectionWarnings" value="1"/>
diff --git a/cpp/test/IcePack/deployer/server.xml b/cpp/test/IcePack/deployer/server.xml
index 47528322380..84582a13363 100644
--- a/cpp/test/IcePack/deployer/server.xml
+++ b/cpp/test/IcePack/deployer/server.xml
@@ -6,7 +6,7 @@
</target>
<adapters>
- <adapter name="${name}" endpoints="default" id="${name}Adapter">
+ <adapter name="Server" endpoints="default">
<offer interface="::Test" identity="${name}"/>
</adapter>
</adapters>
@@ -17,6 +17,18 @@
<property name="Ice.ConnectionWarnings" value="1"/>
</properties>
+ <target name="target1">
+ <properties>
+ <property name="Target1" value="1"/>
+ </properties>
+ </target>
+
+ <target name="target2">
+ <properties>
+ <property name="Target2" value="1"/>
+ </properties>
+ </target>
+
<target name="ssl">
<properties>
<property name="Ice.Plugin.IceSSL" value="IceSSL:create"/>
diff --git a/cpp/test/IcePack/deployer/service.xml b/cpp/test/IcePack/deployer/service.xml
index 11ec815ae3a..0dc944b7a75 100644
--- a/cpp/test/IcePack/deployer/service.xml
+++ b/cpp/test/IcePack/deployer/service.xml
@@ -1,12 +1,15 @@
<service kind="standard" entry="TestService:create">
<adapters>
- <adapter name="${name}" endpoints="default" id="${name}Adapter">
- <offer interface="::Test" identity="${name}"/>
+ <adapter name="${name}" endpoints="default">
+ <!-- The identity needs to be unique, here we concatenate the
+ server name (${parent}) with the service name. -->
+ <offer interface="::Test" identity="${parent}-${name}"/>
</adapter>
</adapters>
<properties>
+ <property name="${name}.Identity" value="${parent}-${name}"/>
<property name="${name}.Type" value="standard"/>
<property name="${name}.ServiceName" value="${name}"/>
</properties>