Skip to content

Keycloak dev #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 27 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,23 @@
* [How it works](#how-it-works)
* [Technologies](#technologies)

##What it is
This project contains the BDK (beacon development kit) for Java (EE) developers. The BDK provides all of the tools required to create a basic rest implementation for a beacon almost straight out of the box with only minimal set up required.
Users can extend the BDK to make it fit within their own project, or use it as is defining their own adapter to retrieve data from their preferred data source.

##System requirements
All you need to build this project is Java 8.0 (Java SDK 1.8) or later, Maven 3.0 or later. Since the project is Java EE based, an application server with support for Java EE 7 is needed to deploy the application (e.g. JBoss EAP or WildFly).

##Modules
1. [beacon-java-core](/beacon-java-core)
Contains core classes and functions shared across modules in the BJDK.
2. [beacon-java-rest](/beacon-java-rest)
Rest implementation of a beacon, configured to run on a JBOSS server.
3. [sample-beacon-adapter](/sample-beacon-adapter)
Sample beacon adapter implementation

## Beacon Specification
The BDK implements the beacon specification and relies on the data models generated by the beacon schema. At the moment the dependency is not currently listed on maven central but can be retrived from the [beacon teams git hub repository](https://github.com/ga4gh/beacon-team).

To retrieve the dependency:

```
git clone https://github.com/ga4gh/beacon-team
cd beacon-team
mvn clean install
```

## How it Works
The project provides the following:

- API for beacons
- sample beacon implementation
- conversion of parameters to a normalized form (the same way Beacon of Beacons does)
- sample navigation webpage
- sample test suite

##How to run it
## What it is
This project contains the BDK (beacon development kit) for Java EE developers. The BDK provides all of the tools required
to create a basic rest implementation for a beacon almost straight out of the box with only minimal set up required.
Extend the BDK to make it fit within their own project, or use it as is defining your own adapter to retrieve data from
your preferred data source.

## System Requirements
- Java 8 or later;
- Maven 3.0 or later;
- [Beacon Schemas (v.0.3.0)](https://github.com/ga4gh/beacon-team): BDK relies on the generated Java classes;
- an application server with support for Java EE 7 (e.g. JBoss EAP or WildFly).

## Modules
- [beacon-java-rest](/beacon-java-rest): rest implementation of a beacon, configured to run on a JBoss server;
- [sample-beacon-adapter](/sample-beacon-adapter): sample beacon adapter implementation.

## How to run it
Build the project:

mvn clean install
Expand All @@ -63,20 +44,20 @@ In order to run the tests from beacon-java-rest in a managed (remote) container,

mvn test -Ptest-managed

##Creating a beacon
The beacon implementation is designed to use a beacon-adapter provided through the [beacon-adapter-api project](https://github.com/mcupak/beacon-adapter-api) project. The user can either extend the abstract BeaconAdapter class to create a custom implementation, or they can use one of the beacon-adapter implementations that are provided
## Creating a Beacon
Beacon REST API uses Beacon Adapter to retrieve the beacon data. The BDK ships with a sample Beacon Adapter that uses
sample data. The sample Beacon Adapter is intended to be a placeholder to allow the tests to be run, and to give the user
an idea of how to implement a beacon.

Once you have created your own adapter, simply replace the adapter dependency in the beacon-java-rest's pom with your own. The sample beacon adapter is intended to be a placeholder to allow the tests to be run, and to give the user an idea of how to implement a beacon. After this has been completely they are free to implement their own adapter.
Once you are ready, implement your own [beacon-adapter](https://github.com/mcupak/beacon-service) project to query your
own data. To switch to your own Beacon Adapter, simply replace the adapter dependency in the beacon-java-rest's pom with
your own.

- Add your desired beacon adapter to the pom.xml in the commented out section
- Deploy The beacon
- Run the test-managed profile to ensure the beacon works and complies with the beacon spec

The API takes care of the rest and provides the following endpoints upon deployment of your beacon:
The Rest API provides the following endpoints upon deployment of your beacon:

http://localhost:8080/beacon-java - information about your beacon
http://localhost:8080/beacon-java/query - access to query service


##Technologies
Java EE. CDI, JAX-RS, JAXB. Tested with Arquillian/ShrinkWrap.
## Technologies
Java EE. CDI, JAX-RS, JAXB. Tested with Arquillian/ShrinkWrap.
65 changes: 43 additions & 22 deletions beacon-java-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
<version>1.0-SNAPSHOT</version>
</parent>


<groupId>com.dnastack</groupId>
<artifactId>beacon-java-rest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>beacon-java-rest</name>
<name>Beacon Java Rest</name>

<developers>
<developer>
Expand Down Expand Up @@ -109,23 +107,29 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.dnastack</groupId>
<artifactId>beacon-java-service</artifactId>
<version>${project.version}</version>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-servlet-filter-adapter</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-authz-client</artifactId>
</dependency>
<dependency>
<!--Required by Keycloak-->
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.dnastack</groupId>
<artifactId>beacon-adapter-api</artifactId>
<version>${version.beacon.adapter.api}</version>
</dependency>

<!-- Sample Beacon Adapter -->
<dependency>
<!-- Sample Beacon Adapter -->
<groupId>com.dnastack</groupId>
<artifactId>sample-beacon-adapter</artifactId>
<version>${project.version}</version>
</dependency>
<!-- End your sample beacon adapter -->

</dependencies>

<build>
Expand All @@ -140,6 +144,9 @@
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<port>10090</port>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -160,16 +167,12 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -181,17 +184,36 @@
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${version.org.wildfly}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<skip>false</skip>
<includes>
Expand Down Expand Up @@ -220,7 +242,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<skip>false</skip>
<includes>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.dnastack.beacon.application;
package com.dnastack.beacon.rest;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.dnastack.beacon.rest.api;
package com.dnastack.beacon.rest.endpoints;

import com.dnastack.beacon.exceptions.BeaconException;
import org.ga4gh.beacon.Beacon;
Expand All @@ -32,20 +32,16 @@
import javax.ws.rs.core.MediaType;

/**
* Beacon rest resource.
*
* @author Miroslav Cupak (mirocupak@gmail.com)
* @author Patrick Magee (patrickmageee@gmail.com)
* @author Artem (tema.voskoboynick@gmail.com)
* @version 1.0
*/
@Path("/")
public interface BeaconInfo {

/**
* Gets Information on the beacon
*
* @return Beacon represenation
* @throws BeaconException
* Gets information on the beacon.
*/
@GET
@Produces({MediaType.APPLICATION_JSON})
Expand Down
Loading