You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/04/14 02:07:47 UTC
[1/2] incubator-geode git commit: GEODE-1201: Reverting gradle changes
Repository: incubator-geode
Updated Branches:
refs/heads/develop a885ac140 -> 5c89fab63
GEODE-1201: Reverting gradle changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/5c89fab6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5c89fab6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5c89fab6
Branch: refs/heads/develop
Commit: 5c89fab63991da25a1262caf29a94bdc8eedbd6d
Parents: d1e4825
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Wed Apr 13 11:42:21 2016 +1000
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Thu Apr 14 10:07:06 2016 +1000
----------------------------------------------------------------------
geode-assembly/build.gradle | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5c89fab6/geode-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index 8f14fc1..b7d05e2 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -81,7 +81,6 @@ sourceSets {
test {
// test from the actual classpath not the gradle classpath
- dependsOn copyRuntimeLibs
dependsOn installDist
// @TODO: this doesn't seem to be working need to get basename first.
classpath += files "$buildDir/install/apache-geode/lib/geode-dependencies.jar"
@@ -113,11 +112,6 @@ task defaultCacheConfig(type: JavaExec, dependsOn: classes) {
}
}
-task copyRuntimeLibs(type: Copy) {
- into "lib"
- from configurations.testRuntime - configurations.runtime
-}
-
// This closure sets the gemfire classpath. If we add another jar to the classpath it must
// be included in the filter logic below.
def cp = {
[2/2] incubator-geode git commit: GEODE-1201: Adding
compileRuntimeLibs to geode-assembly for tests Amending bind address
configuration for http-service-bind-address
Posted by ud...@apache.org.
GEODE-1201: Adding compileRuntimeLibs to geode-assembly for tests
Amending bind address configuration for http-service-bind-address
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/d1e48259
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/d1e48259
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/d1e48259
Branch: refs/heads/develop
Commit: d1e48259894e60c54c588adba23a458f028e7145
Parents: a885ac1
Author: Udo Kohlmeyer <uk...@pivotal.io>
Authored: Mon Apr 11 07:57:21 2016 +1000
Committer: Udo Kohlmeyer <uk...@pivotal.io>
Committed: Thu Apr 14 10:07:06 2016 +1000
----------------------------------------------------------------------
geode-assembly/build.gradle | 6 +++
.../gemfire/management/internal/RestAgent.java | 51 ++++++++++++++------
.../web/swagger/config/RestApiPathProvider.java | 27 ++++++++++-
3 files changed, 68 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1e48259/geode-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index b7d05e2..8f14fc1 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -81,6 +81,7 @@ sourceSets {
test {
// test from the actual classpath not the gradle classpath
+ dependsOn copyRuntimeLibs
dependsOn installDist
// @TODO: this doesn't seem to be working need to get basename first.
classpath += files "$buildDir/install/apache-geode/lib/geode-dependencies.jar"
@@ -112,6 +113,11 @@ task defaultCacheConfig(type: JavaExec, dependsOn: classes) {
}
}
+task copyRuntimeLibs(type: Copy) {
+ into "lib"
+ from configurations.testRuntime - configurations.runtime
+}
+
// This closure sets the gemfire classpath. If we add another jar to the classpath it must
// be included in the filter logic below.
def cp = {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1e48259/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
index a91df05..526bd2d 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/RestAgent.java
@@ -17,26 +17,25 @@
package com.gemstone.gemfire.management.internal;
-import org.apache.logging.log4j.Logger;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-
-import com.gemstone.gemfire.cache.AttributesFactory;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.DataPolicy;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.*;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.SocketCreator;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.management.ManagementService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.logging.log4j.Logger;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+
+import java.net.UnknownHostException;
/**
* Agent implementation that controls the HTTP server end points used for REST
* clients to connect gemfire data node.
- *
+ * <p>
* The RestAgent is used to start http service in embedded mode on any non
* manager data node with developer REST APIs service enabled.
*
@@ -109,8 +108,9 @@ public class RestAgent {
public void startHttpService() {
// TODO: add a check that will make sure that we start HTTP service on
// non-manager data node
+ String httpServiceBindAddress = getBindAddressForHttpService();
logger.info("Attempting to start HTTP service on port ({}) at bind-address ({})...",
- this.config.getHttpServicePort(), this.config.getHttpServiceBindAddress());
+ this.config.getHttpServicePort(), httpServiceBindAddress);
// Find the developer REST WAR file
final String gemfireAPIWar = agentUtil.findWarLocation("geode-web-api");
@@ -124,10 +124,9 @@ public class RestAgent {
logger.warn("Detected presence of catalina system properties. HTTP service will not be started. To enable the GemFire Developer REST API, please deploy the /geode-web-api WAR file in your application server.");
} else if (agentUtil.isWebApplicationAvailable(gemfireAPIWar)) {
- final String bindAddress = this.config.getHttpServiceBindAddress();
final int port = this.config.getHttpServicePort();
- this.httpServer = JettyHelper.initJetty(bindAddress, port,
+ this.httpServer = JettyHelper.initJetty(httpServiceBindAddress, port,
this.config.getHttpServiceSSLEnabled(),
this.config.getHttpServiceSSLRequireAuthentication(),
this.config.getHttpServiceSSLProtocols(), this.config.getHttpServiceSSLCiphers(),
@@ -136,8 +135,8 @@ public class RestAgent {
this.httpServer = JettyHelper.addWebApplication(httpServer, "/gemfire-api", gemfireAPIWar);
if (logger.isDebugEnabled()) {
- logger.debug("Starting HTTP embedded server on port ({}) at bind-address ({})...",
- ((ServerConnector) this.httpServer.getConnectors()[0]).getPort(), bindAddress);
+ logger.info("Starting HTTP embedded server on port ({}) at bind-address ({})...",
+ ((ServerConnector) this.httpServer.getConnectors()[0]).getPort(), httpServiceBindAddress);
}
this.httpServer = JettyHelper.startJetty(this.httpServer);
@@ -151,6 +150,28 @@ public class RestAgent {
}
}
+ private String getBindAddressForHttpService() {
+ java.lang.String bindAddress = this.config.getHttpServiceBindAddress();
+ if (StringUtils.isBlank(bindAddress)) {
+ if (StringUtils.isBlank(this.config.getServerBindAddress())) {
+ if (StringUtils.isBlank(this.config.getBindAddress())) {
+ try {
+ bindAddress = SocketCreator.getLocalHost().getHostAddress();
+ logger.info("RestAgent.getBindAddressForHttpService.localhost: " + SocketCreator.getLocalHost().getHostAddress());
+ } catch (UnknownHostException e) {
+ logger.error("LocalHost could not be found.", e);
+ return bindAddress;
+ }
+ } else {
+ bindAddress = this.config.getBindAddress();
+ }
+ } else {
+ bindAddress = this.config.getServerBindAddress();
+ }
+ }
+ return bindAddress;
+ }
+
private void stopHttpService() {
if (this.httpServer != null) {
logger.info("Stopping the HTTP service...");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d1e48259/geode-web-api/src/main/java/com/gemstone/gemfire/rest/internal/web/swagger/config/RestApiPathProvider.java
----------------------------------------------------------------------
diff --git a/geode-web-api/src/main/java/com/gemstone/gemfire/rest/internal/web/swagger/config/RestApiPathProvider.java b/geode-web-api/src/main/java/com/gemstone/gemfire/rest/internal/web/swagger/config/RestApiPathProvider.java
index a8921d7..47316ed 100644
--- a/geode-web-api/src/main/java/com/gemstone/gemfire/rest/internal/web/swagger/config/RestApiPathProvider.java
+++ b/geode-web-api/src/main/java/com/gemstone/gemfire/rest/internal/web/swagger/config/RestApiPathProvider.java
@@ -18,8 +18,10 @@ package com.gemstone.gemfire.rest.internal.web.swagger.config;
import javax.servlet.ServletContext;
+import com.gemstone.gemfire.admin.internal.InetAddressUtil;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.SocketCreator;
import com.gemstone.gemfire.internal.lang.StringUtils;
import com.mangofactory.swagger.core.SwaggerPathProvider;
@@ -27,6 +29,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.util.UriComponentsBuilder;
+import java.net.UnknownHostException;
+
@SuppressWarnings("unused")
public class RestApiPathProvider implements SwaggerPathProvider {
@@ -44,7 +48,28 @@ public class RestApiPathProvider implements SwaggerPathProvider {
DistributionConfig config = InternalDistributedSystem.getAnyInstance().getConfig();
String scheme = config.getHttpServiceSSLEnabled() ? "https" : "http";
- this.docsLocation = scheme + "://" + config.getHttpServiceBindAddress() + ":" + config.getHttpServicePort();
+ this.docsLocation = scheme + "://" + getBindAddressForHttpService() + ":" + config.getHttpServicePort();
+ }
+
+ private String getBindAddressForHttpService() {
+ DistributionConfig config = InternalDistributedSystem.getAnyInstance().getConfig();
+ java.lang.String bindAddress = config.getHttpServiceBindAddress();
+ if (org.apache.commons.lang.StringUtils.isBlank(bindAddress)) {
+ if (org.apache.commons.lang.StringUtils.isBlank(config.getServerBindAddress())) {
+ if (org.apache.commons.lang.StringUtils.isBlank(config.getBindAddress())) {
+ try {
+ bindAddress = SocketCreator.getLocalHost().getHostAddress();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ } else {
+ bindAddress = config.getBindAddress();
+ }
+ } else {
+ bindAddress = config.getServerBindAddress();
+ }
+ }
+ return bindAddress;
}
@Override