de.smartics.properties.tutorial.config.key
Class MultiConfigurationKeyTutorial

Package class diagram package MultiConfigurationKeyTutorial
java.lang.Object
  extended by de.smartics.properties.tutorial.config.key.MultiConfigurationKeyTutorial

@Document(title="Multiple Nodes",
          sortKey="basics1010")
@DocCategory(value="basics")
public class MultiConfigurationKeyTutorial
     
     
extends Object

This tutorial shows how configurations for one environment with multiple nodes can be bundled. This may not be for everyone's taste since it implies that configurations not required by one node are nonetheless deployed. If you like to deploy only configurations specific to one node, you simply have to provide one project / artifact per node.


Constructor Summary
MultiConfigurationKeyTutorial()
           
 
Method Summary
 void accessConfigurationByHardcodedKey()
           In this example we assume that the test-module-announce module is deployed on the main server while test-module-mail is part of a mail server.
 void setUp()
           
 void theMailServerConfiguration()
           Basically access information is purely a matter of creating the correct configuration key.
 void theMainServerConfiguration()
           The main server simply changes the name of the node and the name of the application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiConfigurationKeyTutorial

public MultiConfigurationKeyTutorial()
Method Detail

setUp

public void setUp()

accessConfigurationByHardcodedKey

@DocChapter
public void accessConfigurationByHardcodedKey()

In this example we assume that the test-module-announce module is deployed on the main server while test-module-mail is part of a mail server. Both servers are part of the same environment and deployed to their own nodes.

We simulate the two nodes in one project. In real life both will have their own projects and use only one of the following dependencies:

     
     
     
       
      
      
       
       de.smartics.sandbox
      
      
       
      
      
       
       test-module-mail
      
      
     
     
     
     
     
     
       
      
      
       
       de.smartics.sandbox
      
      
       
      
      
       
       test-module-announce
      
      
     
     
     
 

The definition for these properties is provided by a dependency like this:

     
     
     
       
      
      
       
       de.smartics.sandbox
      
      
       
      
      
       
       test-application-config-multinode
      
      
     
     
     
 

Now let's have a look how we can access information on the two nodes.


theMailServerConfiguration

@DocSection
public void theMailServerConfiguration()

Basically access information is purely a matter of creating the correct configuration key. This key identifies the application and the factory provides access to this information.

In


theMainServerConfiguration

@DocSection
public void theMainServerConfiguration()

The main server simply changes the name of the node and the name of the application. This would allow the same application be deployed on multiple nodes. Note that a node is not required to be a physical instance. A node may refer to an EAR deployable that is deployed side by side to other EARs on the same application server.

In



Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.