Skip to content

introduce microprofile support - new repo structure #3

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 7 commits into
base: master
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
21 changes: 4 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,15 @@ matrix:
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.3 BUILD_TOOL=maven
- jdk: oraclejdk9
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.3 BUILD_TOOL=gradle
# Exclude 18.0.0.2 WLP
- jdk: openjdk8
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=maven
- jdk: openjdk8
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=gradle
- jdk: oraclejdk8
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=maven
- jdk: oraclejdk8
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=gradle
- jdk: oraclejdk9
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=maven
- jdk: oraclejdk9
env: RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=gradle
env:
- RUNTIME=ol RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=maven
- RUNTIME=ol RUNTIME_VERSION=18.0.0.3 BUILD_TOOL=maven
- RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=maven
# - RUNTIME=ol RUNTIME_VERSION=18.0.0.4 BUILD_TOOL=maven
- RUNTIME=wlp RUNTIME_VERSION=18.0.0.3 BUILD_TOOL=maven
- RUNTIME=ol RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=gradle
# - RUNTIME=wlp RUNTIME_VERSION=18.0.0.4 BUILD_TOOL=maven
- RUNTIME=ol RUNTIME_VERSION=18.0.0.3 BUILD_TOOL=gradle
- RUNTIME=wlp RUNTIME_VERSION=18.0.0.2 BUILD_TOOL=gradle
# - RUNTIME=ol RUNTIME_VERSION=18.0.0.4 BUILD_TOOL=gradle
- RUNTIME=wlp RUNTIME_VERSION=18.0.0.3 BUILD_TOOL=gradle
# - RUNTIME=wlp RUNTIME_VERSION=18.0.0.4 BUILD_TOOL=gradle
cache:
directories:
- $HOME/.m2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.openliberty.boost.common.config;

public class BoosterDependencyInfo {

protected String group;
protected String artifact;
protected String version;

public BoosterDependencyInfo(String grp, String artf, String ver ) {

this.group = grp;
this.artifact = artf;
this.version = ver;
}

public String getGroup(){
return group;
}

public String getArtifact(){
return artifact;
}

public String getVersion(){
return version;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@
*
*/
public abstract class BoosterPackConfigurator {

protected String EE_7_VERSION = "0.1-SNAPSHOT";

protected BoosterDependencyInfo dependencyInfo;
protected LibertyServerConfigGenerator serverXML;

protected String EE_7_VERSION = "0.1-SNAPSHOT";
protected String EE_8_VERSION = "0.2-SNAPSHOT";

/**
* Return the Liberty feature name
*
* @return
*/
public abstract String getFeature();

protected String MP_20_VERSION = "0.2-SNAPSHOT";

public BoosterPackConfigurator(BoosterDependencyInfo depInfo, LibertyServerConfigGenerator srvrXML){
dependencyInfo = depInfo;
serverXML = srvrXML;
}

/**
* method to write out the default config for a particular feature into
* server.xml
Expand All @@ -41,18 +43,12 @@ public abstract class BoosterPackConfigurator {
*/
public abstract void addServerConfig(Document doc);

/**
* Set the Liberty feature based on the booster dependency version
*
* @param version
*/
public abstract void setFeature(String version);

/**
* Return the artifactId of the dependency jar to copy to the server
*
* @return
*/
public abstract String getDependencyToCopy();

public String getDependencyToCopy(){
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package io.openliberty.boost.common.config;

import static io.openliberty.boost.common.config.ConfigConstants.CDI_20;

import org.w3c.dom.Document;

public class CDIBoosterPackConfigurator extends BoosterPackConfigurator {

public CDIBoosterPackConfigurator(BoosterDependencyInfo depInfo, LibertyServerConfigGenerator srvrXML) {
super(depInfo, srvrXML);
// TODO Auto-generated constructor stub
}

public void addServerConfig(Document doc) {
// write out the feature Manager stanza
if (dependencyInfo.getVersion().equals(MP_20_VERSION)) {
serverXML.addFeature(CDI_20);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public interface ConfigConstants {
public String JAXRS_21 = "jaxrs-2.1";
public String JDBC_41 = "jdbc-4.1";
public String JDBC_42 = "jdbc-4.2";
public String CDI_20 = "cdi-2.0";
public String MPHEALTH_10 = "mpHealth-1.0";
public String MPRESTCLIENT_11 = "mpRestClient-1.1";
public String JSONP_11 = "jsonp-1.1";
public String MPCONFIG_13 = "mpConfig-1.3";
public String MPOPENTRACING_10 = "mpOpenTracing-1.0";

public String SHARED_RESOURCES_DIR = "${shared.resource.dir}";
public String SERVER_OUTPUT_DIR = "${server.output.dir}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,28 @@
*******************************************************************************/
package io.openliberty.boost.common.config;

import org.w3c.dom.Document;
import io.openliberty.boost.common.config.BoosterPackConfigurator;
import static io.openliberty.boost.common.config.ConfigConstants.*;

import java.util.Map;
import org.w3c.dom.Document;

public class JAXRSBoosterPackConfigurator extends BoosterPackConfigurator {

String libertyFeature = null;

@Override
public void setFeature(String version) {
// if it is the 1.0 version = EE7 feature level
if (version.equals(EE_7_VERSION)) {
libertyFeature = JAXRS_20;
} else if (version.equals(EE_8_VERSION)) {
libertyFeature = JAXRS_21;
}
}

@Override
public String getFeature() {
return libertyFeature;
public JAXRSBoosterPackConfigurator(BoosterDependencyInfo depInfo, LibertyServerConfigGenerator srvrXML) {
super(depInfo, srvrXML);
// TODO Auto-generated constructor stub
}

@Override
public void addServerConfig(Document doc) {
// No config to write
// write out the feature Manager stanza
if (dependencyInfo.getVersion().equals(EE_7_VERSION)) {
serverXML.addFeature(JAXRS_20);
} else if (dependencyInfo.getVersion().equals(EE_8_VERSION)) {
serverXML.addFeature(JAXRS_21);
}

// no further config needed for jaxrs
}

@Override
public String getDependencyToCopy() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,40 @@

import static io.openliberty.boost.common.config.ConfigConstants.*;

import java.util.HashMap;
import java.util.Map;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class JDBCBoosterPackConfigurator extends BoosterPackConfigurator {

/**
* The artifactId of the dependency for this booster that needs to be copied to
* the server
*/
private final String DEPENDENCY_ARTIFACT = "org.apache.derby:derby:10.14.2.0";

String libertyFeature = null;
public JDBCBoosterPackConfigurator(BoosterDependencyInfo depInfo, LibertyServerConfigGenerator srvrXML) {
super(depInfo, srvrXML);
// TODO Auto-generated constructor stub
}

/**
* retrieves the default boost feature string for the jdbc dependency
/**
* The artifactId of the dependency for this booster that needs to be copied
* to the server
*/
public String getFeature() {
return libertyFeature;
}
private final String DEPENDENCY_ARTIFACT = "org.apache.derby:derby:10.14.2.0";

/**
* writes out jdbc default config data when selected by the presence of a jdbc
* boost dependency
*/
@Override
public void addServerConfig(Document doc) {

// write out the feature Manager stanza
if (dependencyInfo.getVersion().equals(EE_7_VERSION)) {
serverXML.addFeature(JDBC_41);
} else if (dependencyInfo.getVersion().equals(EE_8_VERSION)) {
serverXML.addFeature(JDBC_42);
}

//write out config stanzas

Element serverRoot = doc.getDocumentElement();

// Find the root server element
Expand Down Expand Up @@ -81,17 +85,6 @@ public void addServerConfig(Document doc) {
serverRoot.appendChild(jdbcDriver);
}

@Override
public void setFeature(String version) {

if (version.equals(EE_7_VERSION)) {
libertyFeature = JDBC_41;
} else if (version.equals(EE_8_VERSION)) {
libertyFeature = JDBC_42;
}

}

@Override
public String getDependencyToCopy() {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package io.openliberty.boost.common.config;

import static io.openliberty.boost.common.config.ConfigConstants.JSONP_11;

import org.w3c.dom.Document;

public class JSONPBoosterPackConfigurator extends BoosterPackConfigurator {

public JSONPBoosterPackConfigurator(BoosterDependencyInfo depInfo, LibertyServerConfigGenerator srvrXML) {
super(depInfo, srvrXML);
// TODO Auto-generated constructor stub
}

public void addServerConfig(Document doc) {
// write out the feature Manager stanza
if (dependencyInfo.getVersion().equals(MP_20_VERSION)) {
serverXML.addFeature(JSONP_11);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void addKeystore(Map<String, String> keystoreProps, Map<String, String> k
* The full name of the Liberty feature to add.
*/
public void addFeature(String featureName) {

if (!featuresAdded.contains(featureName)) {
Element feature = doc.createElement(FEATURE);
feature.appendChild(doc.createTextNode(featureName));
Expand Down Expand Up @@ -174,7 +174,6 @@ public void addFeatures(List<String> features) {
* @throws IOException
*/
public void writeToServer() throws TransformerException, IOException {

// Replace auto-generated server.xml
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Expand Down Expand Up @@ -210,7 +209,7 @@ public void addBootstrapProperties(Properties properties) throws IOException {
}

public void addBoosterConfig(BoosterPackConfigurator configurator) {
configurator.addServerConfig(getServerDoc());
configurator.addServerConfig(getServerDoc());
}

public void addApplication(String appName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package io.openliberty.boost.common.config;

import static io.openliberty.boost.common.config.ConfigConstants.MPCONFIG_13;

import org.w3c.dom.Document;

public class MPConfigBoosterPackConfigurator extends BoosterPackConfigurator {

public MPConfigBoosterPackConfigurator(BoosterDependencyInfo depInfo, LibertyServerConfigGenerator srvrXML) {
super(depInfo, srvrXML);
// TODO Auto-generated constructor stub
}

public void addServerConfig(Document doc) {
// write out the feature Manager stanza
if (dependencyInfo.getVersion().equals(MP_20_VERSION)) {
serverXML.addFeature(MPCONFIG_13);
}
}
}
Loading