Skip to content
This repository was archived by the owner on Feb 9, 2024. It is now read-only.

Commit 1576290

Browse files
committed
update
1 parent aa5ee73 commit 1576290

35 files changed

+264
-67
lines changed

.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</buildCommand>
1818
</buildSpec>
1919
<natures>
20-
<nature>org.eclipse.jdt.core.javanature</nature>
2120
<nature>org.eclipse.m2e.core.maven2Nature</nature>
21+
<nature>org.eclipse.jdt.core.javanature</nature>
2222
</natures>
2323
</projectDescription>

bin/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea/
2+
.settings/
3+
target/
4+
.classpath
5+
krux-stdlib.i*

bin/.project

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>krux-stdlib</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>

bin/README.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
java-krux-stdlib
2+
================
3+
4+
The Krux standard java library handles logging, command-line parsing, statsd reporting and other common functions for Krux applications.
5+
6+
# Building
7+
8+
To build, use Maven:
9+
10+
```shell
11+
$ mvn compile
12+
```
13+
14+
# Deploying
15+
16+
To deploy, ensure you have updated the version in `pom.xml` and use Maven:
17+
18+
```shell
19+
$ mvn clean compile deploy
20+
```
21+
22+
# Using
23+
24+
To use, add the following dependency to your pom.xml:
25+
26+
```xml
27+
<dependency>
28+
<groupId>com.krux</groupId>
29+
<artifactId>krux-stdlib</artifactId>
30+
<version>1.6.1</version>
31+
</dependency>
32+
```
33+
34+
# Usage
35+
36+
For the simplest use case, simply call `KruxStdLib.initialize(args)` before running your app's main logic...
37+
38+
```java
39+
public class ExampleMain {
40+
41+
public static void main(String[] args) {
42+
KruxStdLib.initialize(args);
43+
44+
//...do your stuff here...
45+
}
46+
}
47+
```
48+
49+
This will setup sl4j (via log4j) bindings for stdout and stderr, establish a statsd client for use throughout your app, and parse a standard set of command line options that all Krux apps should support. To see a list of the standard command line options, build an app that uses the stdlib as above, then pass '-h' or '--help' at the command line. You will see output like...
50+
51+
```
52+
Option Description
53+
------ -----------
54+
--app-name Application identifier, used for statsd namespaces, log
55+
file names, etc. If not supplied, will use this app's
56+
entry point classname. (default:
57+
TCPStreamListenerServer)
58+
--base-dir Base directory for app needs. (default: /tmp)
59+
--env Operating environment (default: dev)
60+
-h, --help Prints this helpful message
61+
--heap-stats-interval-ms [Integer] Interval (ms) for used heap statsd gauge (default: 1000)
62+
--http-port [Integer] Accept http connections on this port (0 = web server
63+
will not start) (default: 0)
64+
--log-level Default log4j log level (default: DEBUG)
65+
--stats Enable/disable statsd broadcast
66+
--stats-environment Stats environment (dictates statsd prefix) (default: dev)
67+
--stats-host Listening statsd host (default: localhost)
68+
--stats-port [Integer] Listening statsd port (default: 8125)
69+
```
70+
71+
In more advanced scenarios, you can specifiy custom command line options, set up shutdown hooks, tap into a standard HTTP listener and do other groovy things. See https://github.com/krux/java-krux-stdlib/blob/master/src/main/java/com/krux/stdlib/sample/ExampleMain.java for more complex examples.
72+

bin/pom.xml

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
<<<<<<< HEAD
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.krux</groupId>
6+
<artifactId>krux-stdlib</artifactId>
7+
<version>1.6.7</version>
8+
<dependencies>
9+
<dependency>
10+
<groupId>net.sf.jopt-simple</groupId>
11+
<artifactId>jopt-simple</artifactId>
12+
<version>4.8</version>
13+
</dependency>
14+
<dependency>
15+
<groupId>org.slf4j</groupId>
16+
<artifactId>slf4j-api</artifactId>
17+
<version>1.7.7</version>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.apache.commons</groupId>
21+
<artifactId>commons-lang3</artifactId>
22+
<version>3.3.2</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>com.netflix.archaius</groupId>
26+
<artifactId>archaius-core</artifactId>
27+
<version>0.6.3</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>ch.qos.logback</groupId>
31+
<artifactId>logback-classic</artifactId>
32+
<version>1.1.2</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>ch.qos.logback</groupId>
36+
<artifactId>logback-core</artifactId>
37+
<version>1.1.2</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.codahale.metrics</groupId>
41+
<artifactId>metrics-core</artifactId>
42+
<version>3.0.2</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>io.netty</groupId>
46+
<artifactId>netty-all</artifactId>
47+
<version>4.0.25.Final</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.fasterxml.jackson.jr</groupId>
51+
<artifactId>jackson-jr-objects</artifactId>
52+
<version>2.5.0</version>
53+
</dependency>
54+
<dependency>
55+
<groupId>mysql</groupId>
56+
<artifactId>mysql-connector-java</artifactId>
57+
<version>5.1.31</version>
58+
</dependency>
59+
<dependency>
60+
<groupId>junit</groupId>
61+
<artifactId>junit</artifactId>
62+
<version>4.11</version>
63+
<scope>test</scope>
64+
</dependency>
65+
=======
66+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
67+
<modelVersion>4.0.0</modelVersion>
68+
<groupId>com.krux</groupId>
69+
<artifactId>krux-stdlib</artifactId>
70+
<version>1.6.7</version>
71+
<packaging>jar</packaging>
72+
73+
<name>krux-stdlib</name>
74+
<url>https://github.com/krux/java-krux-stdlib</url>
75+
76+
<properties>
77+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
78+
<slf4j.version>1.7.7</slf4j.version>
79+
</properties>
80+
>>>>>>> origin/master
81+
82+
<distributionManagement>
83+
<repository>
84+
<id>kruxmvn</id>
85+
<name>kruxmvn-releases</name>
86+
<url>http://kruxmvn.artifactoryonline.com/kruxmvn/libs-releases-local</url>
87+
</repository>
88+
</distributionManagement>
89+
90+
<build>
91+
<plugins>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-compiler-plugin</artifactId>
95+
<version>2.3.2</version>
96+
<configuration>
97+
<source>1.6</source>
98+
<target>1.6</target>
99+
</configuration>
100+
</plugin>
101+
</plugins>
102+
</build>
103+
104+
<dependencies>
105+
<dependency>
106+
<groupId>net.sf.jopt-simple</groupId>
107+
<artifactId>jopt-simple</artifactId>
108+
<version>4.6</version>
109+
</dependency>
110+
<dependency>
111+
<groupId>org.slf4j</groupId>
112+
<artifactId>slf4j-api</artifactId>
113+
<version>${slf4j.version}</version>
114+
</dependency>
115+
<dependency>
116+
<groupId>org.apache.commons</groupId>
117+
<artifactId>commons-lang3</artifactId>
118+
<version>3.3.2</version>
119+
</dependency>
120+
<dependency>
121+
<groupId>com.netflix.archaius</groupId>
122+
<artifactId>archaius-core</artifactId>
123+
<version>0.6.3</version>
124+
</dependency>
125+
<dependency>
126+
<groupId>ch.qos.logback</groupId>
127+
<artifactId>logback-classic</artifactId>
128+
<version>1.1.2</version>
129+
</dependency>
130+
<dependency>
131+
<groupId>ch.qos.logback</groupId>
132+
<artifactId>logback-core</artifactId>
133+
<version>1.1.2</version>
134+
</dependency>
135+
<dependency>
136+
<groupId>com.codahale.metrics</groupId>
137+
<artifactId>metrics-core</artifactId>
138+
<version>3.0.2</version>
139+
</dependency>
140+
<dependency>
141+
<groupId>io.netty</groupId>
142+
<artifactId>netty-all</artifactId>
143+
<version>4.0.25.Final</version>
144+
</dependency>
145+
<dependency>
146+
<groupId>com.fasterxml.jackson.jr</groupId>
147+
<artifactId>jackson-jr-objects</artifactId>
148+
<version>2.5.0</version>
149+
</dependency>
150+
<dependency>
151+
<groupId>mysql</groupId>
152+
<artifactId>mysql-connector-java</artifactId>
153+
<version>5.1.31</version>
154+
</dependency>
155+
<dependency>
156+
<groupId>junit</groupId>
157+
<artifactId>junit</artifactId>
158+
<version>4.11</version>
159+
<scope>test</scope>
160+
</dependency>
161+
</dependencies>
162+
</project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

bin/src/test/java/SimpleStuff.class

2.66 KB
Binary file not shown.

pom.xml

+1-66
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,4 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
<<<<<<< HEAD
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<groupId>com.krux</groupId>
6-
<artifactId>krux-stdlib</artifactId>
7-
<version>1.6.7</version>
8-
<dependencies>
9-
<dependency>
10-
<groupId>net.sf.jopt-simple</groupId>
11-
<artifactId>jopt-simple</artifactId>
12-
<version>4.8</version>
13-
</dependency>
14-
<dependency>
15-
<groupId>org.slf4j</groupId>
16-
<artifactId>slf4j-api</artifactId>
17-
<version>1.7.7</version>
18-
</dependency>
19-
<dependency>
20-
<groupId>org.apache.commons</groupId>
21-
<artifactId>commons-lang3</artifactId>
22-
<version>3.3.2</version>
23-
</dependency>
24-
<dependency>
25-
<groupId>com.netflix.archaius</groupId>
26-
<artifactId>archaius-core</artifactId>
27-
<version>0.6.3</version>
28-
</dependency>
29-
<dependency>
30-
<groupId>ch.qos.logback</groupId>
31-
<artifactId>logback-classic</artifactId>
32-
<version>1.1.2</version>
33-
</dependency>
34-
<dependency>
35-
<groupId>ch.qos.logback</groupId>
36-
<artifactId>logback-core</artifactId>
37-
<version>1.1.2</version>
38-
</dependency>
39-
<dependency>
40-
<groupId>com.codahale.metrics</groupId>
41-
<artifactId>metrics-core</artifactId>
42-
<version>3.0.2</version>
43-
</dependency>
44-
<dependency>
45-
<groupId>io.netty</groupId>
46-
<artifactId>netty-all</artifactId>
47-
<version>4.0.25.Final</version>
48-
</dependency>
49-
<dependency>
50-
<groupId>com.fasterxml.jackson.jr</groupId>
51-
<artifactId>jackson-jr-objects</artifactId>
52-
<version>2.5.0</version>
53-
</dependency>
54-
<dependency>
55-
<groupId>mysql</groupId>
56-
<artifactId>mysql-connector-java</artifactId>
57-
<version>5.1.31</version>
58-
</dependency>
59-
<dependency>
60-
<groupId>junit</groupId>
61-
<artifactId>junit</artifactId>
62-
<version>4.11</version>
63-
<scope>test</scope>
64-
</dependency>
65-
=======
662
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
673
<modelVersion>4.0.0</modelVersion>
684
<groupId>com.krux</groupId>
@@ -77,7 +13,6 @@
7713
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
7814
<slf4j.version>1.7.7</slf4j.version>
7915
</properties>
80-
>>>>>>> origin/master
8116

8217
<distributionManagement>
8318
<repository>
@@ -105,7 +40,7 @@
10540
<dependency>
10641
<groupId>net.sf.jopt-simple</groupId>
10742
<artifactId>jopt-simple</artifactId>
108-
<version>4.6</version>
43+
<version>4.8</version>
10944
</dependency>
11045
<dependency>
11146
<groupId>org.slf4j</groupId>

0 commit comments

Comments
 (0)