Skip to content

Commit 7b1bc62

Browse files
author
Greg Meyer
authored
Merge pull request #4 from DirectProjectJavaRI/develop
Releasing 8.0.0
2 parents d316bce + d98ab04 commit 7b1bc62

29 files changed

Lines changed: 401 additions & 1053 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
hs_err_pid*
2424
/.classpath
2525
/.project
26+
/target/

pom.xml

Lines changed: 48 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<artifactId>direct-common-audit</artifactId>
66
<name>Direct Project auditing interfaces and implementations</name>
7-
<version>6.0</version>
7+
<version>8.0.0</version>
88
<description>Direct Project auditing interfaces and implementations</description>
99
<inceptionYear>2010</inceptionYear>
1010
<url>http://api.nhindirect.org/x/www/api.nhindirect.org/java/site/direct-common-audit/${project.version}</url>
@@ -35,48 +35,43 @@
3535
<url>http://nhindirect.org/BSDLicense</url>
3636
</license>
3737
</licenses>
38-
<parent>
38+
<parent>
3939
<groupId>org.springframework.boot</groupId>
4040
<artifactId>spring-boot-dependencies</artifactId>
41-
<version>2.1.2.RELEASE</version>
42-
</parent>
41+
<version>2.5.2</version>
42+
<relativePath />
43+
</parent>
44+
<properties>
45+
<commons-collections4.version>4.4</commons-collections4.version>
46+
<commons-io.version>2.8.0</commons-io.version>
47+
</properties>
4348
<dependencies>
4449
<dependency>
4550
<groupId>org.springframework.boot</groupId>
4651
<artifactId>spring-boot-starter</artifactId>
4752
</dependency>
48-
<dependency>
49-
<groupId>org.springframework.boot</groupId>
50-
<artifactId>spring-boot-starter-data-jpa</artifactId>
51-
</dependency>
53+
<dependency>
54+
<groupId>org.springframework.boot</groupId>
55+
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
56+
</dependency>
5257
<dependency>
5358
<groupId>commons-io</groupId>
5459
<artifactId>commons-io</artifactId>
55-
<version>2.6</version>
60+
<version>${commons-io.version}</version>
5661
</dependency>
5762
<dependency>
5863
<groupId>org.apache.commons</groupId>
5964
<artifactId>commons-lang3</artifactId>
6065
</dependency>
6166
<dependency>
62-
<groupId>org.hibernate</groupId>
63-
<artifactId>hibernate-core</artifactId>
64-
</dependency>
65-
<dependency>
66-
<groupId>org.hibernate</groupId>
67-
<artifactId>hibernate-entitymanager</artifactId>
67+
<groupId>org.projectlombok</groupId>
68+
<artifactId>lombok</artifactId>
6869
</dependency>
6970
<dependency>
7071
<groupId>org.apache.commons</groupId>
7172
<artifactId>commons-collections4</artifactId>
72-
<version>4.2</version>
73+
<version>${commons-collections4.version}</version>
7374
</dependency>
74-
<dependency>
75-
<groupId>commons-dbcp</groupId>
76-
<artifactId>commons-dbcp</artifactId>
77-
<version>1.4</version>
78-
<scope>test</scope>
79-
</dependency>
8075
<dependency>
8176
<groupId>org.springframework.boot</groupId>
8277
<artifactId>spring-boot-starter-test</artifactId>
@@ -86,17 +81,12 @@
8681
<groupId>com.h2database</groupId>
8782
<artifactId>h2</artifactId>
8883
<scope>test</scope>
89-
</dependency>
84+
</dependency>
9085
<dependency>
91-
<groupId>junit</groupId>
92-
<artifactId>junit</artifactId>
93-
<scope>test</scope>
94-
</dependency>
95-
<dependency>
96-
<groupId>org.mockito</groupId>
97-
<artifactId>mockito-core</artifactId>
98-
<scope>test</scope>
99-
</dependency>
86+
<groupId>io.r2dbc</groupId>
87+
<artifactId>r2dbc-h2</artifactId>
88+
<scope>test</scope>
89+
</dependency>
10090
</dependencies>
10191
<build>
10292
<extensions>
@@ -142,6 +132,7 @@
142132
<plugin>
143133
<groupId>org.apache.maven.plugins</groupId>
144134
<artifactId>maven-jxr-plugin</artifactId>
135+
<version>3.1.1</version>
145136
</plugin>
146137
<plugin>
147138
<groupId>org.apache.maven.plugins</groupId>
@@ -174,32 +165,27 @@
174165
</execution>
175166
</executions>
176167
</plugin>
177-
<plugin>
178-
<groupId>org.apache.maven.plugins</groupId>
179-
<artifactId>maven-jar-plugin</artifactId>
180-
<configuration>
181-
<archive>
182-
<index>true</index>
183-
</archive>
184-
</configuration>
185-
</plugin>
186-
<plugin>
187-
<groupId>org.apache.maven.plugins</groupId>
188-
<artifactId>maven-jar-plugin</artifactId>
189-
<executions>
190-
<execution>
191-
<goals>
192-
<goal>test-jar</goal>
193-
</goals>
194-
</execution>
195-
</executions>
196-
</plugin>
168+
<plugin>
169+
<groupId>org.apache.maven.plugins</groupId>
170+
<artifactId>maven-jar-plugin</artifactId>
171+
<configuration>
172+
<archive>
173+
<index>true</index>
174+
</archive>
175+
</configuration>
176+
<executions>
177+
<execution>
178+
<goals>
179+
<goal>test-jar</goal>
180+
</goals>
181+
</execution>
182+
</executions>
183+
</plugin>
197184
<plugin>
198185
<groupId>org.apache.maven.plugins</groupId>
199186
<artifactId>maven-javadoc-plugin</artifactId>
200-
<version>2.6.1</version>
201-
<configuration>
202-
<additionalparam>-Xdoclint:none</additionalparam>
187+
<configuration>
188+
<additionalJOption>-Xdoclint:none</additionalJOption>
203189
<charset>UTF-8</charset>
204190
<docencoding>UTF-8</docencoding>
205191
<docfilessubdirs>true</docfilessubdirs>
@@ -217,8 +203,8 @@
217203
</goals>
218204
</execution>
219205
</executions>
220-
</plugin>
221-
<!-- for releases only
206+
</plugin>
207+
<!-- for releases only
222208
<plugin>
223209
<groupId>org.apache.maven.plugins</groupId>
224210
<artifactId>maven-gpg-plugin</artifactId>
@@ -231,23 +217,22 @@
231217
</goals>
232218
</execution>
233219
</executions>
234-
</plugin>
235-
-->
220+
<version>3.0.1</version>
221+
</plugin>
222+
-->
236223
</plugins>
237224
</build>
238225
<reporting>
239226
<plugins>
240227
<plugin>
241228
<groupId>org.apache.maven.plugins</groupId>
242229
<artifactId>maven-project-info-reports-plugin</artifactId>
243-
<version>2.9</version>
244230
</plugin>
245231
<plugin>
246232
<groupId>org.apache.maven.plugins</groupId>
247233
<artifactId>maven-javadoc-plugin</artifactId>
248-
<version>2.6.1</version>
249234
<configuration>
250-
<additionalparam>-Xdoclint:none</additionalparam>
235+
<additionalJOption>-Xdoclint:none</additionalJOption>
251236
<charset>UTF-8</charset>
252237
<docencoding>UTF-8</docencoding>
253238
<docfilessubdirs>true</docfilessubdirs>
@@ -271,11 +256,11 @@
271256
<plugin>
272257
<groupId>org.apache.maven.plugins</groupId>
273258
<artifactId>maven-jxr-plugin</artifactId>
259+
<version>3.1.1</version>
274260
</plugin>
275261
<plugin>
276262
<groupId>org.codehaus.mojo</groupId>
277263
<artifactId>findbugs-maven-plugin</artifactId>
278-
<version>2.3.2</version>
279264
<configuration>
280265
<effort>Max</effort>
281266
<excludeFilterFile>${project.basedir}/src/report/findbugs-exclude.xml</excludeFilterFile>

src/main/java/org/nhindirect/common/audit/AbstractAuditor.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2626
import java.util.Collection;
2727
import java.util.UUID;
2828

29-
import org.nhindirect.common.audit.AuditContext;
30-
import org.nhindirect.common.audit.AuditEvent;
31-
import org.nhindirect.common.audit.Auditor;
32-
3329
/**
3430
* Abstract base class {@link Auditor} that performs trivial sanity checks such as parameter validation. All calls are delegated to
3531
* {@link #writeEvent(String, Calendar, String, String, Collection) which is implemented by a concrete sub class to commit the event to the

src/main/java/org/nhindirect/common/audit/AuditEvent.java

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,82 +21,37 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2121

2222
package org.nhindirect.common.audit;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
26+
import lombok.Data;
27+
import lombok.NonNull;
28+
2429
/**
2530
* A high level descriptor of an auditable event. Attributes include a name which describes a high level "category" of the event and a type that further
2631
* qualifies that the event.
2732
* @author Greg Meyer
2833
* @since 1.0
2934
*/
35+
@Data
3036
public class AuditEvent
3137
{
38+
@NonNull
3239
private final String name;
33-
private final String type;
3440

41+
@NonNull
42+
private final String type;
43+
3544
/**
3645
* Constructs an audit event from a name and type.
3746
* @param name The generic name or "category" of the event. Cannot be null or empty.
3847
* @param type A type that further describes the category. Cannot be null or empty.
3948
*/
4049
public AuditEvent(String name, String type)
4150
{
42-
if (name == null || name.isEmpty())
51+
if (StringUtils.isEmpty(name) || StringUtils.isEmpty(type))
4352
throw new IllegalArgumentException();
44-
45-
if (type == null || type.isEmpty())
46-
throw new IllegalArgumentException();
47-
53+
4854
this.name = name;
4955
this.type = type;
5056
}
51-
52-
/**
53-
* Gets the name of the event.
54-
* @return The name of the event
55-
*/
56-
public String getName()
57-
{
58-
return name;
59-
}
60-
61-
/**
62-
* Gets the type of the event.
63-
* @return The type of the event
64-
*/
65-
public String getType()
66-
{
67-
return type;
68-
}
69-
70-
/**
71-
* {@inheritDoc}
72-
*/
73-
@Override
74-
public String toString()
75-
{
76-
StringBuilder builder = new StringBuilder("EventName: ");
77-
builder.append(name).append("\r\nEvent Type: ").append(type);
78-
79-
return builder.toString();
80-
}
81-
82-
/**
83-
* {@inheritDoc}
84-
*/
85-
@Override
86-
public int hashCode()
87-
{
88-
return toString().hashCode();
89-
}
90-
91-
/**
92-
* {@inheritDoc}
93-
*/
94-
@Override
95-
public boolean equals(Object obj)
96-
{
97-
if (obj == null || !(obj instanceof AuditEvent))
98-
return false;
99-
100-
return obj.hashCode() == hashCode();
101-
}
10257
}

src/main/java/org/nhindirect/common/audit/DefaultAuditContext.java

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,57 +21,37 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2121

2222
package org.nhindirect.common.audit;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
26+
import lombok.Data;
27+
import lombok.NonNull;
28+
2429
/**
2530
* Default implementation of the {@link AuditContext} interface that takes a simple name/value pair.
2631
* @author Greg Meyer
2732
* @since 1.0
2833
*/
34+
@Data
2935
public class DefaultAuditContext implements AuditContext
3036
{
31-
private final String name;
32-
private final String value;
37+
@NonNull
38+
private final String contextName;
3339

40+
@NonNull
41+
private final String contextValue;
42+
3443
/**
3544
* Constructs an context with a simple name and value.
3645
* @param name The name of the context.
3746
* @param value The string based value of the context.
3847
*/
3948
public DefaultAuditContext(String name, String value)
4049
{
41-
if (name == null || name.isEmpty())
42-
throw new IllegalArgumentException("Name cannot be null or empty.");
43-
44-
if (value == null)
45-
throw new IllegalArgumentException("Name cannot be null");
46-
47-
this.name = name;
48-
this.value = value;
49-
}
5050

51-
/**
52-
* {@inheritDoc}
53-
*/
54-
@Override
55-
public String getContextName()
56-
{
57-
return name;
58-
}
59-
60-
/**
61-
* {@inheritDoc}
62-
*/
63-
@Override
64-
public String getContextValue()
65-
{
66-
return value;
67-
}
68-
69-
/**
70-
* {@inheritDoc}
71-
*/
72-
@Override
73-
public String toString()
74-
{
75-
return name + ":" + value;
51+
if (StringUtils.isEmpty(name) || value == null)
52+
throw new IllegalArgumentException();
53+
54+
this.contextName = name;
55+
this.contextValue = value;
7656
}
7757
}

0 commit comments

Comments
 (0)