Articles Forum Examples Download Open Source
Copyright(c) 2007, 2008 by Pocomatic Software. All rights reserved.
In PocoCapsule, the dynamic invocation proxies used in setup an application are generated from application configuration descriptions (see Reflection from Projection). Therefore, one does not need to regenerate and rebuild these proxies if the configuration only changes by values of parameter values. However, one usually needs to regenerate and rebuild additional proxies if the configuration changes depend on new dynamic invocation signatures.
To avoid the need of recompile dynamic proxies on the fields, developers can pre-build all needed proxies for specific components (or the specific application) using configurations that are used for deployment testing. These proxies can even be built into their associated business logic components. This example illustrates such a component development and application deployment scenario.
In this example, two kind of components, namely MyNodeImplA and MyNodeImplB, all support the common Node interface. However, they are implemented and built independently. Each of them is built together with its IoC proxies into a dynamic library. These proxies are generated from skeleton configurations (skelA.xml and skelB.xml) that do not necessary have actual configuration parameters.
Then, a pipeline application is setup (setup.xml) using these node implementations without the need of rebuilding (generating and compiling) their dynamic invocation proxies.
main.C: This is a simple mini container, used to deploy the example application and push a message into the pipeline from its upstream node.
Node.h: This is the common interface of nodes in the to be built pipeline application.
MyNodeImplA.h and MyNodeImplB.h: These are two different node implementations.
skelA.xml and skelB.xml: These skeleton configurations are used to generate dynamic invocation proxies at development time. These proxies are built into the dynamic libraries of their respective node component implementations, namely MyNodeImplA.so/dll and MyNodeImplB.so/dll (see the makefiles listed below).
setup.xml: This is the application setup description. A (circular) pipeline is setup using the two kind of node component implementations. This configuration is not used to generate proxies but to be used to deploy/configure the application immediately.
Makefile, makefiles/Makefile.build, makefiles/Makefile.buildWindows_NT: The linux and Windows makefiles to build this example. These makefiles illustrate how to built components with their IoC proxies.
To build this example, the environment variable POCOCAPSULE_DIR should point to the PocoCapsule/C++ installed directory. Then, this example can be built by simply invoking gmake/make on linux/unix or nmake on windows.
· Before starting the application deployment container (i.e. the main executable), make sure the LD_LIBRARY_PATH (on linux and solaris) or the PATH (on windows) environment variable is set correctly to include the ${POCOCAPSULE_DIR}/lib directory.
· start the main executable:
prompt> main
It will print out the following result:
A::push("start")
B::push("start->A:upstream")
A::push("start->A:upstream->B:downstream")
B::push("start->A:upstream->B:downstream->A:upstream")
A::push("start->A:upstream->B:downstream->A:upstream->B:downstream")
B::push("start->A:upstream->B:downstream->A:upstream->B:downstream->A:upstream")
A::push("start->A:upstream->B:downstream->A:upstream->B:downstream->A:upstream->B:downstream")
start->A:upstream->B:downstream->A:upstream->B:downstream->A:upstream->B:downstream->end