gobblin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject incubator-gobblin git commit: [GOBBLIN-230] rename old package name in states
Date Tue, 29 Aug 2017 00:59:26 GMT
Repository: incubator-gobblin
Updated Branches:
  refs/heads/master bb7f6b372 -> d8b1a6609


[GOBBLIN-230] rename old package name in states

Closes #2084 from arjun4084346/master


Project: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/commit/d8b1a660
Tree: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/tree/d8b1a660
Diff: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/diff/d8b1a660

Branch: refs/heads/master
Commit: d8b1a66095e8665889d1a31bb466cc7d2fbeb8df
Parents: bb7f6b3
Author: Arjun <abora@linkedin.com>
Authored: Mon Aug 28 17:58:30 2017 -0700
Committer: Abhishek Tiwari <abhishektiwari.btech@gmail.com>
Committed: Mon Aug 28 17:59:16 2017 -0700

----------------------------------------------------------------------
 .../management/copy/OwnerAndPermission.java     | 29 +++++++++++++++++
 .../data/management/copy/CopyEntity.java        | 17 ++++++++--
 .../copy/CopyableDatasetMetadata.java           | 16 ++++++++--
 .../mapreduce/GobblinWorkUnitsInputFormat.java  | 33 ++++++++++++++++++++
 4 files changed, 91 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/d8b1a660/gobblin-data-management/src/main/java/gobblin/data/management/copy/OwnerAndPermission.java
----------------------------------------------------------------------
diff --git a/gobblin-data-management/src/main/java/gobblin/data/management/copy/OwnerAndPermission.java
b/gobblin-data-management/src/main/java/gobblin/data/management/copy/OwnerAndPermission.java
new file mode 100644
index 0000000..09b7c03
--- /dev/null
+++ b/gobblin-data-management/src/main/java/gobblin/data/management/copy/OwnerAndPermission.java
@@ -0,0 +1,29 @@
+/*
+ * 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 gobblin.data.management.copy;
+
+import org.apache.hadoop.fs.permission.FsPermission;
+
+
+/***
+ * Shim layer for org.apache.gobblin.data.management.copy.OwnerAndPermission
+ */
+public class OwnerAndPermission extends org.apache.gobblin.data.management.copy.OwnerAndPermission
{
+  public OwnerAndPermission(String owner, String group, FsPermission fsPermission) {
+    super(owner, group, fsPermission);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/d8b1a660/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyEntity.java
----------------------------------------------------------------------
diff --git a/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyEntity.java
b/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyEntity.java
index a19bcb0..93cb3b3 100644
--- a/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyEntity.java
+++ b/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyEntity.java
@@ -49,6 +49,7 @@ import com.google.gson.reflect.TypeToken;
 @AllArgsConstructor(access = AccessLevel.PROTECTED)
 @NoArgsConstructor(access = AccessLevel.PROTECTED)
 @EqualsAndHashCode
+@lombok.extern.slf4j.Slf4j
 public class CopyEntity implements HasGuid {
 
   public static final Gson GSON = GsonInterfaceAdapter.getGson(Object.class);
@@ -95,7 +96,7 @@ public class CopyEntity implements HasGuid {
    * @return a new instance of {@link CopyEntity}
    */
   public static CopyEntity deserialize(String serialized) {
-    return GSON.fromJson(serialized, CopyEntity.class);
+    return GSON.fromJson(getSerializedWithNewPackage(serialized), CopyEntity.class);
   }
 
   /**
@@ -106,7 +107,19 @@ public class CopyEntity implements HasGuid {
    * @return a new {@link List} of {@link CopyEntity}s
    */
   public static List<CopyEntity> deserializeList(String serialized) {
-    return GSON.fromJson(serialized, new TypeToken<List<CopyEntity>>() {}.getType());
+    return GSON.fromJson(getSerializedWithNewPackage(serialized), new TypeToken<List<CopyEntity>>()
{}.getType());
+  }
+
+  /**
+   * Converts package name in serialized string to new name.
+   * This is temporary change and should get removed after all the states are switched from
old to new package name.
+   * @param serialized serialized string possibly having old package names
+   * @return
+   */
+  public static String getSerializedWithNewPackage(String serialized) {
+    serialized = serialized.replace("\"gobblin.data.management.", "\"org.apache.gobblin.data.management.");
+    log.info("Serialized updated copy entity: " + serialized);
+    return serialized;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/d8b1a660/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableDatasetMetadata.java
----------------------------------------------------------------------
diff --git a/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableDatasetMetadata.java
b/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableDatasetMetadata.java
index 800afa6..004156b 100644
--- a/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableDatasetMetadata.java
+++ b/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableDatasetMetadata.java
@@ -22,8 +22,9 @@ import lombok.Getter;
 import lombok.ToString;
 
 import com.google.gson.Gson;
+import lombok.extern.slf4j.Slf4j;
 
-
+@Slf4j
 /**
  * A {@link CopyableDataset} that is used to serialize into state objects. The class exists
because custom
  * implementations of {@link CopyableDataset} may contain additional fields that should not
be serialized.
@@ -57,7 +58,18 @@ public class CopyableDatasetMetadata {
    * @return a new instance of {@link CopyableDatasetMetadata}
    */
   public static CopyableDatasetMetadata deserialize(String serialized) {
-    return GSON.fromJson(serialized, CopyableDatasetMetadata.class);
+    return GSON.fromJson(getSerializedWithNewPackage(serialized), CopyableDatasetMetadata.class);
   }
 
+  /**
+   * Converts package name in serialized string to new name
+   * This is temporary change and should get removed after all the states are switched from
old to new package name.
+   * @param serialized serialized string possibly having old package names
+   * @return
+   */
+  private static String getSerializedWithNewPackage(String serialized) {
+    serialized = serialized.replace("\"gobblin.data.management.", "\"org.apache.gobblin.data.management.");
+    log.info("Serialized updated copy entity: " + serialized);
+    return serialized;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/d8b1a660/gobblin-runtime/src/main/java/gobblin/runtime/mapreduce/GobblinWorkUnitsInputFormat.java
----------------------------------------------------------------------
diff --git a/gobblin-runtime/src/main/java/gobblin/runtime/mapreduce/GobblinWorkUnitsInputFormat.java
b/gobblin-runtime/src/main/java/gobblin/runtime/mapreduce/GobblinWorkUnitsInputFormat.java
new file mode 100644
index 0000000..8b8947d
--- /dev/null
+++ b/gobblin-runtime/src/main/java/gobblin/runtime/mapreduce/GobblinWorkUnitsInputFormat.java
@@ -0,0 +1,33 @@
+/*
+ * 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 gobblin.runtime.mapreduce;
+
+/***
+ * Shim layer for org.apache.gobblin.runtime.mapreduce.GobblinWorkUnitsInputFormat
+ */
+public class GobblinWorkUnitsInputFormat extends org.apache.gobblin.runtime.mapreduce.GobblinWorkUnitsInputFormat
{
+
+  public static class GobblinSplit extends org.apache.gobblin.runtime.mapreduce.GobblinWorkUnitsInputFormat.GobblinSplit
{
+
+  }
+  public static class GobblinRecordReader extends org.apache.gobblin.runtime.mapreduce.GobblinWorkUnitsInputFormat.GobblinRecordReader
{
+    public GobblinRecordReader(GobblinSplit split) {
+      super(split);
+    }
+  }
+}


Mime
View raw message