summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-07-25 03:31:06 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-07-25 03:31:06 +0000
commit7b2b43a71525019de911b5a42024d07da89a0320 (patch)
treefb303946b16d6f6ddd9d199edf7a6ba5af66f675 /cpp
parentcommenbts (diff)
downloadice-7b2b43a71525019de911b5a42024d07da89a0320.tar.bz2
ice-7b2b43a71525019de911b5a42024d07da89a0320.tar.xz
ice-7b2b43a71525019de911b5a42024d07da89a0320.zip
Added targets and application descriptors.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/config/IcePackAdmin.py6
-rw-r--r--cpp/slice/IcePack/Admin.ice64
-rw-r--r--cpp/src/IcePack/ActivatorI.cpp15
-rw-r--r--cpp/src/IcePack/ActivatorI.h116
-rw-r--r--cpp/src/IcePack/AdminI.cpp23
-rw-r--r--cpp/src/IcePack/AdminI.h9
-rw-r--r--cpp/src/IcePack/ApplicationDeployer.cpp138
-rw-r--r--cpp/src/IcePack/ApplicationDeployer.h38
-rw-r--r--cpp/src/IcePack/ComponentDeployer.cpp130
-rw-r--r--cpp/src/IcePack/ComponentDeployer.h43
-rw-r--r--cpp/src/IcePack/Grammar.y64
-rw-r--r--cpp/src/IcePack/Makefile1
-rw-r--r--cpp/src/IcePack/Parser.cpp148
-rw-r--r--cpp/src/IcePack/Parser.h5
-rw-r--r--cpp/src/IcePack/Scanner.l20
-rw-r--r--cpp/src/IcePack/Server.cpp43
-rw-r--r--cpp/src/IcePack/ServerDeployer.cpp65
-rw-r--r--cpp/src/IcePack/ServerDeployer.h4
-rw-r--r--cpp/src/IcePack/ServiceDeployer.cpp25
-rw-r--r--cpp/src/IcePack/ServiceDeployer.h5
-rwxr-xr-xcpp/test/IcePack/simple/run.py2
-rw-r--r--cpp/test/IcePack/simple/simple_server.xml7
22 files changed, 696 insertions, 275 deletions
diff --git a/cpp/config/IcePackAdmin.py b/cpp/config/IcePackAdmin.py
index 3bf2c475c4c..7af77185381 100644
--- a/cpp/config/IcePackAdmin.py
+++ b/cpp/config/IcePackAdmin.py
@@ -59,7 +59,7 @@ def shutdownIcePack(toplevel, icePackPipe):
sys.exit(1)
-def addServer(toplevel, name, server, libpath, serverDescriptor):
+def addServer(toplevel, name, serverDescriptor, server, libpath, targets):
global icePackPort
icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin")
@@ -68,8 +68,8 @@ def addServer(toplevel, name, server, libpath, serverDescriptor):
command = icePackAdmin + options + \
r' "--Ice.Default.Locator=IcePack/locator:default -p ' + icePackPort + '" ' + \
- r' -e "server add \"' + name + '\\" \\"' + server + '\\" ' + \
- r' \"' + libpath + '\\" ' + serverDescriptor + '\"'
+ r' -e "server add \"' + name + '\\" \\"' + serverDescriptor + '\\" ' + \
+ r' \"' + server + '\\" \\"' + libpath + '\\" ' + targets + '\"'
icePackAdminPipe = os.popen(command)
icePackAdminStatus = icePackAdminPipe.close()
diff --git a/cpp/slice/IcePack/Admin.ice b/cpp/slice/IcePack/Admin.ice
index 7047e4c2e59..c92f273869e 100644
--- a/cpp/slice/IcePack/Admin.ice
+++ b/cpp/slice/IcePack/Admin.ice
@@ -110,6 +110,12 @@ exception ServerDeploymentException extends DeploymentException
**/
sequence<string> Args;
+/**
+ *
+ * A vector of strings representing targets.
+ *
+ **/
+sequence<string> Targets;
/**
*
@@ -136,13 +142,20 @@ struct ServerDescription
/**
*
- * Descriptor file.
+ * Deployment descriptor.
*
**/
string descriptor;
/**
*
+ * Targets used to deployed the server.
+ *
+ **/
+ Targets targets;
+
+ /**
+ *
* The optional server adapter names. If a client makes a request
* to locate an adapter from the server, the server will be
* automatically started if it's not already active. If empty, no
@@ -215,8 +228,40 @@ class Admin
{
/**
*
- * Add a server and the adapters implemented by that server to
- * &IcePack;.
+ * Add an application to &IcePack;. An application is a set of
+ * servers.
+ *
+ * @param descriptor The application descriptor.
+ *
+ * @param tgts The optional targets to deploy. A target is a list
+ * of components separated by dots and a target name. For example,
+ * the "debug" target of the "service1" in the "server1" will be
+ * deployed if the target "server1.service1.debug" is specified.
+ *
+ * @throws DeploymentException Raised if the deployment of the
+ * application failed.
+ *
+ * @see removeApplication
+ *
+ **/
+ void addApplication(string descriptor, Targets tgts)
+ throws DeploymentException;
+
+ /**
+ *
+ * Remove an application from &IcePack;.
+ *
+ * @param descriptor The application descriptor.
+ *
+ * @see addApplication
+ *
+ **/
+ void removeApplication(string descriptor)
+ throws DeploymentException;
+
+ /**
+ *
+ * Add a server to &IcePack;.
*
* @param name The server name.
*
@@ -230,7 +275,12 @@ class Admin
* @param librarypath Specify the LD_LIBRARY_PATH value for C++
* servers or the CLASSPATH value for Java servers.
*
- * @param name The server deployment descriptor.
+ * @param desciptor The server deployment descriptor.
+ *
+ * @param tgts The optional targets to deploy. A target is a list
+ * of components separated by dots and a target name. For example,
+ * the "debug" target of the "service1" in the "server1" will be
+ * deployed if the target "server1.service1.debug" is specified.
*
* @throws ServerExistsException Raised if a server with the same
* name already exists.
@@ -241,8 +291,8 @@ class Admin
* @see removeServer
*
**/
- void addServer(string name, string path, string libraryPath, string descriptor)
- throws ServerExistsException, DeploymentException;
+ void addServer(string name, string path, string libraryPath, string descriptor, Targets tgts)
+ throws DeploymentException;
/**
*
@@ -315,7 +365,7 @@ class Admin
*
**/
void removeServer(string name)
- throws ServerNotExistException, ServerNotInactiveException;
+ throws DeploymentException, ServerNotExistException, ServerNotInactiveException;
/**
*
diff --git a/cpp/src/IcePack/ActivatorI.cpp b/cpp/src/IcePack/ActivatorI.cpp
index f8e7a7f66b2..e5ac96187a4 100644
--- a/cpp/src/IcePack/ActivatorI.cpp
+++ b/cpp/src/IcePack/ActivatorI.cpp
@@ -153,16 +153,15 @@ IcePack::ActivatorI::activate(const ServerPrx& server, const ::Ice::Current&)
// pipe.
//
// TODO: This doesn't work well if the server doesn't control
- // when and how the output is flushed. This can result for
- // example in printing on character by line... The standard
- // Ice logger could be changed to flush the stream and not use
- // automatic flushing.
+ // when and how the output is flushed. For example, we could
+ // receive one character after the other over the pipe which
+ // is problematic since we don't know when to log message. For
+ // sure we don't want to log each character one after the
+ // other. We want to log the message. One solution would be to
+ // put the received information in a buffer and log it only
+ // when we receive a '\n'.
//
-// TODO: ML: Can you be more specific? Sending messages through a pipe
-// is one of the most basic unix mechanisms. I don't see how this
-// could not work.
-
// if(fds[1] != STDERR_FILENO)
// {
// if(dup2(fds[1], STDERR_FILENO) != STDERR_FILENO)
diff --git a/cpp/src/IcePack/ActivatorI.h b/cpp/src/IcePack/ActivatorI.h
index ad95a039afc..714a838c159 100644
--- a/cpp/src/IcePack/ActivatorI.h
+++ b/cpp/src/IcePack/ActivatorI.h
@@ -1,59 +1,57 @@
-// **********************************************************************
-//
-// Copyright (c) 2001
-// Mutable Realms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_PACK_ACTIVATOR_H
-#define ICE_PACK_ACTIVATOR_H
-
-#include <IceUtil/Thread.h>
-#include <IcePack/Activator.h>
-#include <IcePack/ServerManagerF.h>
-
-// TODO: ML: This file has DOS line endings. Change to Unix line endings.
-
-namespace IcePack
-{
-
-class ActivatorI : public Activator, public IceUtil::Thread, public IceUtil::Mutex
-{
-public:
-
- ActivatorI(const Ice::CommunicatorPtr&);
- virtual ~ActivatorI();
-
- virtual void run();
- void destroy();
-
- virtual bool activate(const ::IcePack::ServerPrx&, const ::Ice::Current&);
-
-private:
-
- void terminationListener();
- void clearInterrupt();
- void setInterrupt();
-
- struct Process
- {
- pid_t pid;
- int fd;
- ServerPrx server;
- };
-
- Ice::CommunicatorPtr _communicator;
- std::vector<Process> _processes;
- bool _destroy;
- int _fdIntrRead;
- int _fdIntrWrite;
-};
-
-typedef IceUtil::Handle<ActivatorI> ActivatorIPtr;
-
-}
-
-#endif
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PACK_ACTIVATOR_H
+#define ICE_PACK_ACTIVATOR_H
+
+#include <IceUtil/Thread.h>
+#include <IcePack/Activator.h>
+#include <IcePack/ServerManagerF.h>
+
+namespace IcePack
+{
+
+class ActivatorI : public Activator, public IceUtil::Thread, public IceUtil::Mutex
+{
+public:
+
+ ActivatorI(const Ice::CommunicatorPtr&);
+ virtual ~ActivatorI();
+
+ virtual void run();
+ void destroy();
+
+ virtual bool activate(const ::IcePack::ServerPrx&, const ::Ice::Current&);
+
+private:
+
+ void terminationListener();
+ void clearInterrupt();
+ void setInterrupt();
+
+ struct Process
+ {
+ pid_t pid;
+ int fd;
+ ServerPrx server;
+ };
+
+ Ice::CommunicatorPtr _communicator;
+ std::vector<Process> _processes;
+ bool _destroy;
+ int _fdIntrRead;
+ int _fdIntrWrite;
+};
+
+typedef IceUtil::Handle<ActivatorI> ActivatorIPtr;
+
+}
+
+#endif
diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp
index 4b385cdc421..e7fcfb766a2 100644
--- a/cpp/src/IcePack/AdminI.cpp
+++ b/cpp/src/IcePack/AdminI.cpp
@@ -12,6 +12,7 @@
#include <IcePack/AdminI.h>
#include <IcePack/ServerManager.h>
#include <IcePack/AdapterManager.h>
+#include <IcePack/ApplicationDeployer.h>
#include <IcePack/ServerDeployer.h>
using namespace std;
@@ -27,10 +28,26 @@ IcePack::AdminI::AdminI(const CommunicatorPtr& communicator, const ServerManager
}
void
+IcePack::AdminI::addApplication(const string& descriptor, const Targets& targets, const Current&)
+{
+ ApplicationDeployer deployer(_communicator, this, targets);
+ deployer.parse(descriptor);
+ deployer.deploy();
+}
+
+void
+IcePack::AdminI::removeApplication(const string& descriptor, const Current&)
+{
+ ApplicationDeployer deployer(_communicator, this, Targets());
+ deployer.parse(descriptor);
+ deployer.deploy();
+}
+
+void
IcePack::AdminI::addServer(const string& name, const string& path, const string& ldpath, const string& descriptor,
- const Current&)
+ const Targets& targets, const Current&)
{
- ServerDeployer deployer(_communicator, name, path, ldpath);
+ ServerDeployer deployer(_communicator, name, path, ldpath, targets);
deployer.setServerManager(_serverManager);
deployer.setAdapterManager(_adapterManager);
deployer.parse(descriptor);
@@ -100,7 +117,7 @@ IcePack::AdminI::removeServer(const string& name, const Current&)
server->setState(Destroyed);
ServerDescription desc = server->getServerDescription();
- ServerDeployer deployer(_communicator, desc.name, desc.path, "");
+ ServerDeployer deployer(_communicator, desc.name, desc.path, "", desc.targets);
deployer.setServerManager(_serverManager);
deployer.setAdapterManager(_adapterManager);
deployer.parse(desc.descriptor);
diff --git a/cpp/src/IcePack/AdminI.h b/cpp/src/IcePack/AdminI.h
index 972be3afde4..6f87609f0ca 100644
--- a/cpp/src/IcePack/AdminI.h
+++ b/cpp/src/IcePack/AdminI.h
@@ -24,10 +24,13 @@ public:
AdminI(const Ice::CommunicatorPtr&, const ServerManagerPrx&, const AdapterManagerPrx&);
- virtual void addServer(const std::string&, const std::string&, const std::string&, const std::string&,
- const Ice::Current&);
+ virtual void addApplication(const std::string&, const Targets&, const Ice::Current& = Ice::Current());
+ virtual void removeApplication(const std::string&, const Ice::Current& = Ice::Current());
+
+ virtual void addServer(const std::string&, const std::string&, const std::string&, const std::string&,
+ const Targets&, const Ice::Current& = Ice::Current());
virtual ServerDescription getServerDescription(const ::std::string&, const Ice::Current&);
- virtual ServerState getServerState(const ::std::string&, const Ice::Current&);
+ virtual ServerState getServerState(const ::std::string&, const Ice::Current& = Ice::Current());
virtual bool startServer(const ::std::string&, const Ice::Current&);
virtual void removeServer(const ::std::string&, const Ice::Current&);
virtual ServerNames getAllServerNames(const Ice::Current&);
diff --git a/cpp/src/IcePack/ApplicationDeployer.cpp b/cpp/src/IcePack/ApplicationDeployer.cpp
new file mode 100644
index 00000000000..2c39e943fc3
--- /dev/null
+++ b/cpp/src/IcePack/ApplicationDeployer.cpp
@@ -0,0 +1,138 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <IcePack/ApplicationDeployer.h>
+#include <IcePack/ServerDeployer.h>
+
+using namespace std;
+using namespace IcePack;
+
+namespace IcePack
+{
+
+class AddServer : public Task
+{
+public:
+
+ AddServer(const AdminPtr& admin, const string& name, const string& descriptor, const string& binpath,
+ const string& libpath, const Targets& targets) :
+ _admin(admin),
+ _name(name),
+ _descriptor(descriptor),
+ _binpath(binpath),
+ _libpath(libpath),
+ _targets(targets)
+ {
+ }
+
+ virtual void
+ deploy()
+ {
+ _admin->addServer(_name, _binpath, _libpath, _descriptor, _targets);
+ }
+
+ virtual void
+ undeploy()
+ {
+ try
+ {
+ _admin->removeServer(_name);
+ }
+ catch(const ServerNotExistException&)
+ {
+ }
+ }
+
+private:
+
+ AdminPtr _admin;
+ string _name;
+ string _descriptor;
+ string _binpath;
+ string _libpath;
+ Targets _targets;
+};
+
+class ApplicationDeployHandler : public ComponentDeployHandler
+{
+public:
+
+ ApplicationDeployHandler(ApplicationDeployer&);
+
+ virtual void startElement(const XMLCh *const name, AttributeList &attrs);
+
+private:
+
+ ApplicationDeployer& _deployer;
+};
+
+}
+
+IcePack::ApplicationDeployHandler::ApplicationDeployHandler(ApplicationDeployer& deployer) :
+ ComponentDeployHandler(deployer),
+ _deployer(deployer)
+{
+}
+
+void
+IcePack::ApplicationDeployHandler::startElement(const XMLCh *const name, AttributeList &attrs)
+{
+ ComponentDeployHandler::startElement(name, attrs);
+ if(!isCurrentTargetDeployable())
+ {
+ return;
+ }
+
+ string str = toString(name);
+ if(str == "server")
+ {
+ string name = getAttributeValue(attrs, "name");
+ string descriptor = getAttributeValue(attrs, "descriptor");
+ string binpath = getAttributeValueWithDefault(attrs, "binpath", "");
+ string libpath = getAttributeValueWithDefault(attrs, "libpath", "");
+ _deployer.addServer(name, descriptor, binpath, libpath);
+ }
+}
+
+IcePack::ApplicationDeployer::ApplicationDeployer(const Ice::CommunicatorPtr& communicator,
+ const AdminPtr& admin,
+ const vector<string>& targets) :
+ ComponentDeployer(communicator, "", targets),
+ _admin(admin)
+{
+}
+
+void
+IcePack::ApplicationDeployer::parse(const string& descriptor)
+{
+ ApplicationDeployHandler handler(*this);
+
+ ComponentDeployer::parse(descriptor, handler);
+}
+
+void
+IcePack::ApplicationDeployer::addServer(const string& name,
+ const string& descriptor,
+ const string& binpath,
+ const string& libpath)
+{
+ if(name.empty())
+ {
+ throw DeploySAXParseException("name attribute value is empty", _locator);
+ }
+ if(descriptor.empty())
+ {
+ throw DeploySAXParseException("descriptor attribute value is empty", _locator);
+ }
+
+ _tasks.push_back(new AddServer(_admin, name, descriptor, binpath, libpath, _targets));
+}
+
diff --git a/cpp/src/IcePack/ApplicationDeployer.h b/cpp/src/IcePack/ApplicationDeployer.h
new file mode 100644
index 00000000000..7f71f7ada5c
--- /dev/null
+++ b/cpp/src/IcePack/ApplicationDeployer.h
@@ -0,0 +1,38 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// Mutable Realms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef ICE_PACK_SERVICE_DEPLOYER_H
+#define ICE_PACK_SERVICE_DEPLOYER_H
+
+#include <IceUtil/Shared.h>
+#include <IcePack/ComponentDeployer.h>
+
+namespace IcePack
+{
+
+class ApplicationDeployer : public ComponentDeployer
+{
+public:
+
+ ApplicationDeployer(const Ice::CommunicatorPtr&, const AdminPtr&, const std::vector<std::string>&);
+
+ void parse(const std::string&);
+
+ void addServer(const std::string&, const std::string&, const std::string&, const std::string&);
+
+private:
+
+ AdminPtr _admin;
+
+};
+
+}
+
+#endif
diff --git a/cpp/src/IcePack/ComponentDeployer.cpp b/cpp/src/IcePack/ComponentDeployer.cpp
index d5973d57fde..089efa2b1ce 100644
--- a/cpp/src/IcePack/ComponentDeployer.cpp
+++ b/cpp/src/IcePack/ComponentDeployer.cpp
@@ -31,9 +31,6 @@
using namespace std;
using namespace IcePack;
-void IcePack::incRef(Task* p) { p->__incRef(); }
-void IcePack::decRef(Task* p) { p->__decRef(); }
-
namespace IcePack
{
@@ -296,15 +293,17 @@ IcePack::ComponentErrorHandler::warning(const SAXParseException& exception)
void
IcePack::ComponentErrorHandler::error(const SAXParseException& exception)
{
- string s = toString(exception.getMessage());
- cerr << "error: " << s << endl;
+ throw exception;
+// string s = toString(exception.getMessage());
+// cerr << "error: " << s << endl;
}
void
IcePack::ComponentErrorHandler::fatalError(const SAXParseException& exception)
{
- string s = toString(exception.getMessage());
- cerr << "fatal:" << s << endl;
+ throw exception;
+// string s = toString(exception.getMessage());
+// cerr << "fatal:" << s << endl;
}
void
@@ -313,7 +312,8 @@ IcePack::ComponentErrorHandler::resetErrors()
}
IcePack::ComponentDeployHandler::ComponentDeployHandler(ComponentDeployer& deployer) :
- _deployer(deployer)
+ _deployer(deployer),
+ _isCurrentTargetDeployable(true)
{
}
@@ -328,6 +328,11 @@ IcePack::ComponentDeployHandler::startElement(const XMLCh *const name, Attribute
{
_elements.push("");
+ if(!isCurrentTargetDeployable())
+ {
+ return;
+ }
+
string str = toString(name);
if(str == "property")
@@ -345,11 +350,24 @@ IcePack::ComponentDeployHandler::startElement(const XMLCh *const name, Attribute
}
else if(str == "adapter")
{
- _adapter = getAttributeValue(attrs, "name");
+ if(!_currentAdapter.empty())
+ {
+ throw DeploySAXParseException("Adapter element enclosed in an adapter element is not allowed", _locator);
+ }
+ _currentAdapter = getAttributeValue(attrs, "name");
}
else if(str == "offer")
{
- _deployer.addOffer(getAttributeValue(attrs, "interface"), _adapter, getAttributeValue(attrs, "identity"));
+ _deployer.addOffer(getAttributeValue(attrs, "interface"), _currentAdapter,
+ getAttributeValue(attrs, "identity"));
+ }
+ else if(str == "target")
+ {
+ if(!_currentTarget.empty())
+ {
+ throw DeploySAXParseException("Target element enclosed in a target element is not allowed", _locator);
+ }
+ _isCurrentTargetDeployable = _deployer.isTargetDeployable(getAttributeValue(attrs, "name"));
}
}
@@ -360,9 +378,17 @@ IcePack::ComponentDeployHandler::endElement(const XMLCh *const name)
string str = toString(name);
- if(str == "adapter")
+ if(str == "target")
+ {
+ _isCurrentTargetDeployable = true;
+ }
+
+ if(isCurrentTargetDeployable())
{
- _adapter = "";
+ if(str == "adapter")
+ {
+ _currentAdapter = "";
+ }
}
}
@@ -419,9 +445,19 @@ IcePack::ComponentDeployHandler::elementValue() const
return _elements.top();
}
-IcePack::ComponentDeployer::ComponentDeployer(const Ice::CommunicatorPtr& communicator) :
+bool
+IcePack::ComponentDeployHandler::isCurrentTargetDeployable() const
+{
+ return _isCurrentTargetDeployable;
+}
+
+IcePack::ComponentDeployer::ComponentDeployer(const Ice::CommunicatorPtr& communicator,
+ const string& componentPath,
+ const vector<string>& targets) :
_communicator(communicator),
- _properties(Ice::createProperties())
+ _properties(Ice::createProperties()),
+ _componentPath(componentPath),
+ _targets(targets)
{
string serversPath = _communicator->getProperties()->getProperty("IcePack.Data");
assert(!serversPath.empty());
@@ -485,7 +521,7 @@ IcePack::ComponentDeployer::parse(const string& xmlFile, ComponentDeployHandler&
os << xmlFile << ":" << e.getLineNumber() << ": " << toString(e.getMessage());
ParserDeploymentException ex;
- ex.component = _variables["name"];
+ ex.component = _componentPath;
ex.reason = os.str();
throw ex;
}
@@ -497,7 +533,7 @@ IcePack::ComponentDeployer::parse(const string& xmlFile, ComponentDeployHandler&
os << xmlFile << ": SAXException: " << toString(e.getMessage());
ParserDeploymentException ex;
- ex.component = _variables["name"];
+ ex.component = _componentPath;
ex.reason = os.str();
throw ex;
}
@@ -509,7 +545,7 @@ IcePack::ComponentDeployer::parse(const string& xmlFile, ComponentDeployHandler&
os << xmlFile << ": XMLException: " << toString(e.getMessage());
ParserDeploymentException ex;
- ex.component = _variables["name"];
+ ex.component = _componentPath;
ex.reason = os.str();
throw ex;
}
@@ -518,13 +554,10 @@ IcePack::ComponentDeployer::parse(const string& xmlFile, ComponentDeployHandler&
delete parser;
ostringstream os;
- // TODO: ML: UnknownException? This it not UnknownException,
- // that's an unknown exception. UnknownException is an Ice
- // exception.
- os << xmlFile << ": UnknownException while parsing file";
+ os << xmlFile << ": unknown exception while parsing file";
ParserDeploymentException ex;
- ex.component = _variables["name"];
+ ex.component = _componentPath;
ex.reason = os.str();
throw ex;
}
@@ -535,19 +568,59 @@ IcePack::ComponentDeployer::parse(const string& xmlFile, ComponentDeployHandler&
if(rc > 0)
{
ParserDeploymentException ex;
- ex.component = _variables["name"];
+ ex.component = _componentPath;
ex.reason = xmlFile + ": parse error";
throw ex;
- }
+ }
}
-// TODO: ML: Add space, loose last const.
void
-IcePack::ComponentDeployer::setDocumentLocator(const Locator*const locator)
+IcePack::ComponentDeployer::setDocumentLocator(const Locator* locator)
{
_locator = locator;
}
+bool
+IcePack::ComponentDeployer::isTargetDeployable(const string& target) const
+{
+ for(vector<string>::const_iterator p = _targets.begin(); p != _targets.end(); ++p)
+ {
+ if((*p) == target)
+ {
+ return true;
+ }
+ else
+ {
+ string componentTarget;
+ string::size_type end = 0;
+ while(end != string::npos)
+ {
+ //
+ // Add the first component name to the component target
+ // path.
+ //
+ end = _componentPath.find('.', end);
+ if(end == string::npos)
+ {
+ componentTarget = _componentPath + "." + target;
+ }
+ else
+ {
+ componentTarget = _componentPath.substr(0, end) + "." + target;
+ ++end;
+ }
+
+ if((*p) == componentTarget)
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
void
IcePack::ComponentDeployer::deploy()
{
@@ -560,7 +633,10 @@ IcePack::ComponentDeployer::deploy()
}
catch(DeploymentException& ex)
{
- ex.component = _variables["name"];
+ if(ex.component.empty())
+ {
+ ex.component = _componentPath;
+ }
undeployFrom(p);
throw;
}
diff --git a/cpp/src/IcePack/ComponentDeployer.h b/cpp/src/IcePack/ComponentDeployer.h
index 1e3b1f06eaa..f42c24f2088 100644
--- a/cpp/src/IcePack/ComponentDeployer.h
+++ b/cpp/src/IcePack/ComponentDeployer.h
@@ -31,13 +31,7 @@ public:
virtual void undeploy() = 0;
};
-// TODO: ML: Nonportable. The incRef/decRef declarations must be done
-// before the typedef below. Why not just use IceUtil::Handle in this
-// case?
-typedef ::IceInternal::Handle< ::IcePack::Task> TaskPtr;
-
-void incRef(::IcePack::Task*);
-void decRef(::IcePack::Task*);
+typedef ::IceUtil::Handle< ::IcePack::Task> TaskPtr;
class ComponentDeployer;
@@ -45,10 +39,7 @@ class DeploySAXParseException : public SAXParseException
{
public:
- // TODO: ML: Space is missing: "const Locator* const
- // locator". Also, why not just const Locator*? What's the point
- // of making the pointer constant as well?
- DeploySAXParseException(const std::string&, const Locator*const locator);
+ DeploySAXParseException(const std::string&, const Locator* locator);
};
@@ -89,18 +80,13 @@ public:
ComponentDeployHandler(ComponentDeployer&);
- // TODO: ML: Incorrect spacing, should be "const XMLCh*
- // const". Also, loose the last const -- there is no point in
- // forcing the pointer itself to be const. (Here and everywhere
- // else.)
- virtual void characters(const XMLCh *const, const unsigned int);
- // TODO: ML: AttributeList&.
- virtual void startElement(const XMLCh *const, AttributeList &);
- virtual void endElement(const XMLCh *const);
+ virtual void characters(const XMLCh*const, const unsigned int);
+ virtual void startElement(const XMLCh*const, AttributeList&);
+ virtual void endElement(const XMLCh*const);
// TODO: ML: No reason to make inline, see style guide.
- virtual void ignorableWhitespace(const XMLCh *const, const unsigned int) { }
- virtual void processingInstruction(const XMLCh *const, const XMLCh *const) { }
+ virtual void ignorableWhitespace(const XMLCh*const, const unsigned int) { }
+ virtual void processingInstruction(const XMLCh*const, const XMLCh*const) { }
virtual void resetDocument() { }
virtual void setDocumentLocator(const Locator *const);
virtual void startDocument() { }
@@ -111,23 +97,26 @@ protected:
std::string getAttributeValue(const AttributeList&, const std::string&) const;
std::string getAttributeValueWithDefault(const AttributeList&, const std::string&, const std::string&) const;
- std::string toString(const XMLCh *const) const;
+ std::string toString(const XMLCh*const) const;
std::string elementValue() const;
+ bool isCurrentTargetDeployable() const;
private:
+ ComponentDeployer& _deployer;
std::stack<std::string> _elements;
- std::string _adapter;
+ std::string _currentAdapter;
+ std::string _currentTarget;
+ bool _isCurrentTargetDeployable;
const Locator* _locator;
- ComponentDeployer& _deployer;
};
class ComponentDeployer : public Task
{
public:
- ComponentDeployer(const Ice::CommunicatorPtr&);
+ ComponentDeployer(const Ice::CommunicatorPtr&, const std::string&, const std::vector<std::string>&);
virtual void deploy();
virtual void undeploy();
@@ -136,6 +125,8 @@ public:
void setDocumentLocator(const Locator*const locator);
std::string substitute(const std::string&) const;
+ bool isTargetDeployable(const std::string&) const;
+
void createDirectory(const std::string&, bool = false);
void createConfigFile(const std::string&);
void addProperty(const std::string&, const std::string&);
@@ -153,6 +144,8 @@ 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/Grammar.y b/cpp/src/IcePack/Grammar.y
index 81d7073052e..af5ff4b45aa 100644
--- a/cpp/src/IcePack/Grammar.y
+++ b/cpp/src/IcePack/Grammar.y
@@ -35,6 +35,7 @@ yyerror(const char* s)
%token ICE_PACK_HELP
%token ICE_PACK_EXIT
+%token ICE_PACK_APPLICATION
%token ICE_PACK_SERVER
%token ICE_PACK_ADAPTER
%token ICE_PACK_ADD
@@ -46,10 +47,6 @@ yyerror(const char* s)
%token ICE_PACK_DESCRIBE
%token ICE_PACK_STATE
%token ICE_PACK_ENDPOINTS
-%token ICE_PACK_ADAPTERS
-%token ICE_PACK_OPTIONS
-%token ICE_PACK_OPEN_BRACKET
-%token ICE_PACK_CLOSE_BRACKET
%%
@@ -86,8 +83,17 @@ command
{
return 0;
}
-| ICE_PACK_SERVER ICE_PACK_ADD server_add_options ';'
+| ICE_PACK_APPLICATION ICE_PACK_ADD strings ';'
{
+ parser->addApplication($3);
+}
+| ICE_PACK_APPLICATION ICE_PACK_REMOVE strings ';'
+{
+ parser->removeApplication($3);
+}
+| ICE_PACK_SERVER ICE_PACK_ADD strings ';'
+{
+ parser->addServer($3);
}
| ICE_PACK_SERVER ICE_PACK_START strings ';'
{
@@ -139,54 +145,6 @@ command
;
// ----------------------------------------------------------------------
-server_add_options
-// ----------------------------------------------------------------------
-: strings adapters options
-{
- parser->addServer($1, $2, $3);
-}
-| strings options adapters
-{
- parser->addServer($1, $3, $2);
-}
-| strings adapters
-{
- parser->addServer($1, $2, list<string>());
-}
-| strings options
-{
- parser->addServer($1, list<string>(), $2);
-}
-| strings
-{
- parser->addServer($1, list<string>(), list<string>());
-};
-
-// ----------------------------------------------------------------------
-adapters
-// ----------------------------------------------------------------------
-: ICE_PACK_ADAPTERS ICE_PACK_OPEN_BRACKET strings ICE_PACK_CLOSE_BRACKET
-{
- $$ = $3;
-}
-| ICE_PACK_ADAPTERS ICE_PACK_OPEN_BRACKET ICE_PACK_CLOSE_BRACKET
-{
- $$ = list<string>();
-};
-
-// ----------------------------------------------------------------------
-options
-// ----------------------------------------------------------------------
-: ICE_PACK_OPTIONS ICE_PACK_OPEN_BRACKET strings ICE_PACK_CLOSE_BRACKET
-{
- $$ = $3;
-}
-| ICE_PACK_OPTIONS ICE_PACK_OPEN_BRACKET ICE_PACK_CLOSE_BRACKET
-{
- $$ = list<string>();
-};
-
-// ----------------------------------------------------------------------
strings
// ----------------------------------------------------------------------
: ICE_PACK_STRING strings
diff --git a/cpp/src/IcePack/Makefile b/cpp/src/IcePack/Makefile
index 2c56ed01f09..8dc42d2c99a 100644
--- a/cpp/src/IcePack/Makefile
+++ b/cpp/src/IcePack/Makefile
@@ -37,6 +37,7 @@ SOBJS = Server.o \
ComponentDeployer.o \
ServerDeployer.o \
ServiceDeployer.o \
+ ApplicationDeployer.o \
LocatorI.o \
LocatorRegistryI.o \
AdminI.o \
diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp
index c709b0abaaa..8dc089f2d8e 100644
--- a/cpp/src/IcePack/Parser.cpp
+++ b/cpp/src/IcePack/Parser.cpp
@@ -41,28 +41,77 @@ void
IcePack::Parser::usage()
{
cout <<
- "help Print this message.\n"
- "exit, quit Exit this program.\n"
- "server add NAME PATH LIBPATH DESC Add server NAME with PATH.\n" // TODO: ML: What about LIBPATH, DESC?
- "server describe NAME Get server NAME description.\n"
- "server state NAME Get server NAME state.\n"
- "server start NAME Starts server NAME.\n"
- "server remove NAME Remove server NAME.\n"
- "server list List all server names.\n"
- "adapter add NAME ENDPOINTS Add adapter NAME with ENDPOINTS.\n"
- "adapter list List all adapter names.\n"
- "adapter remove NAME Remove adapter NAME.\n"
- "adapter endpoints NAME Get adapter NAME endpoints.\n"
- "shutdown Shut the IcePack server down.\n";
+ "help Print this message.\n"
+ "exit, quit Exit this program.\n"
+ "application add DESC [TARGET1 [TARGET2 ...]]\n"
+ " Add application described by DESC with\n"
+ " optional targets to deploy.\n"
+ "application remove DESC Remove application described by DESC\n"
+ "server add NAME DESC [PATH [LIBPATH [TARGET1 [TARGET2 ...]]]]\n"
+ " Add server NAME with deployment descriptor\n"
+ " DESC, optional PATH and LIBPATH. If specified\n"
+ " the optional targets TARGET will be deployed.\n"
+ "server describe NAME Get server NAME description.\n"
+ "server state NAME Get server NAME state.\n"
+ "server start NAME Starts server NAME.\n"
+ "server remove NAME Remove server NAME.\n"
+ "server list List all server names.\n"
+ "adapter add NAME ENDPOINTS Add adapter NAME with ENDPOINTS.\n"
+ "adapter list List all adapter names.\n"
+ "adapter remove NAME Remove adapter NAME.\n"
+ "adapter endpoints NAME Get adapter NAME endpoints.\n"
+ "shutdown Shut the IcePack server down.\n";
}
void
-IcePack::Parser::addServer(const list<string>& args, const std::list<std::string>& adapters,
- const std::list<std::string>& options)
+IcePack::Parser::addApplication(const list<string>& args)
{
- if(args.size() != 4)
+ if(args.size() < 1)
{
- error("`server add' requires four arguments\n(`help' for more info)");
+ error("`application add' requires at least one argument\n(`help' for more info)");
+ return;
+ }
+
+ try
+ {
+ list<string>::const_iterator p = args.begin();
+
+ string descriptor = *p++;
+
+ Targets targets;
+ for(; p != args.end(); ++p)
+ {
+ targets.push_back(*p);
+ }
+
+ _admin->addApplication(descriptor, targets);
+ }
+ catch(const ServerDeploymentException& ex)
+ {
+ ostringstream s;
+ s << ex << ": " << ex.server << ": " << ex.reason;
+ error(s.str());
+ }
+ catch(const DeploymentException& ex)
+ {
+ ostringstream s;
+ s << ex << ": " << ex.component << ": " << ex.reason;
+ error(s.str());
+ }
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+IcePack::Parser::removeApplication(const list<string>& args)
+{
+ if(args.size() < 1)
+ {
+ error("`application remove' requires at exactly one argument\n(`help' for more info)");
return;
}
@@ -70,19 +119,58 @@ IcePack::Parser::addServer(const list<string>& args, const std::list<std::string
{
list<string>::const_iterator p = args.begin();
- string name = *p++;
- string path = *p++;
- string ldpath = *p++;
string descriptor = *p++;
- _admin->addServer(name, path, ldpath, descriptor);
+ _admin->removeApplication(descriptor);
}
- catch(const ParserDeploymentException& ex)
+ catch(const DeploymentException& ex)
{
ostringstream s;
s << ex << ": " << ex.component << ": " << ex.reason;
error(s.str());
}
+ catch(const Exception& ex)
+ {
+ ostringstream s;
+ s << ex;
+ error(s.str());
+ }
+}
+
+void
+IcePack::Parser::addServer(const list<string>& args)
+{
+ if(args.size() < 2)
+ {
+ error("`server add' requires at least two arguments\n(`help' for more info)");
+ return;
+ }
+
+ try
+ {
+ list<string>::const_iterator p = args.begin();
+ string name = *p++;
+ string descriptor = *p++;
+ string path;
+ string ldpath;
+ Targets targets;
+
+ if(p != args.end())
+ {
+ path = *p++;
+ }
+ if(p != args.end())
+ {
+ ldpath = *p++;
+ }
+
+ for(; p != args.end(); ++p)
+ {
+ targets.push_back(*p);
+ }
+
+ _admin->addServer(name, path, ldpath, descriptor, targets);
+ }
catch(const DeploymentException& ex)
{
ostringstream s;
@@ -110,10 +198,7 @@ IcePack::Parser::startServer(const list<string>& args)
{
if(!_admin->startServer(args.front()))
{
- // TODO: ML: That's not in our style guide, but don't
- // capitalize error messages, i.e., use "the server
- // didn't...". (Here and in other places.)
- error("The server didn't start successfully");
+ error("the server didn't start successfully");
}
}
catch(const Exception& ex)
@@ -172,22 +257,31 @@ IcePack::Parser::stateServer(const list<string>& args)
switch(state)
{
- // TODO: ML: Indentation wrong, { } missing.
case Inactive:
+ {
cout << "inactive" << endl;
break;
+ }
case Activating:
+ {
cout << "activating" << endl;
break;
+ }
case Active:
+ {
cout << "active" << endl;
break;
+ }
case Deactivating:
+ {
cout << "deactivating" << endl;
break;
+ }
case Destroyed:
+ {
cout << "destroyed" << endl;
break;
+ }
default:
assert(false);
}
diff --git a/cpp/src/IcePack/Parser.h b/cpp/src/IcePack/Parser.h
index 96590a0eb7c..c6614d36a68 100644
--- a/cpp/src/IcePack/Parser.h
+++ b/cpp/src/IcePack/Parser.h
@@ -67,7 +67,10 @@ public:
void usage();
- void addServer(const std::list<std::string>&, const std::list<std::string>&, const std::list<std::string>&);
+ void addApplication(const std::list<std::string>&);
+ void removeApplication(const std::list<std::string>&);
+
+ void addServer(const std::list<std::string>&);
void startServer(const std::list<std::string>&);
void describeServer(const std::list<std::string>&);
void stateServer(const std::list<std::string>&);
diff --git a/cpp/src/IcePack/Scanner.l b/cpp/src/IcePack/Scanner.l
index 44896f91994..9f55d65b50d 100644
--- a/cpp/src/IcePack/Scanner.l
+++ b/cpp/src/IcePack/Scanner.l
@@ -96,6 +96,10 @@ NL [\n]
return ICE_PACK_EXIT;
}
+"application" {
+ return ICE_PACK_APPLICATION;
+}
+
"server" {
return ICE_PACK_SERVER;
}
@@ -136,22 +140,6 @@ NL [\n]
return ICE_PACK_START;
}
-"adapters" {
- return ICE_PACK_ADAPTERS;
-}
-
-"options" {
- return ICE_PACK_OPTIONS;
-}
-
-"{" {
- return ICE_PACK_OPEN_BRACKET;
-}
-
-"}" {
- return ICE_PACK_CLOSE_BRACKET;
-}
-
{WS}*(\\{WS}*{NL})? {
int len = strlen(yytext);
for(int i = 0; i < len; ++i)
diff --git a/cpp/src/IcePack/Server.cpp b/cpp/src/IcePack/Server.cpp
index fefa7aada7f..b746ef9ae7a 100644
--- a/cpp/src/IcePack/Server.cpp
+++ b/cpp/src/IcePack/Server.cpp
@@ -145,6 +145,9 @@ void
"-h, --help Show this message.\n"
"-v, --version Display the Ice version.\n"
"--nowarn Don't print any security warnings.\n"
+ "--deploy descriptor [target1 [target2 ...]]\n"
+ " Deploy application describe by descriptor\n"
+ " with optional targets.\n"
;
}
@@ -159,6 +162,8 @@ int
stringSeqToArgs(args, argc, argv);
bool nowarn = false;
+ string descriptor;
+ vector<string> targets;
for(int i = 1; i < argc; ++i)
{
if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
@@ -175,6 +180,22 @@ int
{
nowarn = true;
}
+ else if(strcmp(argv[i], "--deploy") == 0)
+ {
+ if(i + 1 >= argc)
+ {
+ cerr << appName() << ": missing descriptor argument for option `" << argv[i] << "'" << endl;
+ usage();
+ return EXIT_FAILURE;
+ }
+
+ descriptor = argv[++i];
+
+ while(argv[++i][0] != '-' && i < argc)
+ {
+ targets.push_back(argv[i]);
+ }
+ }
else
{
cerr << appName() << ": unknown option `" << argv[i] << "'" << endl;
@@ -299,6 +320,28 @@ int
adminAdapter->activate();
locatorAdapter->activate();
locatorRegistryAdapter->activate();
+
+ //
+ // Deploy application desciptor.
+ //
+ if(!descriptor.empty())
+ {
+ try
+ {
+ admin->addApplication(descriptor, targets);
+ }
+ catch(const ServerDeploymentException& ex)
+ {
+ cerr << appName() << ": warning: failed to deploy application " << descriptor << ":" << endl;
+ cerr << ex << ": " << ex.server << ": " << ex.reason << endl;
+ }
+ catch(const DeploymentException& ex)
+ {
+ cerr << appName() << ": warning: failed to deploy application " << descriptor << ":" << endl;
+ cerr << ex << ": " << ex.component << ": " << ex.reason << endl;
+ }
+ }
+
communicator()->waitForShutdown();
ignoreInterrupt();
diff --git a/cpp/src/IcePack/ServerDeployer.cpp b/cpp/src/IcePack/ServerDeployer.cpp
index de78b8726af..60636a9a1cd 100644
--- a/cpp/src/IcePack/ServerDeployer.cpp
+++ b/cpp/src/IcePack/ServerDeployer.cpp
@@ -111,6 +111,10 @@ void
IcePack::ServerDeployHandler::startElement(const XMLCh *const name, AttributeList &attrs)
{
ComponentDeployHandler::startElement(name, attrs);
+ if(!isCurrentTargetDeployable())
+ {
+ return;
+ }
string str = toString(name);
@@ -163,13 +167,16 @@ IcePack::ServerDeployHandler::endElement(const XMLCh *const name)
{
string str = toString(name);
- if(str == "classname")
- {
- _deployer.setClassName(elementValue());
- }
- else if(str == "pwd")
+ if(isCurrentTargetDeployable())
{
- _deployer.setWorkingDirectory(elementValue());
+ if(str == "classname")
+ {
+ _deployer.setClassName(elementValue());
+ }
+ else if(str == "pwd")
+ {
+ _deployer.setWorkingDirectory(elementValue());
+ }
}
ComponentDeployHandler::endElement(name);
@@ -178,8 +185,9 @@ IcePack::ServerDeployHandler::endElement(const XMLCh *const name)
IcePack::ServerDeployer::ServerDeployer(const Ice::CommunicatorPtr& communicator,
const string& name,
const string& path,
- const string& libraryPath) :
- ComponentDeployer(communicator),
+ const string& libraryPath,
+ const vector<string>& targets) :
+ ComponentDeployer(communicator, name, targets),
_libraryPath(libraryPath)
{
_variables["name"] = name;
@@ -187,6 +195,7 @@ IcePack::ServerDeployer::ServerDeployer(const Ice::CommunicatorPtr& communicator
_description.name = name;
_description.path = path;
+ _description.targets = targets;
}
void
@@ -244,6 +253,15 @@ IcePack::ServerDeployer::parse(const std::string& descriptor)
void
IcePack::ServerDeployer::deploy()
{
+ ServerPrx server = _serverManager->findByName(_description.name);
+ if(server)
+ {
+ ServerDeploymentException ex;
+ ex.server = _variables["name"];
+ ex.reason = "Server already exists";
+ throw ex;
+ }
+
ComponentDeployer::deploy();
try
@@ -252,6 +270,8 @@ IcePack::ServerDeployer::deploy()
}
catch(const ServerExistsException& ex)
{
+ ComponentDeployer::undeploy();
+
ServerDeploymentException ex1;
ex1.server = _variables["name"];
ex1.reason = "Server already exists";
@@ -262,8 +282,18 @@ IcePack::ServerDeployer::deploy()
void
IcePack::ServerDeployer::undeploy()
{
- _serverManager->remove(_description.name);
-
+ try
+ {
+ _serverManager->remove(_description.name);
+ }
+ catch(const ServerNotExistException&)
+ {
+ }
+
+ //
+ // TODO: Shall we really continue removing the server components
+ // here?
+ //
ComponentDeployer::undeploy();
}
@@ -327,8 +357,7 @@ IcePack::ServerDeployer::addService(const string& name, const string& descriptor
{
if(_kind != ServerKindCppIceBox && _kind != ServerKindJavaIceBox)
{
- // TODO: ML: Grammar. Should this be "allowed"?
- throw DeploySAXParseException("services are only allows in IceBox servers", _locator);
+ throw DeploySAXParseException("services are only allowed in IceBox servers", _locator);
}
if(name.empty())
@@ -346,7 +375,9 @@ IcePack::ServerDeployer::addService(const string& name, const string& descriptor
std::map<std::string, std::string> variables = _variables;
variables["name"] = name;
- ServiceDeployer* task = new ServiceDeployer(_communicator, *this, variables);
+ string componentPath = _componentPath + "." + name;
+
+ ServiceDeployer* task = new ServiceDeployer(_communicator, *this, variables, componentPath, _targets);
try
{
string xmlFile = descriptor[0] != '/' ? _variables["basedir"] + "/" + descriptor : descriptor;
@@ -354,13 +385,7 @@ IcePack::ServerDeployer::addService(const string& name, const string& descriptor
}
catch(const ParserDeploymentException& ex)
{
- //
- // Add component and wrap the exception in a
- // ParserDeploymentWrapperException.
- //
- ParserDeploymentException ex1(ex);
- ex1.component = _variables["name"] + ":" + ex.component;
- throw ParserDeploymentWrapperException(ex1);
+ throw ParserDeploymentWrapperException(ex);
}
_tasks.push_back(task);
diff --git a/cpp/src/IcePack/ServerDeployer.h b/cpp/src/IcePack/ServerDeployer.h
index c2004d06bc3..0f7194c4478 100644
--- a/cpp/src/IcePack/ServerDeployer.h
+++ b/cpp/src/IcePack/ServerDeployer.h
@@ -8,7 +8,6 @@
//
// **********************************************************************
-
#ifndef ICE_PACK_SERVER_DEPLOYER_H
#define ICE_PACK_SERVER_DEPLOYER_H
@@ -33,7 +32,8 @@ public:
ServerKindJavaServer
};
- ServerDeployer(const Ice::CommunicatorPtr&, const std::string&, const std::string&, const std::string&);
+ ServerDeployer(const Ice::CommunicatorPtr&, const std::string&, const std::string&, const std::string&,
+ const std::vector<std::string>&);
void setServerManager(const ServerManagerPrx&);
void setAdapterManager(const AdapterManagerPrx&);
diff --git a/cpp/src/IcePack/ServiceDeployer.cpp b/cpp/src/IcePack/ServiceDeployer.cpp
index 6c39de8f07d..3a8bdb7f291 100644
--- a/cpp/src/IcePack/ServiceDeployer.cpp
+++ b/cpp/src/IcePack/ServiceDeployer.cpp
@@ -25,8 +25,6 @@ public:
ServiceDeployHandler(ServiceDeployer&);
virtual void startElement(const XMLCh *const name, AttributeList &attrs);
- virtual void endElement(const XMLCh *const name);
- virtual void startDocument();
private:
@@ -41,15 +39,14 @@ IcePack::ServiceDeployHandler::ServiceDeployHandler(ServiceDeployer& deployer) :
{
}
-void
-IcePack::ServiceDeployHandler::startDocument()
-{
-}
-
void
IcePack::ServiceDeployHandler::startElement(const XMLCh *const name, AttributeList &attrs)
{
ComponentDeployHandler::startElement(name, attrs);
+ if(!isCurrentTargetDeployable())
+ {
+ return;
+ }
string str = toString(name);
@@ -82,18 +79,12 @@ IcePack::ServiceDeployHandler::startElement(const XMLCh *const name, AttributeLi
}
}
-void
-IcePack::ServiceDeployHandler::endElement(const XMLCh *const name)
-{
- string str = toString(name);
-
- ComponentDeployHandler::endElement(name);
-}
-
IcePack::ServiceDeployer::ServiceDeployer(const Ice::CommunicatorPtr& communicator,
ServerDeployer& serverDeployer,
- const map<string, string>& variables) :
- ComponentDeployer(communicator),
+ const map<string, string>& variables,
+ const string& componentPath,
+ const vector<string>& targets) :
+ ComponentDeployer(communicator, componentPath, targets),
_serverDeployer(serverDeployer)
{
_variables = variables;
diff --git a/cpp/src/IcePack/ServiceDeployer.h b/cpp/src/IcePack/ServiceDeployer.h
index e72af463eb7..bc38c7f573f 100644
--- a/cpp/src/IcePack/ServiceDeployer.h
+++ b/cpp/src/IcePack/ServiceDeployer.h
@@ -13,8 +13,6 @@
#include <IceUtil/Shared.h>
#include <IcePack/ComponentDeployer.h>
-// Remove duplicate empty line.
-
namespace IcePack
{
@@ -30,7 +28,8 @@ public:
ServiceKindFreeze
};
- ServiceDeployer(const Ice::CommunicatorPtr&, ServerDeployer&, const std::map<std::string, std::string>&);
+ ServiceDeployer(const Ice::CommunicatorPtr&, ServerDeployer&, const std::map<std::string, std::string>&,
+ const std::string&, const std::vector<std::string>&);
void parse(const std::string&);
diff --git a/cpp/test/IcePack/simple/run.py b/cpp/test/IcePack/simple/run.py
index 8332dc05597..f1e00d3f108 100755
--- a/cpp/test/IcePack/simple/run.py
+++ b/cpp/test/IcePack/simple/run.py
@@ -77,7 +77,7 @@ if TestUtil.isWin32() == 0 and TestUtil.protocol != "ssl":
client = os.path.join(testdir, "client")
print "registering server with icepack...",
- IcePackAdmin.addServer(toplevel, "server", server, "", os.path.join(testdir, "simple_server.xml"));
+ IcePackAdmin.addServer(toplevel, "server", os.path.join(testdir, "simple_server.xml"), server, "", "");
print "ok"
print "testing adapter registration...",
diff --git a/cpp/test/IcePack/simple/simple_server.xml b/cpp/test/IcePack/simple/simple_server.xml
index d5b80a690c6..9b2268fb7c1 100644
--- a/cpp/test/IcePack/simple/simple_server.xml
+++ b/cpp/test/IcePack/simple/simple_server.xml
@@ -4,4 +4,11 @@
<adapter name="TestAdapter"/>
</adapters>
+ <target name="debug">
+ <properties>
+ <property name="Ice.Network.Trace" value="1"/>
+ <property name="Ice.Network.Protocol" value="1"/>
+ </properties>
+ </target>
+
</server> \ No newline at end of file