You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2017/10/13 14:29:20 UTC
[1/5] jena git commit: It is not a GSP operation.
Repository: jena
Updated Branches:
refs/heads/master c6fa7491c -> 32de4dc39
It is not a GSP operation.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/0475f63e
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/0475f63e
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/0475f63e
Branch: refs/heads/master
Commit: 0475f63eb51c8b71566e47575864f08cf4ce5c1b
Parents: 817b5d7
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 12 10:03:48 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 12 10:03:48 2017 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/0475f63e/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
index 3e9bcd2..22c3fba 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads.java
@@ -24,7 +24,7 @@ package org.apache.jena.fuseki.servlets ;
* dataset URI.
*/
-public abstract class REST_Quads extends SPARQL_GSP
+public abstract class REST_Quads extends ActionREST
{
private static final long serialVersionUID = 5366276922758465169L;
[5/5] jena git commit: Merge commit 'refs/pull/286/head' of
github.com:apache/jena
Posted by an...@apache.org.
Merge commit 'refs/pull/286/head' of github.com:apache/jena
This closes #286.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/32de4dc3
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/32de4dc3
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/32de4dc3
Branch: refs/heads/master
Commit: 32de4dc3936dbca4b9e80983d84a2be9fdb5f26e
Parents: c6fa749 7bf3281
Author: Andy Seaborne <an...@apache.org>
Authored: Fri Oct 13 15:28:44 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Fri Oct 13 15:28:44 2017 +0100
----------------------------------------------------------------------
.../org/apache/jena/fuseki/mgt/ActionStats.java | 12 +-
.../apache/jena/fuseki/mgt/JsonDescription.java | 4 +-
.../apache/jena/fuseki/server/CounterName.java | 126 +++++++++++++------
.../org/apache/jena/fuseki/server/NameMgr.java | 42 +++++++
.../jena/fuseki/server/OperationName.java | 65 +++++++---
.../apache/jena/fuseki/servlets/REST_Quads.java | 2 +-
6 files changed, 187 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
[4/5] jena git commit: JENA-1400: Name management applied to
CounterName and OperationName
Posted by an...@apache.org.
JENA-1400: Name management applied to CounterName and OperationName
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/7bf32819
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/7bf32819
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/7bf32819
Branch: refs/heads/master
Commit: 7bf3281988fb60abb21d748287d066d194879b60
Parents: 9e3d39b
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 12 12:28:38 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 12 12:28:38 2017 +0100
----------------------------------------------------------------------
.../org/apache/jena/fuseki/mgt/ActionStats.java | 8 +-
.../apache/jena/fuseki/server/CounterName.java | 126 +++++++++++++------
.../jena/fuseki/server/OperationName.java | 29 ++---
3 files changed, 98 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/7bf32819/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
index bc8d2cb..cd68a4e 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
@@ -93,9 +93,9 @@ public class ActionStats extends ActionContainerItem
DataService dSrv = access.getDataService() ;
builder.startObject("counters") ;
- builder.key(CounterName.Requests.name()).value(dSrv.getCounters().value(CounterName.Requests)) ;
- builder.key(CounterName.RequestsGood.name()).value(dSrv.getCounters().value(CounterName.RequestsGood)) ;
- builder.key(CounterName.RequestsBad.name()).value(dSrv.getCounters().value(CounterName.RequestsBad)) ;
+ builder.key(CounterName.Requests.getName()).value(dSrv.getCounters().value(CounterName.Requests)) ;
+ builder.key(CounterName.RequestsGood.getName()).value(dSrv.getCounters().value(CounterName.RequestsGood)) ;
+ builder.key(CounterName.RequestsBad.getName()).value(dSrv.getCounters().value(CounterName.RequestsBad)) ;
builder.key(JsonConst.endpoints).startObject("endpoints") ;
@@ -121,7 +121,7 @@ public class ActionStats extends ActionContainerItem
private static void operationCounters(JsonBuilder builder, Endpoint operation) {
for (CounterName cn : operation.getCounters().counters()) {
Counter c = operation.getCounters().get(cn) ;
- builder.key(cn.name()).value(c.value()) ;
+ builder.key(cn.getName()).value(c.value()) ;
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/7bf32819/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/CounterName.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/CounterName.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/CounterName.java
index 7a8d306..a66eff0 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/CounterName.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/CounterName.java
@@ -19,66 +19,110 @@
package org.apache.jena.fuseki.server;
/** Names for all counters */
-public enum CounterName {
- // There are generic names - apply to all services and datasets - and
- // also specific ones that relate only to a particular kind of service.
+public class CounterName {
+ // Create intern'ed symbols.
+ static private NameMgr<CounterName> mgr = new NameMgr<>();
+ static public CounterName register(String name, String hierarchicalName) {
+ return mgr.register(name, (n)->new CounterName(name, hierarchicalName));
+ }
+ // The "name" is used as a JSON key string.
+ // Legacy from when this was an enum and the name() was used for the UI.
+ // The better hierarchicalName is not used but becuse this has
+ // leaked to the jaavscript, we're a bit stuck.
+
+ private final String name ;
+ private final String hierarchicalName ;
+
+ // There are generic names - apply to all services and datasets.
// Total request received
- Requests("requests"),
+ public static final CounterName Requests = register("Requests", "requests");
// .. of which some and "good" and some are "bad".
// #"good" + #"bad" roughly equals #"requests"
// except that the total is incremented at the start, and the outcome at the end.
// There may also be short term consistency issues.
- RequestsGood("requests.good"),
- RequestsBad("requests.bad") ,
-
- // SPARQL Protocol - query and update - together with upload.
-
- // Query - standard and ...
- QueryTimeouts("query.timeouts") ,
- QueryExecErrors("query.execerrors") ,
- QueryIOErrors("query.ioerrors") ,
-
+ public static final CounterName RequestsGood = register("RequestsGood", "requests.good");
+ public static final CounterName RequestsBad = register("RequestsBad", "requests.bad");
+
+ // SPARQL Protocol - query and update - together with upload.
+
+ // Query - standard and ...
+ public static final CounterName QueryTimeouts = register("QueryTimeouts", "query.timeouts");
+ public static final CounterName QueryExecErrors = register("QueryExecErrors", "query.execerrors");
+ public static final CounterName QueryIOErrors = register("QueryIOErrors", "query.ioerrors");
+
// Update - standard and ...
- UpdateExecErrors("update.execerrors"),
-
+ public static final CounterName UpdateExecErrors = register("UpdateExecErrors", "update.execerrors");
+
// Upload ... standard counters
-
+
// Graph Store Protocol. uses HTTP codes.
// For each HTTP method
- HTTPget("http.get.requests") ,
- HTTPgetGood("http.get.requests.good") ,
- HTTPGetBad("http.get.requests.bad") ,
+ public static final CounterName HTTPget = register("HTTPget", "http.get.requests");
+ public static final CounterName HTTPgetGood = register("HTTPgetGood", "http.get.requests.good");
+ public static final CounterName HTTPGetBad = register("HTTPGetBad", "http.get.requests.bad");
- HTTPpost("http.post.requests") ,
- HTTPpostGood("http.post.requests.good") ,
- HTTPpostBad("http.post.requests.bad") ,
+ public static final CounterName HTTPpost = register("HTTPpost", "http.post.requests");
+ public static final CounterName HTTPpostGood = register("HTTPpostGood", "http.post.requests.good");
+ public static final CounterName HTTPpostBad = register("HTTPpostBad", "http.post.requests.bad");
- HTTPdelete("http.delete.requests") ,
- HTTPdeleteGood("http.delete.requests.good") ,
- HTTPdeleteBad("http.delete.requests.bad") ,
+ public static final CounterName HTTPdelete = register("HTTPdelete", "http.delete.requests");
+ public static final CounterName HTTPdeleteGood = register("HTTPdeleteGood", "http.delete.requests.good");
+ public static final CounterName HTTPdeleteBad = register("HTTPdeleteBad", "http.delete.requests.bad");
- HTTPput("http.put.requests") ,
- HTTPputGood("http.put.requests.good") ,
- HTTPputBad("http.put.requests.bad") ,
+ public static final CounterName HTTPput = register("HTTPput", "http.put.requests");
+ public static final CounterName HTTPputGood = register("HTTPputGood", "http.put.requests.good");
+ public static final CounterName HTTPputBad = register("HTTPputBad", "http.put.requests.bad");
- HTTPhead("http.head.requests") ,
- HTTPheadGood("http.head.requests.good") ,
- HTTPheadBad("http.head.requests.bad") ,
+ public static final CounterName HTTPhead = register("HTTPhead", "http.head.requests");
+ public static final CounterName HTTPheadGood = register("HTTPheadGood", "http.head.requests.good");
+ public static final CounterName HTTPheadBad = register("HTTPheadBad", "http.head.requests.bad");
- HTTPpatch("http.patch.requests") ,
- HTTPpatchGood("http.patch.requests.good") ,
- HTTPpatchBad("http.patch.requests.bad") ,
+ public static final CounterName HTTPpatch = register("HTTPpatch", "http.patch.requests");
+ public static final CounterName HTTPpatchGood = register("HTTPpatchGood", "http.patch.requests.good");
+ public static final CounterName HTTPpatchBad = register("HTTPpatchBad", "http.patch.requests.bad");
- HTTPoptions("http.options.requests") ,
- HTTPoptionsGood("http.options.requests.good") ,
- HTTPoptionsBad("http.options.requests.bad") ,
+ public static final CounterName HTTPoptions = register("HTTPoptions", "http.options.requests");
+ public static final CounterName HTTPoptionsGood = register("HTTPoptionsGood", "http.options.requests.good");
+ public static final CounterName HTTPoptionsBad = register("HTTPoptionsBad", "http.options.requests.bad");
- ;
+ private CounterName(String name, String hierarchicalName) {
+ this.name = name;
+ this.hierarchicalName = hierarchicalName;
+ }
- public final String name ;
- private CounterName(String name) { this.name = name ; }
+ public String getName() {
+ return name;
+ }
+ public String getFullName() {
+ return hierarchicalName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( this == obj )
+ return true;
+ if ( obj == null )
+ return false;
+ if ( getClass() != obj.getClass() )
+ return false;
+ CounterName other = (CounterName)obj;
+ if ( name == null ) {
+ if ( other.name != null )
+ return false;
+ } else if ( !name.equals(other.name) )
+ return false;
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/jena/blob/7bf32819/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
index 23be8dc..39427b1 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
@@ -18,9 +18,6 @@
package org.apache.jena.fuseki.server;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Names (symbols) for operations.
* An {@code OperationName} is not related to the service name used to invoke the operation.
@@ -29,24 +26,16 @@ import java.util.Map;
public class OperationName {
// Create intern'ed symbols.
- static private Map<String, OperationName> registered = new HashMap<>();
-
- /**
- * Create an intern'ed {@code OperationName}. That is, if the object has already been
- * created, return the original. There is only ever one object for a given name.
- * (It is an extensible enum without subclassing).
- */
- static public OperationName register(String name) {
- return registered.computeIfAbsent(name, (n)->new OperationName(n));
- }
+ static private NameMgr<OperationName> mgr = new NameMgr<>();
+ static public OperationName register(String name) { return mgr.register(name, (x)->new OperationName(x)); }
- public static OperationName Query = register("SPARQL Query");
- public static OperationName Update = register("SPARQL Update");
- public static OperationName Upload = register("File Upload");
- public static OperationName GSP_RW = register("Graph Store Protocol");
- public static OperationName GSP_R = register("Graph Store Protocol (Read)");
- public static OperationName Quads_RW = register("HTTP Quads");
- public static OperationName Quads_R = register("HTTP Quads (Read)");
+ public static final OperationName Query = register("SPARQL Query");
+ public static final OperationName Update = register("SPARQL Update");
+ public static final OperationName Upload = register("File Upload");
+ public static final OperationName GSP_RW = register("Graph Store Protocol");
+ public static final OperationName GSP_R = register("Graph Store Protocol (Read)");
+ public static final OperationName Quads_RW = register("HTTP Quads");
+ public static final OperationName Quads_R = register("HTTP Quads (Read)");
private final String name ;
private OperationName(String name) { this.name = name ; }
[2/5] jena git commit: Convert OperationName to an extensible enum.
Posted by an...@apache.org.
Convert OperationName to an extensible enum.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/fc7beb02
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/fc7beb02
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/fc7beb02
Branch: refs/heads/master
Commit: fc7beb02c3399f58f00b8d3f9f4a6ce5645338e3
Parents: 0475f63
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 12 10:08:29 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 12 10:08:29 2017 +0100
----------------------------------------------------------------------
.../org/apache/jena/fuseki/mgt/ActionStats.java | 4 +-
.../apache/jena/fuseki/mgt/JsonDescription.java | 4 +-
.../jena/fuseki/server/OperationName.java | 76 ++++++++++++++++----
3 files changed, 66 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/fc7beb02/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
index fc95331..bc8d2cb 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionStats.java
@@ -108,8 +108,8 @@ public class ActionStats extends ActionContainerItem
builder.startObject() ;
operationCounters(builder, endpoint);
- builder.key(JsonConst.operation).value(operName.name()) ;
- builder.key(JsonConst.description).value(operName.getDescription()) ;
+ builder.key(JsonConst.operation).value(operName.getName()) ;
+ builder.key(JsonConst.description).value(operName.getName()) ;
builder.finishObject() ;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/fc7beb02/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java
index 8f0d939..6113a10 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java
@@ -58,8 +58,8 @@ public class JsonDescription {
private static void describe(JsonBuilder builder, OperationName opName, List<Endpoint> endpoints) {
builder.startObject() ;
- builder.key(JsonConst.srvType).value(opName.name()) ;
- builder.key(JsonConst.srvDescription).value(opName.getDescription()) ;
+ builder.key(JsonConst.srvType).value(opName.getName()) ;
+ builder.key(JsonConst.srvDescription).value(opName.getName()) ;
builder.key(JsonConst.srvEndpoints) ;
builder.startArray() ;
http://git-wip-us.apache.org/repos/asf/jena/blob/fc7beb02/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
index 8cf2c9c..23be8dc 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/OperationName.java
@@ -18,20 +18,68 @@
package org.apache.jena.fuseki.server;
-public enum OperationName {
- // Fixed names give the codebase some resilience.
- Query("SPARQL Query"),
- Update("SPARQL Update"),
- Upload("File Upload"),
- GSP_RW("Graph Store Protocol"),
- GSP_R("Graph Store Protocol (Read)"),
- Quads_RW("HTTP Quads"),
- Quads_R("HTTP Quads (Read)")
- ;
-
- private final String description ;
- private OperationName(String description) { this.description = description ; }
- public String getDescription() { return description ; }
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Names (symbols) for operations.
+ * An {@code OperationName} is not related to the service name used to invoke the operation.
+ * That is determined by the {@link Endpoint}.
+ */
+public class OperationName {
+
+ // Create intern'ed symbols.
+ static private Map<String, OperationName> registered = new HashMap<>();
+
+ /**
+ * Create an intern'ed {@code OperationName}. That is, if the object has already been
+ * created, return the original. There is only ever one object for a given name.
+ * (It is an extensible enum without subclassing).
+ */
+ static public OperationName register(String name) {
+ return registered.computeIfAbsent(name, (n)->new OperationName(n));
+ }
+
+ public static OperationName Query = register("SPARQL Query");
+ public static OperationName Update = register("SPARQL Update");
+ public static OperationName Upload = register("File Upload");
+ public static OperationName GSP_RW = register("Graph Store Protocol");
+ public static OperationName GSP_R = register("Graph Store Protocol (Read)");
+ public static OperationName Quads_RW = register("HTTP Quads");
+ public static OperationName Quads_R = register("HTTP Quads (Read)");
+
+ private final String name ;
+ private OperationName(String name) { this.name = name ; }
+
+ public String getName() { return name ; }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ // Could be this == obj
+ // because we intern'ed the object
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( this == obj )
+ return true;
+ if ( obj == null )
+ return false;
+ if ( getClass() != obj.getClass() )
+ return false;
+ OperationName other = (OperationName)obj;
+ if ( name == null ) {
+ if ( other.name != null )
+ return false;
+ } else if ( !name.equals(other.name) )
+ return false;
+ return true;
+ }
}
[3/5] jena git commit: JENA-1400: Proper name management
Posted by an...@apache.org.
JENA-1400: Proper name management
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/9e3d39bd
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/9e3d39bd
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/9e3d39bd
Branch: refs/heads/master
Commit: 9e3d39bd88f697e0dc66239c8f72840ccdee9171
Parents: fc7beb0
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Oct 12 12:28:03 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Oct 12 12:28:03 2017 +0100
----------------------------------------------------------------------
.../org/apache/jena/fuseki/server/NameMgr.java | 42 ++++++++++++++++++++
1 file changed, 42 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/9e3d39bd/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/NameMgr.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/NameMgr.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/NameMgr.java
new file mode 100644
index 0000000..d0d97d0
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/NameMgr.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.fuseki.server;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+
+/**
+ * Management of intern'ed names {@code T} that can be used as keys. {@link #register}
+ * creates an intern'ed {@code T}; if the object with the same name has already been
+ * created, return the original. There is only ever one object for a given name.
+ * <p>
+ * {@code T.==} can be used to test of name match, though providing
+ * {@code .hashCode} and {@code .equals} is preferred.
+ */
+public class NameMgr<T> {
+ private final Map<String, T> registered = new ConcurrentHashMap<>();
+
+ /** register, creating an object is necessary */
+ public T register(String name, Function<String, T> maker) {
+ return registered.computeIfAbsent(name, maker);
+ }
+
+ public NameMgr() { }
+}