diff --git a/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/etc/sessions/gcloud/session-store.xml b/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/etc/sessions/gcloud/session-store.xml
index a7c2dcb2cae..e82adf8a0ca 100644
--- a/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/etc/sessions/gcloud/session-store.xml
+++ b/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/etc/sessions/gcloud/session-store.xml
@@ -13,6 +13,7 @@
+
diff --git a/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/modules/session-store-gcloud.mod b/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/modules/session-store-gcloud.mod
index 3d73cf9739c..7e8d0afcf73 100644
--- a/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/modules/session-store-gcloud.mod
+++ b/jetty-gcloud/jetty-gcloud-session-manager/src/main/config/modules/session-store-gcloud.mod
@@ -92,6 +92,7 @@ http://www.apache.org/licenses/LICENSE-2.0.html
## GCloudDatastore Session config
#jetty.session.gcloud.maxRetries=5
#jetty.session.gcloud.backoffMs=1000
+#jetty.session.gcloud.namespace=
#jetty.session.gcloud.model.kind=GCloudSession
#jetty.session.gcloud.model.id=id
#jetty.session.gcloud.model.contextPath=contextPath
diff --git a/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java b/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java
index 36af3f7b658..0a698e5cd11 100644
--- a/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java
+++ b/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStore.java
@@ -72,6 +72,9 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
protected boolean _dsProvided = false;
protected EntityDataModel _model;
+
+
+ private String _namespace;
@@ -316,6 +319,15 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
_backoff = ms;
}
+ public void setNamespace (String namespace)
+ {
+ _namespace = namespace;
+ }
+
+ public String getNamespace ()
+ {
+ return _namespace;
+ }
public int getBackoffMs ()
{
@@ -341,8 +353,13 @@ public class GCloudSessionDataStore extends AbstractSessionDataStore
protected void doStart() throws Exception
{
if (!_dsProvided)
- _datastore = DatastoreOptions.defaultInstance().service();
-
+ {
+ if (!StringUtil.isBlank(getNamespace()))
+ _datastore = DatastoreOptions.builder().namespace(getNamespace()).build().service();
+ else
+ _datastore = DatastoreOptions.defaultInstance().service();
+ }
+
if (_model == null)
_model = new EntityDataModel();
diff --git a/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreFactory.java b/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreFactory.java
index 1979ddc9586..c54d927b63a 100644
--- a/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreFactory.java
+++ b/jetty-gcloud/jetty-gcloud-session-manager/src/main/java/org/eclipse/jetty/gcloud/session/GCloudSessionDataStoreFactory.java
@@ -30,6 +30,7 @@ import org.eclipse.jetty.server.session.SessionHandler;
*/
public class GCloudSessionDataStoreFactory extends AbstractSessionDataStoreFactory
{
+ private String _namespace;
private int _maxRetries;
private int _backoffMs;
private GCloudSessionDataStore.EntityDataModel _model;
@@ -66,6 +67,22 @@ public class GCloudSessionDataStoreFactory extends AbstractSessionDataStoreFacto
}
+ /**
+ * @return the namespace
+ */
+ public String getNamespace()
+ {
+ return _namespace;
+ }
+
+ /**
+ * @param namespace the namespace to set
+ */
+ public void setNamespace(String namespace)
+ {
+ _namespace = namespace;
+ }
+
/**
* @see org.eclipse.jetty.server.session.SessionDataStoreFactory#getSessionDataStore(org.eclipse.jetty.server.session.SessionHandler)
*/
@@ -76,6 +93,7 @@ public class GCloudSessionDataStoreFactory extends AbstractSessionDataStoreFacto
ds.setBackoffMs(getBackoffMs());
ds.setMaxRetries(getMaxRetries());
ds.setGracePeriodSec(getGracePeriodSec());
+ ds.setNamespace(_namespace);
return ds;
}