h1. echocat Jomon

"!https://secure.travis-ci.org/echocat/jomon.png!":https://travis-ci.org/echocat/jomon

...is a library comparable with "Apache Commons":http://commons.apache.org and it extends also Apache Commons but it contains a lot of other useful tools for Java.

h1. Highlights

h2. Cache

Very simple Cache-Interface @org.echocat.jomon.cache.Cache@ which provides basic operations to access caches.

There are extensions (of this interface) that adds some more features to the basic settings of the caches. This extensions are not implemented in the basic interface because that are no guarantee to have these features. Examples:
* @org.echocat.jomon.cache.ClearableCache@ to clear/flush all entries of a cache
* @org.echocat.jomon.cache.LimitedCache@ to retrieve /add limitations of a cache
* @org.echocat.jomon.cache.StatisticsEnabledCache@ to retrieve statistic information about a cache
* ...

Currently there are basic implementations available:

| @org.echocat.jomon.cache.CombinedCache@ | which makes it possible to stack multiple Cache |
| @org.echocat.jomon.cache.ServletRequestBasedCache@ | which provides caching based on a ServletRequest |
| @org.echocat.jomon.cache.LfuCache@ | Least Frequently Used |
| @org.echocat.jomon.cache.LruCache@ | Least Recently Used |
| @org.echocat.jomon.cache.FifoCache@ | First In First Out |

Retrieve an instance of a Cache?

bc. cacheProvider.provide(getClass(), "hostToIp",
    lruCache(String.class, String.class).withCapacity(10000).withMaximumLifetime("1h")
);

_See @org.echocat.jomon.cache.management.CacheProvider@, @org.echocat.jomon.cache.management.DefaultCacheDefinition.lruCache()@ and @org.echocat.jomon.cache.management.DefaultCacheRepository@._

h2. Generator

We created a pattern to simple generate objects. This pattern defines that there is an singleton of a generator and this generator will generator an object instance for a given requirement.

See the @org.echocat.jomon.demo.generator.EmployeeGeneratorUnitTest@ to see how it works.

h2. Repository

...is "another pattern":http://msdn.microsoft.com/en-us/library/ff649690.aspx. It is another way to receive elements, create, update and delete it instead of using the "DAO-Pattern":http://en.wikipedia.org/wiki/Data_access_object. Our interface structure is a simple presentation of this pattern.

See the @org.echocat.jomon.demo.repository.EmployeeRepositoryUnitTest@ to see how it works.

h2. Simple Cluster

@org.echocat.jomon.net.cluster.channel.ClusterChannel@ is a basic way to send and receive messages in a cluster environment between JVMs. There are two implementations for Mutlicast and TCP.

There are also usages by @org.echocat.jomon.net.cluster.cache.RemoveOverClusterListener@ which makes it possible that a remove on an entity in a cache will flushed over the whole cluster.

h2. SRV Services

The @org.echocat.jomon.net.cluster.channel.tcp.TcpClusterChannel@ does use "SRV-Records":http://en.wikipedia.org/wiki/SRV_record to determinate all possible nodes in a cluster. It depends on the @org.echocat.jomon.net.service.SrvEntryBasedServicesManager@.

You just have to reconfigure the DNS-Server entries and the nodes in the cluster will recognize this change in a period of 10 seconds without an restart of the application.

Config:

bc. TcpClusterChannel.service = ttc
TcpClusterChannel.remoteAddresses = cluster.example.com

Hosts:

bc. _ttc._tcp.cluster.example.com. 86400 IN SRV 10 60 5060 node1.example.com.
_ttc._tcp.cluster.example.com. 86400 IN SRV 10 60 5060 node2.example.com.
_ttc._tcp.cluster.example.com. 86400 IN SRV 10 60 5060 node3.example.com.

h2. Other useful stuff

| @org.echocat.jomon.runtime.util.Duration@ | Do not use @long milliseconds@ anymore - use an entity |
| @org.echocat.jomon.runtime.util.ByteUnit@ | Could be compared with @TimeUnit@ |
| @org.echocat.jomon.runtime.util.ByteCount@ | Do not use @long bytes@ anymore - use an entity |
| @org.echocat.jomon.runtime.util.Range@ | An interface with a lot of basic implementations for a range of something (ex: a date) |
| @org.echocat.jomon.runtime.concurrent.Retryer@ | A way to retry something if it dons't work instantly |
| @org.echocat.jomon.runtime.iterators.CloseableIterator@ | Sometimes it is important to make it possible that an Iterator could be close - simple but effective. See also the implementations. |
| @org.echocat.jomon.runtime.math.OverPeriodCounter@ | Good for statistical reasons: Measure to access of objects in a specific period of time. |
| @org.echocat.jomon.runtime.math.OverPeriodAverageLongCounter@ | To collect average values over a time period. |

..and many more. Have a look at our code.

h1. Links

* "Maven Repository":http://repo.echocat.org/echocat
* "Download latest bundle":https://repo.echocat.org/jomon-releases/org/echocat/jomon/bundle/[RELEASE]/bundle-[RELEASE]-distribution.zip (If you don't want to use maven)
* "Issues":https://github.com/echocat/jomon/issues

h1. Use with Maven

bc.<properties>
    <versions.org.echocat.jomon>--fill here latest version in--</versions.org.echocat.jomon>
</properties>
<repositories>
    <repository>
        <id>echocat</id>
        <url>http://repo.echocat.org/echocat</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.echocat.jomon</groupId>
        <artifactId>cache</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon</groupId>
        <artifactId>format</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.maven</groupId>
        <artifactId>common</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.net</groupId>
        <artifactId>cluster</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.net</groupId>
        <artifactId>common</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.net</groupId>
        <artifactId>http</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.net</groupId>
        <artifactId>mail</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.net</groupId>
        <artifactId>service</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.net</groupId>
        <artifactId>testing</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon</groupId>
        <artifactId>process</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon</groupId>
        <artifactId>resources</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon</groupId>
        <artifactId>runtime</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.spring</groupId>
        <artifactId>common</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon.spring</groupId>
        <artifactId>testing</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
    <dependency>
        <groupId>org.echocat.jomon</groupId>
        <artifactId>testing</artifactId>
        <version>${versions.org.echocat.jomon}</version>
    </dependency>
</dependencies>


"Find out what are the possible versions or what is the latest version.":http://repo.echocat.org/echocat/org/echocat/jomon/

h1. License

echocat Velma is licensed under "MPL 2.0":http://mozilla.org/MPL/2.0/.

h1. Want to help?

You are welcome. Fork or "contact us":mailto:contact@echocat.org.

h1. Thanks

Many thanks to two companies which helps to develop this great project.

| "MOTOR-TALK GmbH":https://motortalk.net | Home of Europeans biggest car community. |
| "optivo GmbH":http://www.optivo.com/ | One of the leading Enterprise E-Mail-Marketing companies in Germany. |
