#3 deployment service - automatic selection based on server


using the deployment service you can easily swith from
different configuration, but actually you need to change
the CarbonDeploymentConfig.properties or to set an
environment variable to specify a different environment.

If you need to deploy a totally self-contained application
(no external lib, no change to the classpath) as an ear
or war this is not a good solution: if you want to deploy
the same application, without rebuilding the war/ear you
need to expand the application and manually modify the
file (usually contained in a jar into the ear) OR specify
an environment variable (not very good if you want to
keep the application indipendent from the environment

To solve this problem we come up with a modified
version of the DeploymentService implementation which
let you specify a special variable ${servername} in the
deployment configuration.



the deployment service automatically replace the server
name and select the correct xml file according to the
environment, for example dev/server_test.xml or
dev/integration1.xml. This is also very useful for
developers who can have their specific xml configuration
working without modifying anything in the code base.

this is a snippet from my quick simple implementation:

public class ServerBasedDeploymentServiceImpl
implements DeploymentService, Configurable,
Startable, Suspendable, Destroyable

private static final String SERVER\_NAME

= "${servername}";

public void configure(ComponentConfiguration

// original code here
// at the end of the Configure method, following the
default implementation code:

    int servernameindex;
    if \(\(servernameindex =

targetNodeName.indexOf(SERVER_NAME)) != -1)

        String lServerName = null;

            lServerName =

(UnknownHostException e)
throw new




"ServerName cannot be read. Unable to

replace " + SERVER_NAME + " in deployment properties");

        log.debug\("Replacing " +

SERVER_NAME + " with " + lServerName);

        this.targetNodeName =

targetNodeName.substring\(0, servernameindex\)

targetNodeName.substring(servernameindex +


// end of configure()

I'd really like to see this feature added to the standard
deployment service


  • Douglas Voet

    Douglas Voet - 2003-09-24

    Logged In: YES

    made some changes to the deployment service so that you
    can now specify NameLookup components that are
    responsible for looking up either environment or instance
    names. Also added a LocalHostNameLookup component that
    will return the local host name. Other NameLookups could be
    written to do such things as query an application for
    environment and instance names.

  • Douglas Voet

    Douglas Voet - 2003-09-24
    • labels: --> module-deployment
    • assigned_to: nobody --> dvoet
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks