Skip to content
This repository has been archived by the owner on Oct 6, 2018. It is now read-only.

echocat/jomon

Repository files navigation

echocat Jomon

…is a library comparable with Apache Commons and it extends also Apache Commons but it contains a lot of other useful tools for Java.

Highlights

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?

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.

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.

Repository

…is another pattern. It is another way to receive elements, create, update and delete it instead of using the DAO-Pattern. Our interface structure is a simple presentation of this pattern.

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

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.

SRV Services

The org.echocat.jomon.net.cluster.channel.tcp.TcpClusterChannel does use SRV-Records 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:

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

Hosts:

_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.

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.

Links

Use with Maven

<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.

License

echocat Velma is licensed under MPL 2.0.

Want to help?

You are welcome. Fork or contact us.

Thanks

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

MOTOR-TALK GmbH Home of Europeans biggest car community.
optivo GmbH One of the leading Enterprise E-Mail-Marketing companies in Germany.

About

Collection of many useful tools for Java. Could be compared with apache-commons.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages