Skip to content

Commit fe5ee67

Browse files
committed
Be, and it is
0 parents  commit fe5ee67

File tree

7 files changed

+810
-0
lines changed

7 files changed

+810
-0
lines changed

.settings.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
4+
<servers>
5+
<server>
6+
<id>ossrh</id>
7+
<username>${env.SONATYPE_USERNAME}</username>
8+
<password>${env.SONATYPE_PASSWORD}</password>
9+
</server>
10+
</servers>
11+
</settings>

.travis.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
- oraclejdk7
5+
install:
6+
- mvn clean install --settings .settings.xml -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip -B -V
7+
before_install:
8+
- if [ ! -z "$GPG_SECRET_KEYS" ]; then echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import; fi
9+
- if [ ! -z "$GPG_OWNERTRUST" ]; then echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust; fi
10+
before_deploy:
11+
- mvn clean package -P release --settings .settings.xml -DperformRelease=true -DskipTests=true -B -U
12+
deploy:
13+
-
14+
provider: script
15+
script: mvn deploy -P release --settings .settings.xml -DperformRelease=true -DskipTests=true -B -U
16+
skip_cleanup: true
17+
on:
18+
repo: azam/ulidj
19+
jdk: oraclejdk7
20+
-
21+
provider: releases
22+
api_key: "$GITHUB_OAUTH_TOKEN"
23+
file_glob: true
24+
file:
25+
- "target/ulidj-*.jar"
26+
- "target/*.pom"
27+
- "target/*.asc"
28+
- "target/*.sha1"
29+
skip_cleanup: true
30+
overwrite: true
31+
on:
32+
repo: azam/ulidj
33+
jdk: oraclejdk7
34+
tags: true

license

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Azamshul Azizy
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

pom.xml

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>io.azam.ulidj</groupId>
5+
<artifactId>ulidj</artifactId>
6+
<version>1.0.0</version>
7+
<name>ulidj</name>
8+
<description>ULID (Universally Unique Lexicographically Sortable Identifier) generator and parser for Java.</description>
9+
<url>https://github.com/azam/ulidj</url>
10+
<licenses>
11+
<license>
12+
<name>The MIT License (MIT)</name>
13+
<url>http://opensource.org/licenses/MIT</url>
14+
<distribution>repo</distribution>
15+
</license>
16+
</licenses>
17+
<scm>
18+
<url>https://github.com/azam/ulidj</url>
19+
<developerConnection>azam</developerConnection>
20+
</scm>
21+
<developers>
22+
<developer>
23+
<id>1</id>
24+
<name>azam</name>
25+
<email>[email protected]</email>
26+
<organization>azam.io</organization>
27+
<organizationUrl>http://azam.io</organizationUrl>
28+
<roles>
29+
<role>Geek</role>
30+
</roles>
31+
<timezone>+9</timezone>
32+
</developer>
33+
</developers>
34+
<issueManagement>
35+
<system>GitHub</system>
36+
<url>https://github.com/azam/ulidj/issues</url>
37+
</issueManagement>
38+
<organization>
39+
<name>azam</name>
40+
<url>http://azam.io</url>
41+
</organization>
42+
<properties>
43+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
44+
</properties>
45+
<dependencies>
46+
<dependency>
47+
<groupId>junit</groupId>
48+
<artifactId>junit</artifactId>
49+
<version>4.12</version>
50+
<scope>test</scope>
51+
</dependency>
52+
</dependencies>
53+
<distributionManagement>
54+
<snapshotRepository>
55+
<id>ossrh</id>
56+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
57+
</snapshotRepository>
58+
<repository>
59+
<id>ossrh</id>
60+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
61+
</repository>
62+
</distributionManagement>
63+
<profiles>
64+
<profile>
65+
<id>release</id>
66+
<activation>
67+
<activeByDefault>false</activeByDefault>
68+
</activation>
69+
<properties>
70+
<gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
71+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
72+
</properties>
73+
<build>
74+
<plugins>
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-compiler-plugin</artifactId>
78+
<version>3.6.0</version>
79+
<configuration>
80+
<source>1.7</source>
81+
<target>1.7</target>
82+
</configuration>
83+
</plugin>
84+
<plugin>
85+
<groupId>org.apache.maven.plugins</groupId>
86+
<artifactId>maven-source-plugin</artifactId>
87+
<version>3.0.1</version>
88+
<executions>
89+
<execution>
90+
<id>attach-sources</id>
91+
<goals>
92+
<goal>jar-no-fork</goal>
93+
</goals>
94+
</execution>
95+
</executions>
96+
</plugin>
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-javadoc-plugin</artifactId>
100+
<version>2.10.4</version>
101+
<executions>
102+
<execution>
103+
<id>attach-javadocs</id>
104+
<goals>
105+
<goal>jar</goal>
106+
</goals>
107+
</execution>
108+
</executions>
109+
</plugin>
110+
<plugin>
111+
<groupId>org.apache.maven.plugins</groupId>
112+
<artifactId>maven-gpg-plugin</artifactId>
113+
<version>1.6</version>
114+
<executions>
115+
<execution>
116+
<id>sign-artifacts</id>
117+
<phase>verify</phase>
118+
<goals>
119+
<goal>sign</goal>
120+
</goals>
121+
</execution>
122+
</executions>
123+
</plugin>
124+
<plugin>
125+
<groupId>org.sonatype.plugins</groupId>
126+
<artifactId>nexus-staging-maven-plugin</artifactId>
127+
<version>1.6.6</version>
128+
<extensions>true</extensions>
129+
<configuration>
130+
<serverId>ossrh</serverId>
131+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
132+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
133+
</configuration>
134+
</plugin>
135+
</plugins>
136+
</build>
137+
</profile>
138+
</profiles>
139+
</project>

readme.md

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# ulidj
2+
3+
[![MIT licensed](https://img.shields.io/badge/license-mit-blue.svg)](https://raw.githubusercontent.com/azam/ulidj/master/license)
4+
[![Travis CI](https://api.travis-ci.org/azam/ulidj.svg?branch=master)](https://travis-ci.org/azam/ulidj)
5+
6+
ULID (Universally Unique Lexicographically Sortable Identifier) generator and parser for Java.
7+
8+
Refer [alizain/ulid](https://github.com/alizain/ulid) for a more detailed ULID specification.
9+
10+
## License
11+
12+
```
13+
MIT License
14+
15+
Copyright (c) 2016 Azamshul Azizy
16+
17+
Permission is hereby granted, free of charge, to any person obtaining a copy
18+
of this software and associated documentation files (the "Software"), to deal
19+
in the Software without restriction, including without limitation the rights
20+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21+
copies of the Software, and to permit persons to whom the Software is
22+
furnished to do so, subject to the following conditions:
23+
24+
The above copyright notice and this permission notice shall be included in all
25+
copies or substantial portions of the Software.
26+
27+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33+
SOFTWARE.
34+
```
35+
36+
## Maven
37+
38+
Add the following tag to `dependencies` tag in your `pom.xml` file.
39+
40+
```xml
41+
<dependency>
42+
<groupId>io.azam</groupId>
43+
<artifactId>ulidj</artifactId>
44+
<version>1.0.0</version>
45+
</dependency>
46+
```
47+
48+
## Usage
49+
50+
ULID generation examples:
51+
52+
```java
53+
String ulid1 = ULID.random();
54+
String ulid2 = ULID.random(ThreadLocalRandom.current());
55+
String ulid3 = ULID.random(SecureRandom.newInstance("SHA1PRNG"));
56+
byte[] entropy = new byte[] { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9 };
57+
String ulid4 = ULID.generate(System.currentTimeMillis(), entropy);
58+
```
59+
60+
ULID parsing examples:
61+
62+
```java
63+
String ulid = "003JZ9J6G80123456789abcdef";
64+
assert ULID.isValid(ulid);
65+
long ts = ULID.getTimestamp(ulid);
66+
assert ts == 123456789000L;
67+
byte[] entropy = ULID.getEntropy(ulid);
68+
```
69+
70+
## Prior Art
71+
72+
- [Lewiscowles1986/jULID](https://github.com/Lewiscowles1986/jULID)
73+
- [alizain/ulid](https://github.com/alizain/ulid)

0 commit comments

Comments
 (0)