You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2016/06/09 14:14:47 UTC
tomee git commit: TOMEE-1838 adding https support to deploy mojos
Repository: tomee
Updated Branches:
refs/heads/master 18d7eebaf -> 7158343fa
TOMEE-1838 adding https support to deploy mojos
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/7158343f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/7158343f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/7158343f
Branch: refs/heads/master
Commit: 7158343fac68e1923b7c8e988e58a3ce9315738b
Parents: 18d7eeb
Author: Romain manni-Bucau <rm...@gmail.com>
Authored: Thu Jun 9 16:14:26 2016 +0200
Committer: Romain manni-Bucau <rm...@gmail.com>
Committed: Thu Jun 9 16:14:26 2016 +0200
----------------------------------------------------------------------
.../maven/plugin/AbstractAddressMojo.java | 3 ++
.../maven/plugin/AbstractCommandMojo.java | 40 ++++++++++++++++++--
.../openejb/maven/plugin/AbstractTomEEMojo.java | 3 --
3 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/7158343f/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java
index eede86a..4e91fb6 100644
--- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java
+++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractAddressMojo.java
@@ -24,6 +24,9 @@ public abstract class AbstractAddressMojo extends AbstractMojo {
@Parameter(property = "tomee-plugin.http")
protected String tomeeHttpPort;
+ @Parameter(property = "tomee-plugin.https")
+ protected String tomeeHttpsPort;
+
@Parameter(property = "tomee-plugin.host")
protected String tomeeHost;
http://git-wip-us.apache.org/repos/asf/tomee/blob/7158343f/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java
index 4e0f09e..83c03d7 100644
--- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java
+++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractCommandMojo.java
@@ -17,22 +17,46 @@
package org.apache.openejb.maven.plugin;
+import org.apache.maven.plugins.annotations.Parameter;
+
import javax.naming.Context;
import javax.naming.InitialContext;
+import java.util.Map;
import java.util.Properties;
public abstract class AbstractCommandMojo extends AbstractAddressMojo {
+ /**
+ * Where is deployed ejbd endpoint relatively to root (/tomee/ejb typically).
+ */
+ @Parameter(property = "tomee-plugin.ejbd-endpoint", defaultValue = "/tomee/ejb")
+ protected String ejbdEndpoint;
+
+ /**
+ * Flag to force https usage.
+ */
+ @Parameter(property = "tomee-plugin.command-force-https", defaultValue = "false")
+ protected boolean forceHttps;
+
+ /**
+ * Properties used to do remote lookup (typically for the Deployer).
+ */
+ @Parameter
+ protected Map<String, String> lookupVariables;
+
protected Object lookup(final String name) {
- if (tomeeHttpPort == null) {
+ if (tomeeHttpPort == null && tomeeHttpsPort == null) {
tomeeHttpPort = "8080";
}
if (tomeeHost == null) {
tomeeHost = "localhost";
}
+ if (ejbdEndpoint == null) {
+ ejbdEndpoint = "/tomee/ejb";
+ }
final Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
- props.put(Context.PROVIDER_URL, "http://" + tomeeHost + ":" + tomeeHttpPort + "/tomee/ejb");
+ props.put(Context.PROVIDER_URL, providerUrl());
if (user != null) {
props.put(Context.SECURITY_PRINCIPAL, user);
}
@@ -42,12 +66,22 @@ public abstract class AbstractCommandMojo extends AbstractAddressMojo {
if (realm != null) {
props.put("openejb.authentication.realmName", realm);
}
+ if (lookupVariables != null) {
+ props.putAll(lookupVariables);
+ }
try {
return new InitialContext(props).lookup(name);
} catch (final Exception e) {
throw new TomEEException("Not able to execute " + getClass().getSimpleName() +
- ", maybe add -Dopenejb.system.apps=true -Dtomee.remote.support=true to tomee", e);
+ ", maybe add -Dopenejb.system.apps=true -Dtomee.remote.support=true to tomee", e);
+ }
+ }
+
+ private String providerUrl() {
+ if (forceHttps || (tomeeHttpPort == null && tomeeHttpsPort != null)) {
+ return "https://" + tomeeHost + ":" + tomeeHttpsPort + ejbdEndpoint;
}
+ return "http://" + tomeeHost + ":" + tomeeHttpPort + ejbdEndpoint;
}
}
http://git-wip-us.apache.org/repos/asf/tomee/blob/7158343f/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
index cf6d994..b911f43 100644
--- a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
+++ b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
@@ -159,9 +159,6 @@ public abstract class AbstractTomEEMojo extends AbstractAddressMojo {
@Parameter(property = "tomee-plugin.ajp")
protected String tomeeAjpPort;
- @Parameter(property = "tomee-plugin.https")
- protected String tomeeHttpsPort;
-
@Parameter(property = "tomee-plugin.args")
protected String args;