added docs; maven central prep; removed CXF/Jersey

This commit is contained in:
Brian Long 2022-10-03 09:57:08 -04:00
parent ef89e478cb
commit f93e201329
17 changed files with 231 additions and 295 deletions

163
pom.xml
View File

@ -2,21 +2,45 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.inteligr8.alfresco</groupId>
<artifactId>aps-public-rest-api</artifactId>
<version>2.0-SNAPSHOT</version>
<name>Alfresco Process Services ReST API for Java</name>
<description>An APS API library for building REST API clients that support both the CXF and Jersey frameworks</description>
<url>https://bitbucket.org/inteligr8/aps-public-rest-api</url>
<licenses>
<license>
<name>GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git:https://bitbucket.org/inteligr8/aps-public-rest-api.git</connection>
<developerConnection>scm:git:git@bitbucket.org:inteligr8/aps-public-rest-api.git</developerConnection>
<url>https://bitbucket.org/inteligr8/aps-public-rest-api</url>
</scm>
<organization>
<name>Inteligr8</name>
<url>https://www.inteligr8.com</url>
</organization>
<developers>
<developer>
<id>brian.long</id>
<name>Brian Long</name>
<email>brian@inteligr8.com</email>
<url>https://twitter.com/brianmlong</url>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.debuglevel>lines,vars,source</maven.compiler.debuglevel>
<aps.app.tag>aps1</aps.app.tag>
<jersey.version>2.35</jersey.version>
<cxf.version>3.4.7</cxf.version>
</properties>
<dependencies>
@ -30,44 +54,7 @@
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.12.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classifier>${aps.app.tag}</classifier>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>javadoc</id>
<phase>package</phase>
<goals><goal>jar</goal></goals>
<configuration>
<show>public</show>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- Implement when descriptor is available -->
@ -199,42 +186,74 @@
</plugins>
</build>
</profile>
<profile>
<id>ossrh-release</id>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>source</id>
<phase>package</phase>
<goals><goal>jar-no-fork</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>javadoc</id>
<phase>package</phase>
<goals><goal>jar</goal></goals>
<configuration>
<show>public</show>
<additionalJOption>-Xdoclint:none</additionalJOption>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign</id>
<phase>verify</phase>
<goals><goal>sign</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
<executions>
<execution>
<id>ossrh-deploy</id>
<phase>deploy</phase>
<goals><goal>deploy</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>inteligr8-releases</id>
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>inteligr8-snapshots</id>
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-releases</id>
<url>https://repository.mulesoft.org/releases</url>
</pluginRepository>
<pluginRepository>
<id>inteligr8-public</id>
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>inteligr8-releases</id>
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-public</url>
</repository>
<snapshotRepository>
<id>inteligr8-snapshots</id>
<url>https://repos.inteligr8.com/nexus/repository/inteligr8-snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>

View File

@ -1,3 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti;
import com.inteligr8.alfresco.activiti.api.AdminApi;

View File

@ -1,18 +0,0 @@
package com.inteligr8.alfresco.activiti;
import com.inteligr8.alfresco.activiti.api.AppDefinitionsCxfApi;
/**
* This interface appends Apache CXF implementation specific methods to the
* JAX-RS API of the APS Public ReST API. This is due to a lack of multi-part
* in the JAX-RS specification.
*
* @author brian@inteligr8.com
*/
public interface ApsPublicRestCxfApi extends ApsPublicRestApi {
default AppDefinitionsCxfApi getAppDefinitionsCxfApi() {
return this.getApi(AppDefinitionsCxfApi.class);
}
}

View File

@ -1,18 +0,0 @@
package com.inteligr8.alfresco.activiti;
import com.inteligr8.alfresco.activiti.api.AppDefinitionsJerseyApi;
/**
* This interface appends Jersey implementation specific methods to the JAX-RS
* API of the APS Public ReST API. This is due to a lack of multi-part in the
* JAX-RS specification.
*
* @author brian@inteligr8.com
*/
public interface ApsPublicRestJerseyApi extends ApsPublicRestApi {
default AppDefinitionsJerseyApi getAppDefinitionsJerseyApi() {
return this.getApi(AppDefinitionsJerseyApi.class);
}
}

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import java.util.List;

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import java.io.File;

View File

@ -1,51 +0,0 @@
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import com.inteligr8.alfresco.activiti.model.AppDefinitionRepresentation;
import com.inteligr8.alfresco.activiti.model.AppDefinitionUpdateResultRepresentation;
import com.inteligr8.alfresco.activiti.model.FileMultipartCxf;
@Path("/api/enterprise/app-definitions")
public interface AppDefinitionsCxfApi {
@POST
@Path("import")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionRepresentation import_(
FileMultipartCxf body,
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
@POST
@Path("{modelId}/import")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionRepresentation import_(
@PathParam("modelId") Long appId,
FileMultipartCxf body,
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
@POST
@Path("publish-app")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionUpdateResultRepresentation publishApp(
FileMultipartCxf body);
@POST
@Path("{modelId}/publish-app")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionUpdateResultRepresentation publishApp(
@PathParam("modelId") Long appId,
FileMultipartCxf body);
}

View File

@ -1,51 +0,0 @@
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import com.inteligr8.alfresco.activiti.model.AppDefinitionRepresentation;
import com.inteligr8.alfresco.activiti.model.AppDefinitionUpdateResultRepresentation;
import com.inteligr8.alfresco.activiti.model.FileMultipartJersey;
@Path("/api/enterprise/app-definitions")
public interface AppDefinitionsJerseyApi {
@POST
@Path("import")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionRepresentation importApp(
FileMultipartJersey file,
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
@POST
@Path("{modelId}/import")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionRepresentation importApp(
@PathParam("modelId") Long appId,
FileMultipartJersey file,
@QueryParam("renewIdmEntries") Boolean renewIdmEntries);
@POST
@Path("publish-app")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionUpdateResultRepresentation publishApp(
FileMultipartJersey file);
@POST
@Path("{modelId}/publish-app")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@Produces({ MediaType.APPLICATION_JSON })
AppDefinitionUpdateResultRepresentation publishApp(
@PathParam("modelId") Long appId,
FileMultipartJersey file);
}

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.GET;

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.GET;

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.GET;

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import java.util.List;

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.GET;

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import javax.ws.rs.Consumes;

View File

@ -1,4 +1,17 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti.api;
import java.util.List;

View File

@ -1,38 +0,0 @@
package com.inteligr8.alfresco.activiti.model;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.ContentDisposition;
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
public class FileMultipartCxf extends MultipartBody {
public static FileMultipartCxf from(String filename, InputStream istream) throws IOException {
return new FileMultipartCxf(Arrays.asList(toAttachment(filename, istream)));
}
public FileMultipartCxf(List<Attachment> atts) throws IOException {
super(atts);
}
public FileMultipartCxf(List<Attachment> atts, boolean outbound) {
super(atts, outbound);
}
public Attachment getFileAttachment() {
return this.getAttachment("file");
}
private static Attachment toAttachment(String filename, InputStream istream) {
if (filename == null) {
return new Attachment("file", istream, new ContentDisposition("form-data; name=\"file\""));
} else {
return new Attachment("file", istream, new ContentDisposition("form-data; name=\"file\"; filename=\"" + filename + "\""));
}
}
}

View File

@ -1,38 +0,0 @@
package com.inteligr8.alfresco.activiti.model;
import java.io.InputStream;
import java.text.ParseException;
import org.glassfish.jersey.media.multipart.BodyPart;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
public class FileMultipartJersey extends FormDataMultiPart {
public static FileMultipartJersey from(String filename, InputStream istream) throws ParseException {
FileMultipartJersey multipart = new FileMultipartJersey();
multipart.bodyPart(toBodyPart(filename, istream));
return multipart;
}
private FileMultipartJersey() {
}
public FormDataBodyPart getFileAttachment() {
return this.getField("file");
}
private static BodyPart toBodyPart(String filename, InputStream istream) throws ParseException {
if (filename == null) {
return new FormDataBodyPart()
.contentDisposition(new FormDataContentDisposition("form-data; name=\"file\""))
.entity(istream);
} else {
return new FormDataBodyPart()
.contentDisposition(new FormDataContentDisposition("form-data; name=\"file\"; filename=\"" + filename + "\""))
.entity(istream);
}
}
}