Skip to content

Commit

Permalink
Began api split
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcin committed Apr 19, 2020
1 parent b5e5995 commit 6903801
Show file tree
Hide file tree
Showing 168 changed files with 1,390 additions and 917 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)

## [Unreleased]

### Changed

- API extracted for tighter dependency control

## [1.5.2] - 2020-04-15

### Added
- #38 modified pom to upload cli dist binaries to releases.
- #39 add --no-hooks cli option

### Fixed
- #50 Provide CLI dist with Windows binary launcher
- ExpectAces ACE criteria now correctly trims around parameter names
- #51 copied InstallHookPolicy details to scan goal doc
- #35 copied InstallHookPolicy details to scan goal doc
- #37 switched to jar checksums for opear cache folder names.

## [1.5.1] - 2019-10-03
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ OakPAL was designed to fill this gap, by providing:
2. An OakMachine class with a fluent Builder API that encapsulates the creation of a fresh Oak
repository, state initialization, and package installation for every set of package files.

3. A pluggable listener API with classpath discovery of third-party [Checklists](https://github.com/adamcin/oakpal/blob/master/core/src/main/resources/OAKPAL-INF/checklists/basic.json),
[ProgressChecks](oakpal-core/apidocs/net/adamcin/oakpal/core/ProgressCheck.html), and [ScriptProgressChecks](oakpal-maven-plugin/writing-a-script-check.html),
3. A pluggable listener API with classpath discovery of third-party [Checklists](https://github.com/adamcin/oakpal/blob/master/checks/src/main/resources/OAKPAL-INF/checklists/basic.json),
[ProgressChecks](net.adamcin.oakpal.api/apidocs/net/adamcin/oakpal/api/ProgressCheck.html), and [ScriptProgressChecks](oakpal-maven-plugin/writing-a-script-check.html),
which receive progress tracker events along with read-only access to incremental repository state, and which can report Violations at the end of a scan.


Expand Down
4 changes: 4 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# net.adamcin.oakpal.api

This is the API dependency for use by progress check implementers.

176 changes: 176 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2018 Mark Adamcin
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>oakpal</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<artifactId>oakpal-api</artifactId>
<packaging>jar</packaging>

<name>OakPAL - API bundle</name>
<description>OakPAL API bundle</description>

<inceptionYear>2017</inceptionYear>

<scm>
<url>https://github.com/adamcin/oakpal</url>
<developerConnection>scm:git:git@github.com:adamcin/oakpal.git</developerConnection>
<connection>scm:git://github.com/adamcin/oakpal.git</connection>
<tag>HEAD</tag>
</scm>

<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>false</filtering>
</testResource>
<testResource>
<directory>src/test/filtered-resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-test-packages</id>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
<configuration>
<bnd><![CDATA[
Bundle-SymbolicName: net.adamcin.oakpal.api
Automatic-Module-Name: net.adamcin.oakpal.api
Export-Package: net.adamcin.oakpal.api
Import-Package: *
]]></bnd>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-baseline-maven-plugin</artifactId>
<executions>
<execution>
<id>baseline</id>
<goals>
<goal>baseline</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit.vault</groupId>
<artifactId>org.apache.jackrabbit.vault</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-commons</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.johnzon</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>oakpal-testing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Mark Adamcin
* Copyright 2020 Mark Adamcin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package net.adamcin.oakpal.core;
package net.adamcin.oakpal.api;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Mark Adamcin
* Copyright 2020 Mark Adamcin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package net.adamcin.oakpal.core;
package net.adamcin.oakpal.api;


import org.apache.jackrabbit.util.ISO8601;
Expand Down Expand Up @@ -49,7 +49,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static net.adamcin.oakpal.core.Fun.compose;
import static net.adamcin.oakpal.api.Fun.compose;

/**
* Simple DSL for constructing javax.json objects for {@link ProgressCheckFactory} configs using only three-letter identifiers.
Expand All @@ -63,42 +63,48 @@ private JavaxJson() {

/**
* To keep things simple and concise, the JSON CND format does not need to serialize null values, empty arrays, or
* empty objects. This method should be used as a filtering predicate when mapping {@link JsonCnd.DefinitionToken} values to
* empty objects. This method should be used as a filtering predicate when mapping {@code JsonCnd.DefinitionToken} values to
* the JSON stream.
*
* @param value the JsonValue to test
* @return true if not null or empty
*/
static boolean nonEmptyValue(final @Nullable JsonValue value) {
public static boolean nonEmptyValue(final @Nullable JsonValue value) {
return !(value == null
|| value.getValueType() == JsonValue.ValueType.NULL
|| (value.getValueType() == JsonValue.ValueType.ARRAY && value.asJsonArray().isEmpty())
|| (value.getValueType() == JsonValue.ValueType.OBJECT && value.asJsonObject().isEmpty()));
}

/**
* Return true if the value is not equal to the provided default value.
*
* @param value the JsonValue to test
* @param defaultValue the default JsonValue to test against
* @return true if provided value is not equal to the provided default value
*/
static boolean nonDefaultValue(final @Nullable JsonValue value, final @NotNull JsonValue defaultValue) {
public static boolean nonDefaultValue(final @Nullable JsonValue value, final @NotNull JsonValue defaultValue) {
return !defaultValue.equals(value);
}

/**
* Custom pojo types which should be usable within this DSL should implement this method to provide a
* {@link JsonObject}, which can be wrapped quickly by {@link #val(Object)}.
*
* @deprecated 1.5.0 use {@link JsonObjectConvertible} instead
*/
public interface ObjectConvertible {
JsonObject toJson();
@Deprecated
public interface ObjectConvertible extends JsonObjectConvertible {
}

/**
* Custom pojo types which should be usable within this DSL should implement this method to provide a
* {@link JsonArray}, which can be wrapped quickly by {@link #val(Object)}.
*
* @deprecated 1.5.0 use {@link JsonArrayConvertible} instead
*/
public interface ArrayConvertible {
JsonArray toJson();
@Deprecated
public interface ArrayConvertible extends JsonArrayConvertible {
}

/**
Expand Down Expand Up @@ -139,10 +145,10 @@ public static JsonValue wrap(final Object object) {
return (JsonValue) object;
} else if (object instanceof HasValue) {
return ((HasValue) object).toValue().get();
} else if (object instanceof ObjectConvertible) {
return ((ObjectConvertible) object).toJson();
} else if (object instanceof ArrayConvertible) {
return ((ArrayConvertible) object).toJson();
} else if (object instanceof JsonObjectConvertible) {
return ((JsonObjectConvertible) object).toJson();
} else if (object instanceof JsonArrayConvertible) {
return ((JsonArrayConvertible) object).toJson();
} else if (object instanceof String) {
return Json.createArrayBuilder().add((String) object).build().get(0);
} else if (object instanceof Calendar) {
Expand Down
27 changes: 27 additions & 0 deletions api/src/main/java/net/adamcin/oakpal/api/JsonArrayConvertible.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2019 Mark Adamcin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.adamcin.oakpal.api;

import javax.json.JsonArray;

/**
* Custom pojo types which should be usable within the JavaxJson DSL should implement this method to provide a
* {@link JsonArray}, which can be wrapped quickly by {@code JavaxJson.val(Object)}.
*/
public interface JsonArrayConvertible {
JsonArray toJson();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2019 Mark Adamcin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.adamcin.oakpal.api;

import javax.json.JsonObject;

/**
* Custom pojo types which should be usable within the JavaxJson DSL should implement this method to provide a
* {@link JsonObject}, which can be wrapped quickly by {@code JavaxJson.val(Object)}.
*/
public interface JsonObjectConvertible {
JsonObject toJson();
}
Loading

0 comments on commit 6903801

Please sign in to comment.