This project has retired. For details please refer to its Attic page.
UID Starter Template for Bootstrap
Overview
Scripting
Alarms
Circuit Breaker
Constraints
FileConfig
HTTP
Invocation Cache
JMX
Locking
Logging
OSGi
RDF
ReST Client
ReST - HATEOAS Primer
ReST Common
ReST Server
Restlet Support
Servlet
Shiro Security
Shiro Web Security
Spring Integration
SQL
UID
UoWFile

UID

code

docs

tests

This library provides Services to easily generate unique identifiers and sequences of numbers.

Table 46. Artifact

Group IDArtifact IDVersion

org.apache.polygene.libraries

org.apache.polygene.library.uid

0


Unique Identifiers

Assembly is done using the provided Assembler:

new UuidServiceAssembler().visibleIn( layer ).assemble( moduleAssembly );

Usage is quite simple:

@Service UuidService uuidService;

public void doSomething()
{
    String id1 = uuidService.generateUuid( 0 );
    // eg. 1020ECBB-098C-46E0-94DC-F78E2265EAA1-36

    String id2 = uuidService.generateUuid( 12 );
    // eg. 84E06578EAE3
}

Sequencing

Sequencing is used to automatically generate a sequence of numbers.

The algorithm is that currentSequenceValue is the number that was last returned in a newSequenceValue call, and will initially be zero. Persisting Sequencing services defines "initially" as the first run ever, as subsequent starts may retrieve the currentSequenceValue from an EntityStore.

Transient Sequences

Assembly is done using the provided Assembler:

new TransientSequencingAssembler().visibleIn( layer ).assemble( moduleAssembly );

Usage is quite simple:

@Service Sequencing sequencing;

public void doSomething()
{
    sequencing.currentSequenceValue(); // return 0

    sequencing.newSequenceValue(); // return 1
    sequencing.currentSequenceValue(); // return 1
}
Persisted Sequences

Assembly is done using the provided Assembler:

new PersistingSequencingAssembler().visibleIn( layer ).assemble( moduleAssembly );

Usage is quite simple:

@Service Sequencing sequencing;

public void doSomething()
{
    sequencing.currentSequenceValue(); // return 0

    sequencing.newSequenceValue(); // return 1
    sequencing.currentSequenceValue(); // return 1
}