Skip to content

Commit

Permalink
Refactor to include new package and pom structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip Kruger committed Jun 17, 2017
1 parent 77463b6 commit 232f07f
Show file tree
Hide file tree
Showing 38 changed files with 459 additions and 106 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
/apiee-core/target/
/apiee-example/target/
/target/
13 changes: 13 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,13 @@
Copyright 2017 Phillip Kruger

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.
2 changes: 1 addition & 1 deletion README.md
@@ -1,3 +1,3 @@
![logo](https://github.com/phillip-kruger/apiee/blob/master/src/main/webapp/logo.png?raw=true)
![logo](https://github.com/phillip-kruger/apiee-core/blob/master/src/main/webapp/logo.png?raw=true)
# Apiee
A library to generate openAPI (swagger) documentation in Java EE projects
19 changes: 19 additions & 0 deletions apiee-core/nbactions.xml
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>CUSTOM-release</actionName>
<displayName>release</displayName>
<goals>
<goal>clean</goal>
<goal>deploy</goal>
<goal>nexus-staging:release</goal>
</goals>
</action>
<action>
<actionName>CUSTOM-drop</actionName>
<displayName>drop</displayName>
<goals>
<goal>nexus-staging:drop</goal>
</goals>
</action>
</actions>
100 changes: 100 additions & 0 deletions apiee-core/pom.xml
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.github.phillip-kruger</groupId>
<artifactId>apiee</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>

<artifactId>apiee-core</artifactId>
<packaging>jar</packaging>

<name>apiee-core</name>
<description>A library to add generated swagger doc to your Java EE systems</description>

<properties>
<swagger.ui.version>2.2.10</swagger.ui.version>
<swagger.ui.themes.version>2.1.0</swagger.ui.themes.version>
<font.awesome.version>4.7.0</font.awesome.version>
<swagger.annotations.version>1.5.13</swagger.annotations.version>
<swagger.parser.version>1.0.28</swagger.parser.version>
</properties>

<dependencies>
<!-- Swagger UI -->
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>swagger-ui</artifactId>
<version>${swagger.ui.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>swagger-ui-themes</artifactId>
<version>${swagger.ui.themes.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>${font.awesome.version}</version>
<scope>runtime</scope>
</dependency>

<!-- Swagger - For Endpoint documentation -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.annotations.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>${swagger.annotations.version}</version>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-parser</artifactId>
<version>${swagger.parser.version}</version>
</dependency>
</dependencies>

<build>

<!-- Copy all web content files META-INF folder, and push it though a filter to replace maven properties -->
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<targetPath>${project.build.directory}/classes/META-INF/resources</targetPath>
<filtering>true</filtering>
<includes>
<include>**/*.css</include>
<include>**/*.html</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<targetPath>${project.build.directory}/classes/META-INF/resources</targetPath>
<filtering>false</filtering>
<excludes>
<exclude>**/*.css</exclude>
<exclude>**/*.html</exclude>
</excludes>
</resource>
</resources>

</build>

</project>
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee;
package com.github.phillipkruger.apiee;

import io.swagger.annotations.SwaggerDefinition;
import javax.ws.rs.ApplicationPath;
Expand All @@ -7,7 +7,7 @@

/**
* Enable REST
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@SwaggerDefinition(basePath = "/api")
@ApplicationPath("/api")
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee;
package com.github.phillipkruger.apiee;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
Expand All @@ -24,7 +24,7 @@
* This service creates a swagger document and enhance it with some context
* (Mostly making it relative to the URL)
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
* @see http://swagger.io/specification/
* @see http://stackoverflow.com/questions/20937362/what-objects-can-i-inject-using-the-context-annotation
*/
Expand All @@ -34,10 +34,10 @@
@SwaggerDefinition (info = @Info (
title = "Apiee",
description = "OpenAPI for Java EE",
version = "1.0-SNAPSHOT",
version = "1.0-0-SNAPSHOT",
contact = @Contact (
name = "Phillip Kruger",
email = "phillip.kruger@gmail.com",
email = "apiee@phillip-kruger.com",
url = "https://github.com/phillip-kruger/apiee"
)
)
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee;
package com.github.phillipkruger.apiee;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
Expand All @@ -10,7 +10,7 @@

/**
* Ping service for all REST services (to check that REST has been activated)
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Path("/ping")
@Api(value = "Available check")
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee;
package com.github.phillipkruger.apiee;

import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.jaxrs.Reader;
Expand All @@ -17,7 +17,7 @@

/**
* Caching already created swagger docs.
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
* @see http://swagger.io/specification/
*/
@Log
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import javax.ejb.EJBException;
import javax.ws.rs.WebApplicationException;
Expand All @@ -10,7 +10,7 @@

/**
* Get the cause of a EJB Exception
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Provider
public class EJBExceptionMapper implements ExceptionMapper<EJBException> {
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import javax.persistence.EntityNotFoundException;
import javax.ws.rs.Produces;
Expand All @@ -9,7 +9,7 @@

/**
* Translate Java entity not found exceptions to HTTP response
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Provider
public class EntityNotFoundExceptionMapper implements ExceptionMapper<EntityNotFoundException> {
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
Expand All @@ -8,7 +8,7 @@

/**
* Translate Java illegal argument exceptions to HTTP response
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Provider
public class IllegalArgumentExceptionMapper implements ExceptionMapper<IllegalArgumentException> {
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import javax.persistence.NonUniqueResultException;
import javax.ws.rs.Produces;
Expand All @@ -9,7 +9,7 @@

/**
* Translate Java non unique exceptions to HTTP response
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Provider
public class NonUniqueResultExceptionMapper implements ExceptionMapper<NonUniqueResultException> {
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import javax.ejb.AccessLocalException;
import javax.ws.rs.Produces;
Expand All @@ -9,7 +9,7 @@

/**
* Translate Java entity not found exceptions to HTTP response
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Provider
public class NotAuthorizedExceptionMapper implements ExceptionMapper<AccessLocalException> {
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
Expand All @@ -8,7 +8,7 @@

/**
* Translate Java null pointer exceptions to HTTP response
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
* TODO: Should this rather do a 204 ?? (No content)
*/
@Provider
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
Expand All @@ -12,7 +12,7 @@

/**
* Simple POJO that defines a Error
* @author Phillip Kruger (phillip.kruger@momentum.co.za)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Data
@AllArgsConstructor @NoArgsConstructor
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -12,7 +12,7 @@
import lombok.NoArgsConstructor;
/**
* Simple POJO that defines a list of errors
* @author Phillip Kruger (phillip.kruger@momentum.co.za)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Data
@XmlRootElement
Expand Down
@@ -1,4 +1,4 @@
package com.phillipkruger.library.apiee.mapper;
package com.github.phillipkruger.apiee.mapper;

import java.util.Iterator;
import java.util.Set;
Expand All @@ -12,7 +12,7 @@

/**
* Translate Java validation exceptions to HTTP response
* @author Phillip Kruger (phillip.kruger@gmail.com)
* @author Phillip Kruger (apiee@phillip-kruger.com)
*/
@Provider
public class ValidationExceptionMapper implements ExceptionMapper<ConstraintViolationException> {
Expand Down
File renamed without changes.
Binary file added apiee-core/src/main/webapp/favicon-16x16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apiee-core/src/main/webapp/favicon-16x16.xcf
Binary file not shown.
Binary file added apiee-core/src/main/webapp/favicon-32x32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apiee-core/src/main/webapp/favicon-32x32.xcf
Binary file not shown.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
18 changes: 18 additions & 0 deletions apiee-example/nb-configuration.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
</properties>
</project-shared-configuration>

0 comments on commit 232f07f

Please sign in to comment.