cometd/cometd — pull request #19 by patriziomunzi (2014-06-14 16:41:37+00:00)
Title: Added Oort configuration via an external properties file and Oort automatic peers discovering AWS support

# Oort configuration via an external properties file

You can configure the Oort via a properties file by configuring a org.cometd.oort.OortProperitesFileConfigServlet in web.xml, for example:
```

oort
org.cometd.oort.OortPropertiesFileConfigServlet
2

oort.properties.file
cometd.properties

```
the properties file is specified via the oort.properties.file parameter and must be located in the classpath

The OortPropertiesFileConfigServlet uses the OortConfigFactory to create the specific OortConfig class configured.
The type of discovery method Oort must use is configured in the properties file via:
```
oort.peer_discovery=[static|multicast|aws]

oort.peer_discovery=static	--> OortStaticConfig
oort.peer_discovery=multicast	--> OortMulticastConfig
oort.peer_discovery=aws	--> OortAWSConfig
```
## OortStaticConfig and OortMulticastConfig

OortStaticConfig and OortMulticastConfig classes replicate what's written already in the OortStaticConfigServlet and OortMulticastConfigServlet classes, causing code duplication. **I've aready decided how to remove this code duplication but I think it's better to do it in the master branch and keep things as they are in 2.9.x branch. Please let's talk about it**
Configuration can be done using the same parameters used in the servlets but specified via the property file
```
#
# Common Configuration Parameters
#
oort.url=
oort.secret=
oort.channels=
enableAckExtension=
jsonContext=

#
# Static Configuration Parameters
#
oort.peer_discovery=static
oort.cloud=

#
# Multicast Configuration Parameters
#
#oort.peer_discovery=multicast
oort.multicast.bindAddress=*
oort.multicast.groupAddress=239.255.0.1
oort.multicast.groupPort=5577
oort.multicast.timeToLive=1
oort.multicast.advertiseInterval=2000
oort.multicast.connectTimeout=1000
oort.multicast.maxTransmissionLength=1400
```

## OortAWSConfig

Oort automatic peers discovering has been enriched with the support of AWS, where multicast cannot be used.
When the AWS automatic peer discovering is enabled each Oort peer asks amazon (via the AWS API) using a AWS filter which nodes belong to the Oort cluster and then announce its oortURL to them via RMI (in the same way in multicast this is done via broadcast packets).
The AWS automatic peer discovering is enabled with the following properties:
```
oort.peer_discovery=aws

#
# your AWS access key
#
oort.aws.accessKey=AGAYGDUYGUGAUg
#
# your aws secret key
#
oort.aws.secretKey=reqFDsThaROGdwdwdwdwdpR+csds/kR
#
# the region Oort instances belong to
#
oort.aws.region=eu-west-1
#
# a semicolon separated list of filters that must be used to
# find the Oort instances belonging to the cluster among all your
# aws instances
#
oort.aws.filters=instance-state-name\=running;tag:ehcache\=cluster-1
#
# how often refresh the list of AWS instances belonging to Oort cluster (default 5000)
#
oort.aws.instancesRefreshInterval=5000
#
# the Oort connection timeout (default 2000)
#
oort.aws.connectTimeout=2000
#
# the address to be used as local RMI address (default to localhost)
#
oort.aws.rmiPeerAddress=
#
# the port where binding RMI (default to 40000)
#
oort.aws.rmiPeerPort=40000
#
# the port to connect to (default to rmiPeerPort)
#
oort.aws.rmiRemotePeerPort=
```