Skip to content

Commit bf448ac

Browse files
committed
Stackify Logging API
1 parent 469edc8 commit bf448ac

37 files changed

Lines changed: 2427 additions & 1385 deletions

pom.xml

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@
5151
<dependency>
5252
<groupId>com.stackify</groupId>
5353
<artifactId>stackify-api</artifactId>
54-
<version>1.0.2</version>
54+
<version>1.0.3-SNAPSHOT</version>
5555
</dependency>
5656

5757
<dependency>
5858
<groupId>com.google.guava</groupId>
5959
<artifactId>guava</artifactId>
6060
<version>15.0</version>
6161
</dependency>
62-
62+
6363
<dependency>
64-
<groupId>org.slf4j</groupId>
65-
<artifactId>slf4j-api</artifactId>
66-
<version>1.7.5</version>
67-
</dependency>
68-
64+
<groupId>org.slf4j</groupId>
65+
<artifactId>slf4j-api</artifactId>
66+
<version>1.7.5</version>
67+
</dependency>
68+
6969
<!-- Runtime dependencies -->
7070

7171
<!-- Test dependencies -->
@@ -185,6 +185,59 @@
185185

186186
</build>
187187

188+
<reporting>
189+
190+
<plugins>
191+
192+
<plugin>
193+
<groupId>org.apache.maven.plugins</groupId>
194+
<artifactId>maven-jxr-plugin</artifactId>
195+
<version>2.3</version>
196+
</plugin>
197+
198+
<plugin>
199+
<groupId>org.apache.maven.plugins</groupId>
200+
<artifactId>maven-javadoc-plugin</artifactId>
201+
<version>2.9.1</version>
202+
</plugin>
203+
204+
<plugin>
205+
<groupId>org.apache.maven.plugins</groupId>
206+
<artifactId>maven-surefire-report-plugin</artifactId>
207+
<version>2.17</version>
208+
</plugin>
209+
210+
<plugin>
211+
<groupId>org.codehaus.mojo</groupId>
212+
<artifactId>cobertura-maven-plugin</artifactId>
213+
<version>2.6</version>
214+
<configuration>
215+
<formats>
216+
<format>html</format>
217+
<format>xml</format>
218+
</formats>
219+
</configuration>
220+
</plugin>
221+
222+
<plugin>
223+
<groupId>org.apache.maven.plugins</groupId>
224+
<artifactId>maven-pmd-plugin</artifactId>
225+
<version>3.1</version>
226+
<configuration>
227+
<targetJdk>${java.version}</targetJdk>
228+
</configuration>
229+
</plugin>
230+
231+
<plugin>
232+
<groupId>org.codehaus.mojo</groupId>
233+
<artifactId>jdepend-maven-plugin</artifactId>
234+
<version>2.0</version>
235+
</plugin>
236+
237+
</plugins>
238+
239+
</reporting>
240+
188241
<profiles>
189242
<profile>
190243
<id>release-sign-artifacts</id>

src/main/java/com/stackify/api/common/ApiClients.java

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
/*
2+
* Copyright 2014 Stackify
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.stackify.api.common;
17+
18+
import com.stackify.api.EnvironmentDetail;
19+
import com.google.common.base.Objects;
20+
21+
/**
22+
* ApiConfiguration
23+
* @author Eric Martin
24+
*/
25+
public class ApiConfiguration {
26+
27+
/**
28+
* Default API URL
29+
*/
30+
private static final String DEFAULT_API_URL = "https://api.stackify.com";
31+
32+
/**
33+
* API URL
34+
*/
35+
private final String apiUrl;
36+
37+
/**
38+
* API Key
39+
*/
40+
private final String apiKey;
41+
42+
/**
43+
* Application name
44+
*/
45+
private final String application;
46+
47+
/**
48+
* Environment
49+
*/
50+
private final String environment;
51+
52+
/**
53+
* Environment details
54+
*/
55+
private final EnvironmentDetail envDetail;
56+
57+
/**
58+
* @return the apiUrl
59+
*/
60+
public String getApiUrl() {
61+
return apiUrl != null ? apiUrl : DEFAULT_API_URL;
62+
}
63+
64+
/**
65+
* @return the apiKey
66+
*/
67+
public String getApiKey() {
68+
return apiKey;
69+
}
70+
71+
/**
72+
* @return the application
73+
*/
74+
public String getApplication() {
75+
return application;
76+
}
77+
78+
/**
79+
* @return the environment
80+
*/
81+
public String getEnvironment() {
82+
return environment;
83+
}
84+
85+
/**
86+
* @return the envDetail
87+
*/
88+
public EnvironmentDetail getEnvDetail() {
89+
return envDetail;
90+
}
91+
92+
/**
93+
* @param builder The Builder object that contains all of the values for initialization
94+
*/
95+
private ApiConfiguration(final Builder builder) {
96+
this.apiUrl = builder.apiUrl;
97+
this.apiKey = builder.apiKey;
98+
this.application = builder.application;
99+
this.environment = builder.environment;
100+
this.envDetail = builder.envDetail;
101+
}
102+
103+
/**
104+
* @return A new instance of the Builder
105+
*/
106+
public static Builder newBuilder() {
107+
return new Builder();
108+
}
109+
110+
/**
111+
* ApiConfiguration.Builder separates the construction of a ApiConfiguration from its representation
112+
*/
113+
public static class Builder {
114+
115+
/**
116+
* The builder's apiUrl
117+
*/
118+
private String apiUrl;
119+
120+
/**
121+
* The builder's apiKey
122+
*/
123+
private String apiKey;
124+
125+
/**
126+
* The builder's application
127+
*/
128+
private String application;
129+
130+
/**
131+
* The builder's environment
132+
*/
133+
private String environment;
134+
135+
/**
136+
* The builder's envDetail
137+
*/
138+
private EnvironmentDetail envDetail;
139+
140+
/**
141+
* Sets the builder's apiUrl
142+
* @param apiUrl The apiUrl to be set
143+
* @return Reference to the current object
144+
*/
145+
public Builder apiUrl(final String apiUrl) {
146+
this.apiUrl = apiUrl;
147+
return this;
148+
}
149+
150+
/**
151+
* Sets the builder's apiKey
152+
* @param apiKey The apiKey to be set
153+
* @return Reference to the current object
154+
*/
155+
public Builder apiKey(final String apiKey) {
156+
this.apiKey = apiKey;
157+
return this;
158+
}
159+
160+
/**
161+
* Sets the builder's application
162+
* @param application The application to be set
163+
* @return Reference to the current object
164+
*/
165+
public Builder application(final String application) {
166+
this.application = application;
167+
return this;
168+
}
169+
170+
/**
171+
* Sets the builder's environment
172+
* @param environment The environment to be set
173+
* @return Reference to the current object
174+
*/
175+
public Builder environment(final String environment) {
176+
this.environment = environment;
177+
return this;
178+
}
179+
180+
/**
181+
* Sets the builder's envDetail
182+
* @param envDetail The envDetail to be set
183+
* @return Reference to the current object
184+
*/
185+
public Builder envDetail(final EnvironmentDetail envDetail) {
186+
this.envDetail = envDetail;
187+
return this;
188+
}
189+
190+
/**
191+
* @return A new object constructed from this builder
192+
*/
193+
public ApiConfiguration build() {
194+
return new ApiConfiguration(this);
195+
}
196+
}
197+
198+
/**
199+
* @see java.lang.Object#toString()
200+
* @return A string representation of the object
201+
*/
202+
@Override
203+
public String toString() {
204+
return Objects.toStringHelper(this)
205+
.omitNullValues()
206+
.add("apiUrl", apiUrl)
207+
.add("apiKey", apiKey)
208+
.add("application", application)
209+
.add("environment", environment)
210+
.add("envDetail", envDetail)
211+
.toString();
212+
}
213+
}

0 commit comments

Comments
 (0)