accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] branch master updated: ACCUMULO-4755 Move Table.ID serialization for monitor
Date Wed, 17 Jan 2018 23:56:02 GMT
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new bfa9585  ACCUMULO-4755 Move Table.ID serialization for monitor
bfa9585 is described below

commit bfa958529b3d94a3946aa9c23b8b0fc4ceeb4bb3
Author: Christopher Tubbs <ctubbsii@apache.org>
AuthorDate: Wed Jan 17 18:54:48 2018 -0500

    ACCUMULO-4755 Move Table.ID serialization for monitor
    
    Move Table.ID serialization to fields in the monitor's REST interface to
    remove dependency on jaxb in the core module and in the Table.ID class
    itself.
---
 core/pom.xml                                                 |  4 ----
 .../java/org/apache/accumulo/core/client/impl/Namespace.java |  3 ---
 .../java/org/apache/accumulo/core/client/impl/Table.java     |  3 ---
 .../monitor/rest/problems/ProblemDetailInformation.java      | 10 ++++++++--
 .../monitor/rest/problems/ProblemSummaryInformation.java     |  5 +++++
 .../accumulo/monitor/rest/tables/TableInformation.java       |  6 ++++++
 .../accumulo/monitor/rest/tservers/CurrentOperations.java    |  6 ++++++
 .../accumulo/monitor/util}/JaxbAbstractIdSerializer.java     | 12 +++++-------
 8 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/core/pom.xml b/core/pom.xml
index b8379e5..b459a82 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -68,10 +68,6 @@
       <artifactId>commons-logging</artifactId>
     </dependency>
     <dependency>
-      <groupId>javax.xml.bind</groupId>
-      <artifactId>jaxb-api</artifactId>
-    </dependency>
-    <dependency>
       <groupId>jline</groupId>
       <artifactId>jline</artifactId>
     </dependency>
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
index cb7133a..56d7073 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
@@ -18,8 +18,6 @@ package org.apache.accumulo.core.client.impl;
 
 import java.util.concurrent.ExecutionException;
 
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
 import org.apache.accumulo.core.client.Instance;
 
 import com.google.common.cache.Cache;
@@ -37,7 +35,6 @@ public class Namespace {
    * Uses an internal cache and private constructor for storing a WeakReference of every
Namespace.ID. Therefore, a Namespace.ID can't be instantiated outside
    * this class and is accessed by calling Namespace.ID.{@link #of(String)}.
    */
-  @XmlJavaTypeAdapter(JaxbAbstractIdSerializer.class)
   public static class ID extends AbstractId {
     private static final long serialVersionUID = 8931104141709170293L;
     static final Cache<String,ID> cache = CacheBuilder.newBuilder().weakValues().build();
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
index 0de551c..15517d9 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
@@ -18,8 +18,6 @@ package org.apache.accumulo.core.client.impl;
 
 import java.util.concurrent.ExecutionException;
 
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
 import org.apache.accumulo.core.client.Instance;
 
 import com.google.common.cache.Cache;
@@ -34,7 +32,6 @@ public class Table {
    * Uses an internal cache and private constructor for storing a WeakReference of every
Table.ID. Therefore, a Table.ID can't be instantiated outside this
    * class and is accessed by calling Table.ID.{@link #of(String)}.
    */
-  @XmlJavaTypeAdapter(JaxbAbstractIdSerializer.class)
   public static class ID extends AbstractId {
     private static final long serialVersionUID = 7399913185860577809L;
     static final Cache<String,ID> cache = CacheBuilder.newBuilder().weakValues().build();
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemDetailInformation.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemDetailInformation.java
index b38862b..ad588db 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemDetailInformation.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemDetailInformation.java
@@ -16,7 +16,10 @@
  */
 package org.apache.accumulo.monitor.rest.problems;
 
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
 import org.apache.accumulo.core.client.impl.Table;
+import org.apache.accumulo.monitor.util.JaxbAbstractIdSerializer;
 
 /**
  *
@@ -29,7 +32,10 @@ public class ProblemDetailInformation {
 
   // Variable names become JSON keys
   public String tableName;
-  public String tableID;
+
+  @XmlJavaTypeAdapter(JaxbAbstractIdSerializer.class)
+  public Table.ID tableID;
+
   public String type;
   public String server;
 
@@ -59,7 +65,7 @@ public class ProblemDetailInformation {
    */
   public ProblemDetailInformation(String tableName, Table.ID tableId, String type, String
server, Long time, String resource, String exception) {
     this.tableName = tableName;
-    this.tableID = tableId.canonicalID();
+    this.tableID = tableId;
     this.type = type;
     this.server = server;
     this.time = time;
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemSummaryInformation.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemSummaryInformation.java
index 9f688c0..9828293 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemSummaryInformation.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/problems/ProblemSummaryInformation.java
@@ -16,7 +16,10 @@
  */
 package org.apache.accumulo.monitor.rest.problems;
 
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
 import org.apache.accumulo.core.client.impl.Table;
+import org.apache.accumulo.monitor.util.JaxbAbstractIdSerializer;
 
 /**
  *
@@ -29,6 +32,8 @@ public class ProblemSummaryInformation {
 
   // Variable names become JSON keys
   public String tableName;
+
+  @XmlJavaTypeAdapter(JaxbAbstractIdSerializer.class)
   public Table.ID tableID;
 
   public Integer fileRead;
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
index c8cc858..6e4a91f 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TableInformation.java
@@ -16,8 +16,11 @@
  */
 package org.apache.accumulo.monitor.rest.tables;
 
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
 import org.apache.accumulo.core.client.impl.Table;
 import org.apache.accumulo.core.master.thrift.TableInfo;
+import org.apache.accumulo.monitor.util.JaxbAbstractIdSerializer;
 
 /**
  *
@@ -31,7 +34,10 @@ public class TableInformation {
 
   // Variable names become JSON keys
   public String tablename;
+
+  @XmlJavaTypeAdapter(JaxbAbstractIdSerializer.class)
   public Table.ID tableId;
+
   public String tableState;
 
   public int tablets;
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/CurrentOperations.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/CurrentOperations.java
index fab1969..6918ec4 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/CurrentOperations.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tservers/CurrentOperations.java
@@ -16,7 +16,10 @@
  */
 package org.apache.accumulo.monitor.rest.tservers;
 
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
 import org.apache.accumulo.core.client.impl.Table;
+import org.apache.accumulo.monitor.util.JaxbAbstractIdSerializer;
 
 /**
  *
@@ -30,7 +33,10 @@ public class CurrentOperations {
   // Variable names become JSON keys
   public String name;
   public String tablet;
+
+  @XmlJavaTypeAdapter(JaxbAbstractIdSerializer.class)
   public Table.ID tableID;
+
   public long entries;
   public double ingest;
   public double query;
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/JaxbAbstractIdSerializer.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/JaxbAbstractIdSerializer.java
similarity index 80%
rename from core/src/main/java/org/apache/accumulo/core/client/impl/JaxbAbstractIdSerializer.java
rename to server/monitor/src/main/java/org/apache/accumulo/monitor/util/JaxbAbstractIdSerializer.java
index ec9d080..2b60129 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/JaxbAbstractIdSerializer.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/JaxbAbstractIdSerializer.java
@@ -14,26 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.client.impl;
+package org.apache.accumulo.monitor.util;
 
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 
+import org.apache.accumulo.core.client.impl.AbstractId;
+
 /**
- * A class for marshaling @link{AbstractId} so REST calls can serialize AbstractId to its
canonical value.
+ * A class for marshaling {@link AbstractId} into its canonical form for REST endpoints
  */
 public class JaxbAbstractIdSerializer extends XmlAdapter<String,AbstractId> {
 
   @Override
   public String marshal(AbstractId id) {
-    if (id != null)
-      return id.canonicalID();
-    else
-      return null;
+    return id == null ? null : id.canonicalID();
   }
 
   @Override
   public AbstractId unmarshal(String id) {
-    // should not unmarshal from String
     throw new UnsupportedOperationException("Cannot unmarshal from String");
   }
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@accumulo.apache.org" <commits@accumulo.apache.org>'].

Mime
View raw message