You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2016/12/16 03:31:04 UTC
[1/4] incubator-atlas git commit: ATLAS-1304: Redundant code removal
and code simplification
Repository: incubator-atlas
Updated Branches:
refs/heads/master f6e27b59c -> 1620284e4
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
index fba6d19..aaa8fa0 100755
--- a/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/GraphBackedDiscoveryServiceTest.java
@@ -88,7 +88,7 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
super.setUp();
final TypeSystem typeSystem = TypeSystem.getInstance();
- Collection<String> oldTypeNames = new HashSet<String>();
+ Collection<String> oldTypeNames = new HashSet<>();
oldTypeNames.addAll(typeSystem.getTypeNames());
TestUtils.defineDeptEmployeeTypes(typeSystem);
@@ -111,7 +111,7 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
newTypeNames.addAll(typeSystem.getTypeNames());
newTypeNames.removeAll(oldTypeNames);
- Collection<IDataType> newTypes = new ArrayList<IDataType>();
+ Collection<IDataType> newTypes = new ArrayList<>();
for(String name : newTypeNames) {
try {
newTypes.add(typeSystem.getDataType(IDataType.class, name));
@@ -294,7 +294,7 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
resultList = (List<Map<String, Object>>) r;
Assert.assertTrue(resultList.size() > 0);
System.out.println("search result = " + r);
- List<Object> names = new ArrayList<Object>(resultList.size());
+ List<Object> names = new ArrayList<>(resultList.size());
for (Map<String, Object> vertexProps : resultList) {
names.addAll(vertexProps.values());
}
@@ -884,7 +884,7 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
assertNotNull(rows);
assertEquals(rows.length(), expectedNumRows.intValue()); // some queries may not have any results
- List<String> returnedList = new ArrayList<String> ();
+ List<String> returnedList = new ArrayList<>();
for (int i = 0; i < rows.length(); i++) {
JSONObject row = rows.getJSONObject(i);
try
@@ -953,7 +953,7 @@ public class GraphBackedDiscoveryServiceTest extends BaseRepositoryTest {
JSONArray rows = results.getJSONArray("rows");
assertNotNull(rows);
- assertEquals( rows.length(), expectedNumRows.intValue(), "query [" + dslQuery + "] returned [" + rows.length() + "] rows. Expected " + expectedNumRows.intValue() + " rows."); // some queries may not have any results
+ assertEquals( rows.length(), expectedNumRows.intValue(), "query [" + dslQuery + "] returned [" + rows.length() + "] rows. Expected " + expectedNumRows + " rows."); // some queries may not have any results
System.out.println("query [" + dslQuery + "] returned [" + rows.length() + "] rows");
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java b/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java
index 7ae5e20..7ea15cb 100644
--- a/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java
+++ b/repository/src/test/java/org/apache/atlas/repository/audit/AuditRepositoryTestBase.java
@@ -18,7 +18,6 @@
package org.apache.atlas.repository.audit;
-import junit.framework.Assert;
import org.apache.atlas.EntityAuditEvent;
import org.apache.atlas.typesystem.Referenceable;
import org.apache.commons.lang.RandomStringUtils;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
index dbd4bf1..8f8aadc 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphHelperMockTest.java
@@ -74,8 +74,8 @@ public class GraphHelperMockTest {
when(v2.getEdges(AtlasEdgeDirection.IN)).thenReturn(noEdgesIterable);
when(v1.getEdges(AtlasEdgeDirection.OUT)).thenReturn(noEdgesIterable);
- when(v1.getId()).thenReturn(new String("1234"));
- when(v2.getId()).thenReturn(new String("5678"));
+ when(v1.getId()).thenReturn("1234");
+ when(v2.getId()).thenReturn("5678");
when(graph.addEdge(v1, v2, edgeLabel)).thenThrow(new RuntimeException("Unique property constraint violated"));
graphHelperInstance.getOrCreateEdge(v1, v2, edgeLabel);
}
@@ -110,9 +110,9 @@ public class GraphHelperMockTest {
when(v2.getEdges(AtlasEdgeDirection.IN)).thenReturn(noEdgesIterable);
when(v1.getEdges(AtlasEdgeDirection.OUT)).thenReturn(noEdgesIterable);
- when(v1.getId()).thenReturn(new String("v1"));
- when(v2.getId()).thenReturn(new String("v2"));
- when(edge.getId()).thenReturn(new String("edge"));
+ when(v1.getId()).thenReturn("v1");
+ when(v2.getId()).thenReturn("v2");
+ when(edge.getId()).thenReturn("edge");
when(graph.addEdge(v1, v2, edgeLabel))
.thenThrow(new RuntimeException("Unique property constraint violated")).thenReturn(edge);
AtlasEdge redge = graphHelperInstance.getOrCreateEdge(v1, v2, edgeLabel);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
index 000f2f4..6b83aa3 100755
--- a/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/typestore/GraphBackedTypeStoreTest.java
@@ -96,7 +96,7 @@ public class GraphBackedTypeStoreTest {
@Test(dependsOnMethods = "testStore")
public void testRestoreType() throws Exception {
- TypesDef typesDef = ((GraphBackedTypeStore)typeStore).restoreType("Manager");
+ TypesDef typesDef = typeStore.restoreType("Manager");
verifyRestoredClassType(typesDef, "Manager");
}
@@ -214,8 +214,8 @@ public class GraphBackedTypeStoreTest {
Iterator<AtlasEdge> outGoingEdgesByLabel = GraphHelper.getInstance().getOutGoingEdgesByLabel(typeVertex, edgeLabel);
int edgeCount = 0;
- for (Iterator<AtlasEdge> iterator = outGoingEdgesByLabel; iterator.hasNext();) {
- iterator.next();
+ for (; outGoingEdgesByLabel.hasNext();) {
+ outGoingEdgesByLabel.next();
edgeCount++;
}
return edgeCount;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
index d659c0f..ca5f988 100644
--- a/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/service/DefaultMetadataServiceTest.java
@@ -644,8 +644,8 @@ public class DefaultMetadataServiceTest {
List<Referenceable> actualArray = (List<Referenceable>) entityDefinition.get(arrAttrName);
if (expectedArray == null && actualArray != null) {
//all are marked as deleted in case of soft delete
- for (int index = 0; index < actualArray.size(); index++) {
- assertEquals(actualArray.get(index).getId().state, Id.EntityState.DELETED);
+ for (Referenceable referenceable : actualArray) {
+ assertEquals(referenceable.getId().state, Id.EntityState.DELETED);
}
} else if(expectedArray == null) {
//hard delete case
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
index 75ec9a2..8b3cee3 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/ReferenceableInstance.java
@@ -57,7 +57,7 @@ public class ReferenceableInstance extends StructInstance implements ITypedRefer
bigIntegers, dates, strings, arrays, maps, structs, referenceableInstances, ids);
this.id = id;
this.traits = traits;
- ImmutableList.Builder<String> b = new ImmutableList.Builder<String>();
+ ImmutableList.Builder<String> b = new ImmutableList.Builder<>();
for (String t : traits.keySet()) {
b.add(t);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
index 6fb2087..1616e7d 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/persistence/StructInstance.java
@@ -129,19 +129,19 @@ public class StructInstance implements ITypedStruct {
}
nullFlags[nullPos] = false;
if (i.dataType() == DataTypes.BOOLEAN_TYPE) {
- bools[pos] = ((Boolean) cVal).booleanValue();
+ bools[pos] = (Boolean) cVal;
} else if (i.dataType() == DataTypes.BYTE_TYPE) {
- bytes[pos] = ((Byte) cVal).byteValue();
+ bytes[pos] = (Byte) cVal;
} else if (i.dataType() == DataTypes.SHORT_TYPE) {
- shorts[pos] = ((Short) cVal).shortValue();
+ shorts[pos] = (Short) cVal;
} else if (i.dataType() == DataTypes.INT_TYPE) {
- ints[pos] = ((Integer) cVal).intValue();
+ ints[pos] = (Integer) cVal;
} else if (i.dataType() == DataTypes.LONG_TYPE) {
- longs[pos] = ((Long) cVal).longValue();
+ longs[pos] = (Long) cVal;
} else if (i.dataType() == DataTypes.FLOAT_TYPE) {
- floats[pos] = ((Float) cVal).floatValue();
+ floats[pos] = (Float) cVal;
} else if (i.dataType() == DataTypes.DOUBLE_TYPE) {
- doubles[pos] = ((Double) cVal).doubleValue();
+ doubles[pos] = (Double) cVal;
} else if (i.dataType() == DataTypes.BIGINTEGER_TYPE) {
bigIntegers[pos] = (BigInteger) cVal;
} else if (i.dataType() == DataTypes.BIGDECIMAL_TYPE) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeInfo.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeInfo.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeInfo.java
index 35a45b9..c24a55f 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeInfo.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/AttributeInfo.java
@@ -106,7 +106,7 @@ public class AttributeInfo {
Objects.equals(name, that.name) &&
Objects.equals(multiplicity, that.multiplicity) &&
Objects.equals(reverseAttributeName, that.reverseAttributeName) &&
- Objects.equals(dataType, that.dataType);
+ dataType == null ? that.dataType == null : Objects.equals(dataType.getName(), that.dataType.getName());
}
public String toJson() throws JSONException {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/ClassType.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/ClassType.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/ClassType.java
index 6398829..350d01b 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/ClassType.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/ClassType.java
@@ -191,7 +191,7 @@ public class ClassType extends HierarchicalType<ClassType, IReferenceableInstanc
public ITypedReferenceableInstance createInstanceWithTraits(Id id, AtlasSystemAttributes systemAttributes, Referenceable r, String... traitNames)
throws AtlasException {
- ImmutableMap.Builder<String, ITypedStruct> b = new ImmutableBiMap.Builder<String, ITypedStruct>();
+ ImmutableMap.Builder<String, ITypedStruct> b = new ImmutableBiMap.Builder<>();
if (traitNames != null) {
for (String t : traitNames) {
TraitType tType = typeSystem.getDataType(TraitType.class, t);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/DataTypes.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/DataTypes.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/DataTypes.java
index 425e163..21d5f1a 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/DataTypes.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/DataTypes.java
@@ -79,7 +79,7 @@ public class DataTypes {
return mapTypeName(keyType.getName(), valueType.getName());
}
- public static enum TypeCategory {
+ public enum TypeCategory {
PRIMITIVE,
ENUM,
ARRAY,
@@ -179,7 +179,7 @@ public class DataTypes {
@Override
public void updateSignatureHash(MessageDigest digester, Object val) throws AtlasException {
if ( val != null ) {
- digester.update(((Byte) val).byteValue());
+ digester.update((Byte) val);
}
}
}
@@ -267,7 +267,7 @@ public class DataTypes {
}
public Long nullValue() {
- return 0l;
+ return 0L;
}
}
@@ -524,9 +524,7 @@ public class DataTypes {
return val;
}
ImmutableCollection.Builder b = m.isUnique ? ImmutableSet.builder() : ImmutableList.builder();
- Iterator it = val.iterator();
- while (it.hasNext()) {
- Object elem = it.next();
+ for (Object elem : val) {
if (elem instanceof IReferenceableInstance) {
Id oldId = ((IReferenceableInstance) elem).getId();
Id newId = transientToNewIds.get(oldId);
@@ -613,9 +611,7 @@ public class DataTypes {
return val;
}
ImmutableMap.Builder b = ImmutableMap.builder();
- Iterator<Map.Entry> it = val.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry elem = it.next();
+ for (Map.Entry elem : (Iterable<Map.Entry>) val.entrySet()) {
Object oldKey = elem.getKey();
Object oldValue = elem.getValue();
Object newKey = oldKey;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
index 392d2bf..ac7f442 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/HierarchicalType.java
@@ -30,16 +30,7 @@ import org.apache.atlas.typesystem.persistence.DownCastStructInstance;
import org.apache.atlas.typesystem.types.TypeUtils.Pair;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
+import java.util.*;
/**
* Represents a Type that can have SuperTypes. An Instance of the HierarchicalType can be
@@ -153,21 +144,21 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
}
private void setupSuperTypesGraph(ImmutableSet<String> superTypes) throws AtlasException {
- Map<String, List<Path>> superTypePaths = new HashMap<String, List<Path>>();
- Map<String, Path> pathNameToPathMap = new HashMap<String, Path>();
- Queue<Path> queue = new LinkedList<Path>();
+ Map<String, List<Path>> superTypePaths = new HashMap<>();
+ Map<String, Path> pathNameToPathMap = new HashMap<>();
+ Queue<Path> queue = new LinkedList<>();
queue.add(new Node(getName()));
while (!queue.isEmpty()) {
Path currentPath = queue.poll();
- ST superType = currentPath.typeName == getName() ? (ST) this :
- (ST) typeSystem.getDataType(superTypeClass, currentPath.typeName);
+ ST superType = Objects.equals(currentPath.typeName, getName()) ? (ST) this :
+ typeSystem.getDataType(superTypeClass, currentPath.typeName);
pathNameToPathMap.put(currentPath.pathName, currentPath);
if (superType != this) {
List<Path> typePaths = superTypePaths.get(superType.getName());
if (typePaths == null) {
- typePaths = new ArrayList<Path>();
+ typePaths = new ArrayList<>();
superTypePaths.put(superType.getName(), typePaths);
}
typePaths.add(currentPath);
@@ -217,13 +208,13 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
while (pathItr.hasNext()) {
Path currentPath = pathItr.next();
- ST superType = currentPath.typeName == getName() ? (ST) this :
- (ST) typeSystem.getDataType(superTypeClass, currentPath.typeName);
+ ST superType = Objects.equals(currentPath.typeName, getName()) ? (ST) this :
+ typeSystem.getDataType(superTypeClass, currentPath.typeName);
ImmutableList<AttributeInfo> superTypeFields =
superType == this ? ImmutableList.copyOf(fields) : superType.immediateAttrs;
- Set<String> immediateFields = new HashSet<String>();
+ Set<String> immediateFields = new HashSet<>();
for (AttributeInfo i : superTypeFields) {
if (superType == this) {
@@ -315,7 +306,7 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
}
if (s != null) {
- if (s.getTypeName() != getName()) {
+ if (!Objects.equals(s.getTypeName(), getName())) {
throw new AtlasException(
String.format("Downcast called on wrong type %s, instance type is %s", getName(),
s.getTypeName()));
@@ -328,7 +319,7 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
superTypeName, getName()));
}
- ST superType = (ST) typeSystem.getDataType(superTypeClass, superTypeName);
+ ST superType = typeSystem.getDataType(superTypeClass, superTypeName);
Map<String, String> downCastMap = superType.constructDowncastFieldMap(this, pathToSuper.get(0));
return new DownCastStructInstance(superTypeName, new DownCastFieldMapping(ImmutableMap.copyOf(downCastMap)),
s);
@@ -359,7 +350,7 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
/*
* the downcastMap;
*/
- Map<String, String> dCMap = new HashMap<String, String>();
+ Map<String, String> dCMap = new HashMap<>();
Iterator<Path> itr = pathIterator();
while (itr.hasNext()) {
Path p = itr.next();
@@ -516,7 +507,7 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
Queue<Path> pathQueue;
PathItr() {
- pathQueue = new LinkedList<Path>();
+ pathQueue = new LinkedList<>();
pathQueue.add(pathNameToPathMap.get(getName()));
}
@@ -532,13 +523,12 @@ public abstract class HierarchicalType<ST extends HierarchicalType, T> extends A
if(p != null) {
ST t = null;
try {
- t = (ST) typeSystem.getDataType(superTypeClass, p.typeName);
+ t = typeSystem.getDataType(superTypeClass, p.typeName);
} catch (AtlasException me) {
throw new RuntimeException(me);
}
if (t.superTypes != null) {
- ImmutableSet<String> sTs = t.superTypes;
- for (String sT : sTs) {
+ for (String sT : (ImmutableSet<String>) t.superTypes) {
String nm = sT + "." + p.pathName;
pathQueue.add(pathNameToPathMap.get(nm));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphTraversal.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphTraversal.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphTraversal.java
index a8f2eeb..9a1847c 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphTraversal.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphTraversal.java
@@ -41,8 +41,8 @@ public class ObjectGraphTraversal implements Iterator<ObjectGraphTraversal.Insta
public ObjectGraphTraversal(TypeSystem typeSystem, IReferenceableInstance start) throws AtlasException {
this.typeSystem = typeSystem;
- queue = new LinkedList<InstanceTuple>();
- processedIds = new HashSet<Id>();
+ queue = new LinkedList<>();
+ processedIds = new HashSet<>();
processReferenceableInstance(start);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphWalker.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphWalker.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphWalker.java
index 81884e8..036d18d 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphWalker.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/ObjectGraphWalker.java
@@ -66,8 +66,8 @@ public class ObjectGraphWalker {
List<? extends IReferenceableInstance> roots) throws AtlasException {
this.typeSystem = typeSystem;
this.nodeProcessor = nodeProcessor;
- queue = new LinkedList<IReferenceableInstance>();
- processedIds = new HashSet<Id>();
+ queue = new LinkedList<>();
+ processedIds = new HashSet<>();
for (IReferenceableInstance r : roots) {
visitReferenceableInstance(r);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/StructType.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/StructType.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/StructType.java
index 5d25730..57f2517 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/StructType.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/StructType.java
@@ -94,9 +94,9 @@ public class StructType extends AbstractDataType<IStruct> implements IConstructa
protected FieldMapping constructFieldMapping(AttributeInfo... fields)
throws AtlasException {
- Map<String, AttributeInfo> fieldsMap = new LinkedHashMap<String, AttributeInfo>();
- Map<String, Integer> fieldPos = new HashMap<String, Integer>();
- Map<String, Integer> fieldNullPos = new HashMap<String, Integer>();
+ Map<String, AttributeInfo> fieldsMap = new LinkedHashMap<>();
+ Map<String, Integer> fieldPos = new HashMap<>();
+ Map<String, Integer> fieldNullPos = new HashMap<>();
int numBools = 0;
int numBytes = 0;
int numShorts = 0;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypedStructHandler.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypedStructHandler.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypedStructHandler.java
index b97669a..b142e71 100755
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypedStructHandler.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/TypedStructHandler.java
@@ -33,6 +33,7 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
public class TypedStructHandler {
@@ -49,7 +50,7 @@ public class TypedStructHandler {
if (val != null) {
if (val instanceof ITypedStruct) {
ITypedStruct ts = (ITypedStruct) val;
- if (ts.getTypeName() != structType.getName()) {
+ if (!Objects.equals(ts.getTypeName(), structType.getName())) {
throw new ValueConversionException(structType, val);
}
return ts;
@@ -70,7 +71,7 @@ public class TypedStructHandler {
}
}
return ts;
- } else if (val instanceof StructInstance && ((StructInstance) val).getTypeName() == structType.getName()) {
+ } else if (val instanceof StructInstance && Objects.equals(((StructInstance) val).getTypeName(), structType.getName())) {
return (StructInstance) val;
} else {
throw new ValueConversionException(structType, val);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/TypeCache.java
----------------------------------------------------------------------
diff --git a/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/TypeCache.java b/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/TypeCache.java
index 87d83a6..c8f65be 100644
--- a/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/TypeCache.java
+++ b/typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/TypeCache.java
@@ -66,7 +66,7 @@ public interface TypeCache {
* @return returns non-null type if cached, otherwise null
* @throws AtlasException
*/
- public IDataType get(String typeName) throws AtlasException;
+ IDataType get(String typeName) throws AtlasException;
/**
* @param typeCategory Non-null category of type. The category can be one of
@@ -75,7 +75,7 @@ public interface TypeCache {
* @return returns non-null type (of the specified category) if cached, otherwise null
* @throws AtlasException
*/
- public IDataType get(DataTypes.TypeCategory typeCategory, String typeName) throws AtlasException;
+ IDataType get(DataTypes.TypeCategory typeCategory, String typeName) throws AtlasException;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/InstanceBuilder.scala
----------------------------------------------------------------------
diff --git a/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/InstanceBuilder.scala b/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/InstanceBuilder.scala
index df1851c..9e22f67 100644
--- a/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/InstanceBuilder.scala
+++ b/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/InstanceBuilder.scala
@@ -69,7 +69,7 @@ object DynamicValue {
if ( s != null ) {
new DynamicCollection(ib, attr, s)
} else {
- new DynamicValue(ib, attr, s, jL.map{ e => transformOut(null, null, e)}.toSeq)
+ new DynamicValue(ib, attr, s, jL.map { e => transformOut(null, null, e) })
}
}
case jM : java.util.Map[_,_] => {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/TypesBuilder.scala
----------------------------------------------------------------------
diff --git a/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/TypesBuilder.scala b/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/TypesBuilder.scala
index f18151a..5ea345f 100644
--- a/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/TypesBuilder.scala
+++ b/typesystem/src/main/scala/org/apache/atlas/typesystem/builders/TypesBuilder.scala
@@ -148,10 +148,10 @@ class TypesBuilder {
def types(f : => Unit ) : TypesDef = {
f
- TypesDef(context.value.enums.toSeq,
- context.value.structs.toSeq,
- context.value.traits.toSeq,
- context.value.classes.toSeq)
+ TypesDef(context.value.enums,
+ context.value.structs,
+ context.value.traits,
+ context.value.classes)
}
def _class(name : String, superTypes : List[String] = List())(f : => Unit): Unit = {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
----------------------------------------------------------------------
diff --git a/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala b/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
index 6f63d0f..3354d7c 100755
--- a/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
+++ b/typesystem/src/main/scala/org/apache/atlas/typesystem/json/InstanceSerialization.scala
@@ -278,7 +278,7 @@ object InstanceSerialization {
convertId.map(asJava(_)(format)).getOrElse {
jsonMap.map { t =>
(t._1 -> asJava(t._2)(format))
- }.toMap.asJava
+ }.asJava
}
}
}
@@ -305,7 +305,7 @@ object InstanceSerialization {
asJava(r.traitNames).asInstanceOf[java.util.List[String]],
asJava(r.traits).asInstanceOf[java.util.Map[String, IStruct]], s_attr)
}
- case l : List[_] => l.map(e => asJava(e)).toList.asJava
+ case l : List[_] => l.map(e => asJava(e)).asJava
case m : Map[_, _] if Try{m.asInstanceOf[Map[String,_]]}.isDefined => {
if (m.keys.size == 2 && m.keys.contains("value") && m.keys.contains("ordinal")) {
new EnumValue(m.get("value").toString, m.get("ordinal").asInstanceOf[BigInt].intValue())
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/test/java/org/apache/atlas/typesystem/json/SerializationJavaTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/json/SerializationJavaTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/json/SerializationJavaTest.java
index eb1a15a..5ee019c 100755
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/json/SerializationJavaTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/typesystem/json/SerializationJavaTest.java
@@ -74,7 +74,7 @@ public class SerializationJavaTest extends BaseTest {
new AttributeDefinition("department", "Department", Multiplicity.REQUIRED, false, "employees"),
new AttributeDefinition("manager", "Manager", Multiplicity.OPTIONAL, false, "subordinates"));
HierarchicalTypeDefinition<ClassType> managerTypeDef =
- createClassTypeDef("Manager", ImmutableSet.<String>of("Person"),
+ createClassTypeDef("Manager", ImmutableSet.of("Person"),
new AttributeDefinition("subordinates", String.format("array<%s>", "Person"),
Multiplicity.COLLECTION, false, "manager"));
@@ -98,9 +98,9 @@ public class SerializationJavaTest extends BaseTest {
john.set("manager", jane);
- hrDept.set("employees", ImmutableList.<Referenceable>of(john, jane));
+ hrDept.set("employees", ImmutableList.of(john, jane));
- jane.set("subordinates", ImmutableList.<Referenceable>of(john));
+ jane.set("subordinates", ImmutableList.of(john));
jane.getTrait("SecurityClearance").set("level", 1);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java
index e52962b..3a1675e 100755
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/typesystem/types/StructTest.java
@@ -19,7 +19,6 @@
package org.apache.atlas.typesystem.types;
import com.google.common.collect.ImmutableList;
-import com.sun.source.tree.AssertTree;
import org.apache.atlas.AtlasException;
import org.apache.atlas.typesystem.ITypedStruct;
import org.apache.atlas.typesystem.Struct;
@@ -29,7 +28,6 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
public class StructTest extends TypeUpdateBaseTest {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java
index 31bfb2c..7c39213 100755
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TraitTest.java
@@ -70,16 +70,16 @@ public class TraitTest extends HierarchicalTypeTest<TraitType> {
HierarchicalTypeDefinition A = createTraitTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE),
createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE), createOptionalAttrDef("c", DataTypes.BYTE_TYPE),
createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
- HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableSet.<String>of("A"),
+ HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableSet.of("A"),
createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
HierarchicalTypeDefinition C =
- createTraitTypeDef("C", ImmutableSet.<String>of("A"), createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
- HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableSet.<String>of("B", "C"),
+ createTraitTypeDef("C", ImmutableSet.of("A"), createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
+ HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableSet.of("B", "C"),
createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
defineTraits(A, B, C, D);
- TraitType DType = (TraitType) getTypeSystem().getDataType(TraitType.class, "D");
+ TraitType DType = getTypeSystem().getDataType(TraitType.class, "D");
// for(String aName : DType.fieldMapping().fields.keySet()) {
// System.out.println(String.format("nameToQualifiedName.put(\"%s\", \"%s\");", aName, DType
@@ -134,7 +134,7 @@ public class TraitTest extends HierarchicalTypeTest<TraitType> {
/*
* cast to B and set the 'b' attribute on A.
*/
- TraitType BType = (TraitType) getTypeSystem().getDataType(TraitType.class, "B");
+ TraitType BType = getTypeSystem().getDataType(TraitType.class, "B");
IStruct s2 = DType.castAs(ts, "B");
s2.set("A.B.b", false);
@@ -155,7 +155,7 @@ public class TraitTest extends HierarchicalTypeTest<TraitType> {
/*
* cast again to A and set the 'b' attribute on A.
*/
- TraitType AType = (TraitType) getTypeSystem().getDataType(TraitType.class, "A");
+ TraitType AType = getTypeSystem().getDataType(TraitType.class, "A");
IStruct s3 = BType.castAs(s2, "A");
s3.set("b", true);
Assert.assertEquals(ts.toString(), "{\n" +
@@ -178,16 +178,16 @@ public class TraitTest extends HierarchicalTypeTest<TraitType> {
HierarchicalTypeDefinition A = createTraitTypeDef("A", null, createRequiredAttrDef("a", DataTypes.INT_TYPE),
createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE), createOptionalAttrDef("c", DataTypes.BYTE_TYPE),
createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
- HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableSet.<String>of("A"),
+ HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableSet.of("A"),
createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
- HierarchicalTypeDefinition C = createTraitTypeDef("C", ImmutableSet.<String>of("A"),
+ HierarchicalTypeDefinition C = createTraitTypeDef("C", ImmutableSet.of("A"),
createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
- HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableSet.<String>of("B", "C"),
+ HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableSet.of("B", "C"),
createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
defineTraits(B, D, A, C);
- TraitType DType = (TraitType) getTypeSystem().getDataType(TraitType.class, "D");
+ TraitType DType = getTypeSystem().getDataType(TraitType.class, "D");
Struct s1 = new Struct("D");
s1.set("d", 1);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
index 96946ea..175ba7e 100755
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeSystemTest.java
@@ -188,18 +188,18 @@ public class TypeSystemTest extends BaseTest {
HierarchicalTypeDefinition<TraitType> trait_A = createTraitTypeDef("trait_A", null,
createRequiredAttrDef("t_A", DataTypes.STRING_TYPE));
- HierarchicalTypeDefinition<TraitType> trait_B = createTraitTypeDef("trait_B", ImmutableSet.<String>of("trait_A"),
+ HierarchicalTypeDefinition<TraitType> trait_B = createTraitTypeDef("trait_B", ImmutableSet.of("trait_A"),
createRequiredAttrDef("t_B", DataTypes.STRING_TYPE));
- HierarchicalTypeDefinition<TraitType> trait_C = createTraitTypeDef("trait_C", ImmutableSet.<String>of("trait_A"),
+ HierarchicalTypeDefinition<TraitType> trait_C = createTraitTypeDef("trait_C", ImmutableSet.of("trait_A"),
createRequiredAttrDef("t_C", DataTypes.STRING_TYPE));
- HierarchicalTypeDefinition<TraitType> trait_D = createTraitTypeDef("trait_D", ImmutableSet.<String>of("trait_B", "trait_C"),
+ HierarchicalTypeDefinition<TraitType> trait_D = createTraitTypeDef("trait_D", ImmutableSet.of("trait_B", "trait_C"),
createRequiredAttrDef("t_D", DataTypes.STRING_TYPE));
HierarchicalTypeDefinition<ClassType> class_A = createClassTypeDef("class_A", null,
createRequiredAttrDef("c_A", DataTypes.STRING_TYPE));
- HierarchicalTypeDefinition<ClassType> class_B = createClassTypeDef("class_B", ImmutableSet.<String>of("class_A"),
+ HierarchicalTypeDefinition<ClassType> class_B = createClassTypeDef("class_B", ImmutableSet.of("class_A"),
createRequiredAttrDef("c_B", DataTypes.STRING_TYPE));
- HierarchicalTypeDefinition<ClassType> class_C = createClassTypeDef("class_C", ImmutableSet.<String>of("class_B"),
+ HierarchicalTypeDefinition<ClassType> class_C = createClassTypeDef("class_C", ImmutableSet.of("class_B"),
createRequiredAttrDef("c_C", DataTypes.STRING_TYPE));
ts.defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.of(struct_A, struct_B),
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java
index 0748f8f..1a86cf3 100644
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/typesystem/types/ValidationTest.java
@@ -17,7 +17,6 @@
package org.apache.atlas.typesystem.types;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.apache.atlas.typesystem.types.utils.TypesUtil;
@@ -75,14 +74,12 @@ public class ValidationTest {
@Test(dataProvider = "classTypeData", expectedExceptions = {IllegalArgumentException.class})
public void testClassType(String name) {
AttributeDefinition value = TypesUtil.createRequiredAttrDef("name", "type");
- ;
TypesUtil.createClassTypeDef(name, ImmutableSet.of("super"), value);
}
@Test(dataProvider = "classTypeData", expectedExceptions = {IllegalArgumentException.class})
public void testTraitType(String name) {
AttributeDefinition value = TypesUtil.createRequiredAttrDef("name", "type");
- ;
TypesUtil.createTraitTypeDef(name, ImmutableSet.of("super"), value);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/typesystem/src/test/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCacheTest.java
----------------------------------------------------------------------
diff --git a/typesystem/src/test/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCacheTest.java b/typesystem/src/test/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCacheTest.java
index f885a6b..5c397dd 100644
--- a/typesystem/src/test/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCacheTest.java
+++ b/typesystem/src/test/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCacheTest.java
@@ -176,7 +176,7 @@ public class DefaultTypeCacheTest {
@Test
public void testCacheGetAllTypeNames() throws Exception {
- List<String> allTypeNames = new ArrayList<String>(cache.getAllTypeNames());
+ List<String> allTypeNames = new ArrayList<>(cache.getAllTypeNames());
Collections.sort(allTypeNames);
final int EXPECTED_TYPE_COUNT = 4;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java b/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java
index e746855..8f6613a 100644
--- a/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java
+++ b/webapp/src/main/java/org/apache/atlas/web/dao/UserDao.java
@@ -103,7 +103,7 @@ public class UserDao {
throw new AtlasAuthenticationException("User role credentials is not set properly for " + username );
}
- List<GrantedAuthority> grantedAuths = new ArrayList<GrantedAuthority>();
+ List<GrantedAuthority> grantedAuths = new ArrayList<>();
if (StringUtils.hasText(role)) {
grantedAuths.add(new SimpleGrantedAuthority(role));
} else {
@@ -129,8 +129,8 @@ public class UserDao {
byte[] hash = digest.digest(base.getBytes("UTF-8"));
StringBuffer hexString = new StringBuffer();
- for (int i = 0; i < hash.length; i++) {
- String hex = Integer.toHexString(0xff & hash[i]);
+ for (byte aHash : hash) {
+ String hex = Integer.toHexString(0xff & aHash);
if (hex.length() == 1) hexString.append('0');
hexString.append(hex);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java
index 1ff8000..ecc67a7 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/ActiveServerFilter.java
@@ -37,7 +37,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.HttpHeaders;
import java.io.IOException;
-import java.util.concurrent.atomic.AtomicBoolean;
/**
* A servlet {@link Filter} that redirects web requests from a passive Atlas server instance to an active one.
@@ -113,9 +112,8 @@ public class ActiveServerFilter implements Filter {
private void handleRedirect(HttpServletRequest servletRequest, HttpServletResponse httpServletResponse,
String activeServerAddress) throws IOException {
- HttpServletRequest httpServletRequest = servletRequest;
- String requestURI = httpServletRequest.getRequestURI();
- String queryString = httpServletRequest.getQueryString();
+ String requestURI = servletRequest.getRequestURI();
+ String queryString = servletRequest.getQueryString();
if ((queryString != null) && (!queryString.isEmpty())) {
requestURI += "?" + queryString;
}
@@ -127,7 +125,7 @@ public class ActiveServerFilter implements Filter {
LOG.info("Not active. Redirecting to {}", redirectLocation);
// A POST/PUT/DELETE require special handling by sending HTTP 307 instead of the regular 301/302.
// Reference: http://stackoverflow.com/questions/2068418/whats-the-difference-between-a-302-and-a-307-redirect
- if (isUnsafeHttpMethod(httpServletRequest)) {
+ if (isUnsafeHttpMethod(servletRequest)) {
httpServletResponse.setHeader(HttpHeaders.LOCATION, redirectLocation);
httpServletResponse.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT);
} else {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
index 3307015..b752810 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java
@@ -22,11 +22,9 @@ import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.RequestContext;
import org.apache.atlas.security.SecurityProperties;
import org.apache.atlas.utils.AuthenticationUtil;
-import org.apache.atlas.web.listeners.LoginProcessor;
import org.apache.atlas.web.util.Servlets;
import org.apache.commons.collections.iterators.IteratorEnumeration;
import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationConverter;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation;
@@ -110,7 +108,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
LOG.info("AtlasAuthenticationFilter initialization started");
final FilterConfig globalConf = filterConfig;
- final Map<String, String> params = new HashMap<String, String>();
+ final Map<String, String> params = new HashMap<>();
FilterConfig filterConfig1 = new FilterConfig() {
@Override
@@ -473,9 +471,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
if (isCookieSet) {
Collection<String> authUserName = response1.getHeaders("Set-Cookie");
if (authUserName != null) {
- Iterator<String> i = authUserName.iterator();
- while (i.hasNext()) {
- String cookie = i.next();
+ for (String cookie : authUserName) {
if (!StringUtils.isEmpty(cookie)) {
if (cookie.toLowerCase().startsWith(AuthenticatedURL.AUTH_COOKIE.toLowerCase()) && cookie.contains("u=")) {
String[] split = cookie.split(";");
@@ -571,7 +567,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
void parseBrowserUserAgents(String userAgents) {
String[] agentsArray = userAgents.split(",");
- browserUserAgents = new HashSet<Pattern>();
+ browserUserAgents = new HashSet<>();
for (String patternString : agentsArray) {
browserUserAgents.add(Pattern.compile(patternString));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java
index 5bd2bd7..26e6b1e 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthorizationFilter.java
@@ -99,7 +99,7 @@ public class AtlasAuthorizationFilter extends GenericFilterBean {
}
String userName = null;
- Set<String> groups = new HashSet<String>();
+ Set<String> groups = new HashSet<>();
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
@@ -166,7 +166,6 @@ public class AtlasAuthorizationFilter extends GenericFilterBean {
+ atlasResourceTypes + " : " + atlasRequest.getResource()
+ "\nReturning 403 since the access is blocked update!!!!");
}
- return;
}
} else {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
index 3cc83c5..2fe2dba 100644
--- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
+++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasCSRFPreventionFilter.java
@@ -19,6 +19,7 @@
package org.apache.atlas.web.filters;
import java.io.IOException;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
@@ -98,15 +99,13 @@ public class AtlasCSRFPreventionFilter implements Filter {
void parseMethodsToIgnore(String mti) {
String[] methods = mti.split(",");
- methodsToIgnore = new HashSet<String>();
- for (int i = 0; i < methods.length; i++) {
- methodsToIgnore.add(methods[i]);
- }
+ methodsToIgnore = new HashSet<>();
+ Collections.addAll(methodsToIgnore, methods);
}
void parseBrowserUserAgents(String userAgents) {
String[] agentsArray = userAgents.split(",");
- browserUserAgents = new HashSet<Pattern>();
+ browserUserAgents = new HashSet<>();
for (String patternString : agentsArray) {
browserUserAgents.add(Pattern.compile(patternString));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
index ec5d891..c20e978 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
@@ -151,10 +151,10 @@ public class AdminResource {
Boolean enableTaxonomy = null;
try {
PropertiesConfiguration configProperties = new PropertiesConfiguration("atlas-application.properties");
- enableTaxonomy = new Boolean(configProperties.getString(isTaxonomyEnabled, "false"));
+ enableTaxonomy = configProperties.getBoolean(isTaxonomyEnabled, false);
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String userName = null;
- Set<String> groups = new HashSet<String>();
+ Set<String> groups = new HashSet<>();
if (auth != null) {
userName = auth.getName();
Collection<? extends GrantedAuthority> authorities = auth.getAuthorities();
@@ -172,8 +172,7 @@ public class AdminResource {
responseData.put("userName", userName);
responseData.put("groups", groups);
- Response response = Response.ok(responseData).build();
- return response;
+ return Response.ok(responseData).build();
} catch (JSONException | ConfigurationException e) {
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/rest/module/RestModule.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/module/RestModule.java b/webapp/src/main/java/org/apache/atlas/web/rest/module/RestModule.java
deleted file mode 100644
index 62e1e57..0000000
--- a/webapp/src/main/java/org/apache/atlas/web/rest/module/RestModule.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.atlas.web.rest.module;
-
-import com.google.inject.AbstractModule;
-
-import org.apache.atlas.type.AtlasTypeRegistry;
-
-public class RestModule extends AbstractModule {
- @Override
- protected void configure() {
- bind(AtlasTypeRegistry.class).to(AtlasTypeRegistry.class).asEagerSingleton();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
index b99a30a..74bfb97 100644
--- a/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
+++ b/webapp/src/main/java/org/apache/atlas/web/security/AtlasAbstractAuthenticationProvider.java
@@ -55,9 +55,8 @@ public abstract class AtlasAbstractAuthenticationProvider implements
UsernamePasswordAuthenticationToken result = null;
if (authentication != null && authentication.isAuthenticated()) {
final List<GrantedAuthority> grantedAuths = getAuthorities(authentication
- .getName().toString());
- final UserDetails userDetails = new User(authentication.getName()
- .toString(), authentication.getCredentials().toString(),
+ .getName());
+ final UserDetails userDetails = new User(authentication.getName(), authentication.getCredentials().toString(),
grantedAuths);
result = new UsernamePasswordAuthenticationToken(userDetails,
authentication.getCredentials(), grantedAuths);
@@ -72,7 +71,7 @@ public abstract class AtlasAbstractAuthenticationProvider implements
*
*/
protected List<GrantedAuthority> getAuthorities(String username) {
- final List<GrantedAuthority> grantedAuths = new ArrayList<GrantedAuthority>();
+ final List<GrantedAuthority> grantedAuths = new ArrayList<>();
grantedAuths.add(new SimpleGrantedAuthority("DATA_SCIENTIST"));
return grantedAuths;
}
@@ -84,10 +83,9 @@ public abstract class AtlasAbstractAuthenticationProvider implements
if (authentication != null && authentication.isAuthenticated()) {
List<GrantedAuthority> grantedAuthsUGI = getAuthoritiesFromUGI(authentication
- .getName().toString());
+ .getName());
- final UserDetails userDetails = new User(authentication.getName()
- .toString(), authentication.getCredentials().toString(),
+ final UserDetails userDetails = new User(authentication.getName(), authentication.getCredentials().toString(),
grantedAuthsUGI);
result = new UsernamePasswordAuthenticationToken(userDetails,
authentication.getCredentials(), grantedAuthsUGI);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java b/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
index c57de84..50351f0 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/CuratorFactory.java
@@ -125,7 +125,7 @@ public class CuratorFactory {
getIdForLogging(acl.getId().getScheme(), acl.getId().getId()),
acl.getId().getScheme(), acl.getPerms());
LOG.info("Current logged in user: {}", getCurrentUser());
- final List<ACL> acls = Arrays.asList(new ACL[]{acl});
+ final List<ACL> acls = Arrays.asList(acl);
aclProvider = new ACLProvider() {
@Override
public List<ACL> getDefaultAcl() {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/service/UserService.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/service/UserService.java b/webapp/src/main/java/org/apache/atlas/web/service/UserService.java
index 33101e2..6e5c210 100644
--- a/webapp/src/main/java/org/apache/atlas/web/service/UserService.java
+++ b/webapp/src/main/java/org/apache/atlas/web/service/UserService.java
@@ -22,7 +22,6 @@ import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.apache.atlas.web.dao.UserDao;
-import org.apache.atlas.web.service.UserService;
import org.apache.atlas.web.model.User;
@Service
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
index b060def..65c88fe 100644
--- a/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
+++ b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
@@ -147,7 +147,7 @@ public class SetupSteps {
String serverId = getServerId(configuration);
ACL acl = AtlasZookeeperSecurityProperties.parseAcl(zookeeperProperties.getAcl(),
ZooDefs.Ids.OPEN_ACL_UNSAFE.get(0));
- List<ACL> acls = Arrays.asList(new ACL[]{acl});
+ List<ACL> acls = Arrays.asList(acl);
CuratorFramework client = curatorFactory.clientInstance();
try {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java b/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
index c2f89bd..01e4d48 100644
--- a/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
+++ b/webapp/src/test/java/org/apache/atlas/examples/QuickStartIT.java
@@ -18,7 +18,6 @@
package org.apache.atlas.examples;
-import org.apache.atlas.Atlas;
import org.apache.atlas.AtlasClient;
import org.apache.atlas.AtlasServiceException;
import org.apache.atlas.typesystem.Referenceable;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
index 961154b..e37839a 100644
--- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
+++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java
@@ -121,9 +121,7 @@ public class NotificationHookConsumerKafkaTest {
try {
hookConsumer.handleMessage(consumer.next());
- } catch (AtlasServiceException e) {
- Assert.fail("Consumer failed with exception ", e);
- } catch (AtlasException e) {
+ } catch (AtlasServiceException | AtlasException e) {
Assert.fail("Consumer failed with exception ", e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/filters/ActiveServerFilterTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/filters/ActiveServerFilterTest.java b/webapp/src/test/java/org/apache/atlas/web/filters/ActiveServerFilterTest.java
index b3ec8de..a8d1110 100644
--- a/webapp/src/test/java/org/apache/atlas/web/filters/ActiveServerFilterTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/filters/ActiveServerFilterTest.java
@@ -36,8 +36,6 @@ import java.io.IOException;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
public class ActiveServerFilterTest {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java b/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java
index f85892a..02a6fe4 100644
--- a/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java
@@ -133,13 +133,13 @@ public class AtlasAuthenticationKerberosFilterTest extends BaseSecurityTest {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof PasswordCallback) {
- PasswordCallback passwordCallback = (PasswordCallback) callbacks[i];
+ for (Callback callback : callbacks) {
+ if (callback instanceof PasswordCallback) {
+ PasswordCallback passwordCallback = (PasswordCallback) callback;
passwordCallback.setPassword(TESTPASS.toCharArray());
}
- if (callbacks[i] instanceof NameCallback) {
- NameCallback nameCallback = (NameCallback) callbacks[i];
+ if (callback instanceof NameCallback) {
+ NameCallback nameCallback = (NameCallback) callback;
nameCallback.setName(TESTUSER);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/listeners/LoginProcessorIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/listeners/LoginProcessorIT.java b/webapp/src/test/java/org/apache/atlas/web/listeners/LoginProcessorIT.java
index 42692cd..bb80738 100644
--- a/webapp/src/test/java/org/apache/atlas/web/listeners/LoginProcessorIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/listeners/LoginProcessorIT.java
@@ -17,7 +17,6 @@
package org.apache.atlas.web.listeners;
import org.apache.atlas.web.security.BaseSecurityTest;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java b/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java
index 88cfc63..da221fc 100644
--- a/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java
+++ b/webapp/src/test/java/org/apache/atlas/web/listeners/TestGuiceServletConfig.java
@@ -27,7 +27,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Module;
-import com.thinkaurelius.titan.core.util.TitanCleanup;
public class TestGuiceServletConfig extends GuiceServletConfig {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
index b5af111..22bcc02 100755
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityJerseyResourceIT.java
@@ -772,7 +772,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
private static class AtlasEntity {
String typeName;
- final Map<String, Object> values = new HashMap<String, Object>();
+ final Map<String, Object> values = new HashMap<>();
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java b/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
index 3f20453..e1734e4 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/TaxonomyServiceTest.java
@@ -18,7 +18,6 @@
package org.apache.atlas.web.resources;
-import org.apache.atlas.AtlasConstants;
import org.apache.atlas.AtlasException;
import org.apache.atlas.catalog.*;
import org.apache.atlas.services.MetadataService;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/security/BaseSecurityTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/security/BaseSecurityTest.java b/webapp/src/test/java/org/apache/atlas/web/security/BaseSecurityTest.java
index ff2cfc3..ad87025 100644
--- a/webapp/src/test/java/org/apache/atlas/web/security/BaseSecurityTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/security/BaseSecurityTest.java
@@ -41,7 +41,6 @@ import static org.apache.atlas.security.SecurityProperties.CERT_STORES_CREDENTIA
import static org.apache.atlas.security.SecurityProperties.KEYSTORE_FILE_KEY;
import static org.apache.atlas.security.SecurityProperties.TLS_ENABLED;
import static org.apache.atlas.security.SecurityProperties.TRUSTSTORE_FILE_KEY;
-import static org.apache.atlas.security.SecurityProperties.SSL_CLIENT_PROPERTIES;
import static org.apache.atlas.security.SecurityProperties.CLIENT_AUTH_KEY;
import static org.apache.atlas.security.SecurityProperties.SSL_CLIENT_PROPERTIES;
import org.apache.commons.io.FileUtils;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java b/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java
index 6823c83..49d56b2 100755
--- a/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java
@@ -72,7 +72,7 @@ public class SSLAndKerberosTest extends BaseSSLAndKerberosTest {
// client will actually only leverage subset of these properties
final PropertiesConfiguration configuration = getSSLConfiguration(providerUrl);
- persistSSLClientConfiguration((org.apache.commons.configuration.Configuration) configuration);
+ persistSSLClientConfiguration(configuration);
TestUtils.writeConfiguration(configuration, persistDir + File.separator +
ApplicationProperties.APPLICATION_PROPERTIES);
@@ -163,13 +163,13 @@ public class SSLAndKerberosTest extends BaseSSLAndKerberosTest {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof PasswordCallback) {
- PasswordCallback passwordCallback = (PasswordCallback) callbacks[i];
+ for (Callback callback : callbacks) {
+ if (callback instanceof PasswordCallback) {
+ PasswordCallback passwordCallback = (PasswordCallback) callback;
passwordCallback.setPassword(TESTPASS.toCharArray());
}
- if (callbacks[i] instanceof NameCallback) {
- NameCallback nameCallback = (NameCallback) callbacks[i];
+ if (callback instanceof NameCallback) {
+ NameCallback nameCallback = (NameCallback) callback;
nameCallback.setName(TESTUSER);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java
index 599e9cb..7ad2f76 100644
--- a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java
@@ -25,14 +25,11 @@ import org.apache.curator.framework.api.CreateBuilder;
import org.apache.curator.framework.api.ExistsBuilder;
import org.apache.curator.framework.api.GetDataBuilder;
import org.apache.curator.framework.api.SetDataBuilder;
-import org.apache.curator.framework.recipes.locks.InterProcessMutex;
-import org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Id;
import org.apache.zookeeper.data.Stat;
-import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeTest;
@@ -41,12 +38,10 @@ import scala.actors.threadpool.Arrays;
import java.nio.charset.Charset;
-import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
import static org.testng.Assert.assertNull;
public class ActiveInstanceStateTest {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java b/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
index 455f121..1ca8147 100755
--- a/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
+++ b/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
@@ -69,10 +69,7 @@ public class SecureEmbeddedServerTestBase {
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
- if (hostname.equals("localhost")) {
- return true;
- }
- return false;
+ return hostname.equals("localhost");
}
});
System.setProperty("javax.net.ssl.trustStore", DEFAULT_KEYSTORE_FILE_LOCATION);
[4/4] incubator-atlas git commit: ATLAS-1304: Redundant code removal
and code simplification
Posted by ma...@apache.org.
ATLAS-1304: Redundant code removal and code simplification
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/1620284e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/1620284e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/1620284e
Branch: refs/heads/master
Commit: 1620284e4c5d81a8722746d93fc32482bf41583a
Parents: f6e27b5
Author: apoorvnaik <an...@hortonworks.com>
Authored: Thu Dec 15 19:28:12 2016 -0800
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Thu Dec 15 19:30:16 2016 -0800
----------------------------------------------------------------------
.../apache/atlas/falcon/event/FalconEvent.java | 2 -
.../apache/atlas/falcon/hook/FalconHookIT.java | 2 +-
.../atlas/hive/bridge/HiveMetaStoreBridge.java | 2 +-
.../org/apache/atlas/hive/hook/HiveHook.java | 44 +++++-----
.../atlas/hive/rewrite/RewriteException.java | 2 -
.../java/org/apache/atlas/hive/HiveITBase.java | 4 +-
.../hive/bridge/HiveMetaStoreBridgeTest.java | 2 +-
.../org/apache/atlas/hive/hook/HiveHookIT.java | 20 ++---
.../atlas/storm/hook/StormTopologyUtil.java | 10 +--
.../atlas/authorize/AtlasActionTypes.java | 2 +-
.../apache/atlas/authorize/AtlasAuthorizer.java | 6 +-
.../atlas/authorize/AtlasResourceTypes.java | 2 +-
.../simple/AtlasAuthorizationUtils.java | 2 +-
.../atlas/authorize/simple/FileReaderUtil.java | 2 +-
.../atlas/authorize/simple/PolicyParser.java | 14 ++--
.../atlas/authorize/simple/PolicyUtil.java | 6 +-
.../authorize/simple/SimpleAtlasAuthorizer.java | 26 +++---
.../authorize/simple/PolicyParserTest.java | 58 ++++++-------
.../atlas/authorize/simple/PolicyUtilTest.java | 24 +++---
.../simple/SimpleAtlasAuthorizerTest.java | 24 +++---
.../atlas/catalog/BaseResourceProvider.java | 2 -
.../apache/atlas/catalog/DefaultTypeSystem.java | 10 +--
.../apache/atlas/catalog/TermVertexWrapper.java | 4 -
.../definition/TaxonomyResourceDefinition.java | 1 -
.../atlas/catalog/query/QueryExpression.java | 2 +-
.../catalog/EntityTagResourceProviderTest.java | 2 -
.../java/org/apache/atlas/AtlasAdminClient.java | 4 +-
.../atlas/security/SecureClientUtils.java | 7 +-
.../java/org/apache/atlas/AtlasClientTest.java | 3 +-
.../atlas/groovy/FunctionCallExpression.java | 2 +-
.../security/InMemoryJAASConfiguration.java | 38 +++++----
.../apache/atlas/utils/AuthenticationUtil.java | 8 +-
.../org/apache/atlas/utils/PropertiesUtil.java | 4 +-
.../public/js/views/tag/addTagModalView.js | 4 +-
.../repository/graphdb/AtlasGraphQuery.java | 2 +-
.../repository/graphdb/AtlasIndexQuery.java | 2 +-
.../titan/query/NativeTitanGraphQuery.java | 2 +-
.../graphdb/titan/query/TitanGraphQuery.java | 2 +-
.../graphdb/titan/query/expr/InPredicate.java | 4 +-
.../graphdb/titan/query/expr/OrCondition.java | 4 +-
.../titan/diskstorage/hbase/HBaseCompat.java | 4 +-
.../diskstorage/hbase/HBaseCompatLoader.java | 6 +-
.../hbase/HBaseKeyColumnValueStore.java | 9 +--
.../diskstorage/hbase/HBaseStoreManager.java | 85 ++++++++++----------
.../diskstorage/locking/LocalLockMediator.java | 24 +++---
.../titan/diskstorage/solr/Solr5Index.java | 68 +++++++---------
.../query/graph/GraphCentricQueryBuilder.java | 35 ++++----
.../repository/graphdb/titan0/Titan0Graph.java | 6 +-
.../graphdb/titan0/Titan0GraphIndex.java | 2 +-
.../repository/graphdb/titan0/Titan0Vertex.java | 2 +-
.../titan0/query/NativeTitan0GraphQuery.java | 2 +-
.../locking/LocalLockMediatorTest.java | 4 +-
.../graphdb/titan0/GraphQueryTest.java | 2 +-
.../graphdb/titan0/Titan0DatabaseTest.java | 26 ++----
.../org/apache/atlas/model/SearchFilter.java | 2 +-
.../atlas/model/instance/AtlasEntity.java | 2 +-
.../atlas/model/instance/AtlasEntityHeader.java | 1 -
.../instance/AtlasEntityWithAssociations.java | 1 -
.../atlas/model/instance/AtlasStruct.java | 8 +-
.../model/instance/EntityMutationResponse.java | 3 +-
.../atlas/model/instance/EntityMutations.java | 1 -
.../atlas/model/typedef/AtlasBaseTypeDef.java | 13 ++-
.../model/typedef/AtlasClassificationDef.java | 8 +-
.../atlas/model/typedef/AtlasEntityDef.java | 8 +-
.../atlas/model/typedef/AtlasEnumDef.java | 10 +--
.../atlas/model/typedef/AtlasStructDef.java | 18 ++---
.../org/apache/atlas/type/AtlasArrayType.java | 10 +--
.../apache/atlas/type/AtlasBuiltInTypes.java | 12 +--
.../atlas/type/AtlasClassificationType.java | 5 +-
.../org/apache/atlas/type/AtlasEntityType.java | 5 +-
.../org/apache/atlas/type/AtlasEnumType.java | 3 +-
.../org/apache/atlas/type/AtlasMapType.java | 4 +-
.../org/apache/atlas/type/AtlasStructType.java | 23 +++---
.../apache/atlas/type/AtlasTypeRegistry.java | 24 +++---
.../org/apache/atlas/type/AtlasTypeUtil.java | 4 +-
.../test/java/org/apache/atlas/TestUtilsV2.java | 2 +-
.../org/apache/atlas/model/ModelTestUtil.java | 32 ++++----
.../atlas/model/typedef/TestAtlasEntityDef.java | 2 +-
.../atlas/model/typedef/TestAtlasEnumDef.java | 2 +-
.../apache/atlas/type/TestAtlasArrayType.java | 14 ++--
.../atlas/type/TestAtlasBigDecimalType.java | 2 +-
.../atlas/type/TestAtlasBigIntegerType.java | 2 +-
.../apache/atlas/type/TestAtlasBooleanType.java | 2 +-
.../apache/atlas/type/TestAtlasByteType.java | 2 +-
.../atlas/type/TestAtlasClassificationType.java | 8 +-
.../apache/atlas/type/TestAtlasDateType.java | 2 +-
.../apache/atlas/type/TestAtlasDoubleType.java | 2 +-
.../apache/atlas/type/TestAtlasEntityType.java | 8 +-
.../apache/atlas/type/TestAtlasFloatType.java | 2 +-
.../org/apache/atlas/type/TestAtlasIntType.java | 2 +-
.../apache/atlas/type/TestAtlasLongType.java | 2 +-
.../org/apache/atlas/type/TestAtlasMapType.java | 18 ++---
.../atlas/type/TestAtlasObjectIdType.java | 12 +--
.../apache/atlas/type/TestAtlasShortType.java | 2 +-
.../apache/atlas/type/TestAtlasStringType.java | 2 +-
.../apache/atlas/type/TestAtlasStructType.java | 8 +-
.../apache/atlas/kafka/KafkaNotification.java | 2 +-
.../classloader/AtlasPluginClassLoaderUtil.java | 2 +-
release-log.txt | 1 +
.../apache/atlas/RepositoryMetadataModule.java | 4 +-
.../atlas/discovery/DataSetLineageService.java | 8 +-
.../graph/GraphBackedDiscoveryService.java | 1 -
.../gremlin/Gremlin2ExpressionFactory.java | 3 +-
.../gremlin/Gremlin3ExpressionFactory.java | 3 +-
.../repository/graph/AtlasGraphProvider.java | 4 +-
.../atlas/repository/graph/DeleteHandler.java | 7 +-
.../atlas/repository/graph/EntityProcessor.java | 2 +-
.../graph/GraphBackedMetadataRepository.java | 2 -
.../graph/GraphBackedSearchIndexer.java | 2 +-
.../atlas/repository/graph/GraphHelper.java | 7 +-
.../graph/GraphSchemaInitializer.java | 3 -
.../graph/GraphToTypedInstanceMapper.java | 4 +-
.../repository/memory/AttributeStores.java | 6 +-
.../atlas/repository/memory/ClassStore.java | 10 +--
.../memory/HierarchicalTypeStore.java | 8 +-
.../atlas/repository/memory/MemRepository.java | 10 +--
.../memory/ReplaceIdWithInstance.java | 40 +++++----
.../store/graph/AtlasEntityDefStore.java | 1 -
.../store/graph/v1/AtlasEnumDefStoreV1.java | 1 -
.../store/graph/v1/AtlasGraphUtilsV1.java | 2 +-
.../graph/v1/AtlasTypeDefGraphStoreV1.java | 34 +++-----
.../typestore/GraphBackedTypeStore.java | 4 +-
.../atlas/services/DefaultMetadataService.java | 7 +-
.../util/AtlasRepositoryConfiguration.java | 1 -
.../org/apache/atlas/util/TypeDefSorter.java | 3 -
.../GraphBackedDiscoveryServiceTest.java | 10 +--
.../audit/AuditRepositoryTestBase.java | 1 -
.../repository/graph/GraphHelperMockTest.java | 10 +--
.../typestore/GraphBackedTypeStoreTest.java | 6 +-
.../service/DefaultMetadataServiceTest.java | 4 +-
.../persistence/ReferenceableInstance.java | 2 +-
.../typesystem/persistence/StructInstance.java | 14 ++--
.../atlas/typesystem/types/AttributeInfo.java | 2 +-
.../atlas/typesystem/types/ClassType.java | 2 +-
.../atlas/typesystem/types/DataTypes.java | 14 ++--
.../typesystem/types/HierarchicalType.java | 42 ++++------
.../typesystem/types/ObjectGraphTraversal.java | 4 +-
.../typesystem/types/ObjectGraphWalker.java | 4 +-
.../atlas/typesystem/types/StructType.java | 6 +-
.../typesystem/types/TypedStructHandler.java | 5 +-
.../atlas/typesystem/types/cache/TypeCache.java | 4 +-
.../typesystem/builders/InstanceBuilder.scala | 2 +-
.../typesystem/builders/TypesBuilder.scala | 8 +-
.../typesystem/json/InstanceSerialization.scala | 4 +-
.../typesystem/json/SerializationJavaTest.java | 6 +-
.../atlas/typesystem/types/StructTest.java | 2 -
.../atlas/typesystem/types/TraitTest.java | 20 ++---
.../atlas/typesystem/types/TypeSystemTest.java | 10 +--
.../atlas/typesystem/types/ValidationTest.java | 3 -
.../types/cache/DefaultTypeCacheTest.java | 2 +-
.../java/org/apache/atlas/web/dao/UserDao.java | 6 +-
.../atlas/web/filters/ActiveServerFilter.java | 8 +-
.../web/filters/AtlasAuthenticationFilter.java | 10 +--
.../web/filters/AtlasAuthorizationFilter.java | 3 +-
.../web/filters/AtlasCSRFPreventionFilter.java | 9 +--
.../atlas/web/resources/AdminResource.java | 7 +-
.../atlas/web/rest/module/RestModule.java | 29 -------
.../AtlasAbstractAuthenticationProvider.java | 12 ++-
.../atlas/web/service/CuratorFactory.java | 2 +-
.../apache/atlas/web/service/UserService.java | 1 -
.../org/apache/atlas/web/setup/SetupSteps.java | 2 +-
.../org/apache/atlas/examples/QuickStartIT.java | 1 -
.../NotificationHookConsumerKafkaTest.java | 4 +-
.../web/filters/ActiveServerFilterTest.java | 2 -
.../AtlasAuthenticationKerberosFilterTest.java | 10 +--
.../atlas/web/listeners/LoginProcessorIT.java | 1 -
.../web/listeners/TestGuiceServletConfig.java | 1 -
.../web/resources/EntityJerseyResourceIT.java | 2 +-
.../web/resources/TaxonomyServiceTest.java | 1 -
.../atlas/web/security/BaseSecurityTest.java | 1 -
.../atlas/web/security/SSLAndKerberosTest.java | 12 +--
.../web/service/ActiveInstanceStateTest.java | 5 --
.../service/SecureEmbeddedServerTestBase.java | 5 +-
173 files changed, 619 insertions(+), 813 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/event/FalconEvent.java
----------------------------------------------------------------------
diff --git a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/event/FalconEvent.java b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/event/FalconEvent.java
index 0b918ba..51db894 100644
--- a/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/event/FalconEvent.java
+++ b/addons/falcon-bridge/src/main/java/org/apache/atlas/falcon/event/FalconEvent.java
@@ -20,8 +20,6 @@ package org.apache.atlas.falcon.event;
import org.apache.falcon.entity.v0.Entity;
-import java.util.Date;
-
/**
* Falcon event to interface with Atlas Service.
*/
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java
----------------------------------------------------------------------
diff --git a/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java b/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java
index 8d0a47a..2acc575 100644
--- a/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java
+++ b/addons/falcon-bridge/src/test/java/org/apache/atlas/falcon/hook/FalconHookIT.java
@@ -178,7 +178,7 @@ public class FalconHookIT {
String inputId = ((List<Id>) processEntity.get("inputs")).get(0).getId()._getId();
Referenceable pathEntity = atlasClient.getEntity(inputId);
- assertEquals(pathEntity.getTypeName(), HiveMetaStoreBridge.HDFS_PATH.toString());
+ assertEquals(pathEntity.getTypeName(), HiveMetaStoreBridge.HDFS_PATH);
List<Location> locations = FeedHelper.getLocations(feedCluster, feed);
Location dataLocation = FileSystemStorage.getLocation(locations, LocationType.DATA);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
index cbc51cc..0f8afd5 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
@@ -575,7 +575,7 @@ public class HiveMetaStoreBridge {
}
public Referenceable fillHDFSDataSet(String pathUri) {
- Referenceable ref = new Referenceable(HDFS_PATH.toString());
+ Referenceable ref = new Referenceable(HDFS_PATH);
ref.set("path", pathUri);
Path path = new Path(pathUri);
ref.set(AtlasClient.NAME, Path.getPathWithoutSchemeAndAuthority(path).toString().toLowerCase());
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
index cf8851c..143241f 100755
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/hook/HiveHook.java
@@ -37,12 +37,7 @@ import org.apache.hadoop.hive.metastore.TableType;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.ql.hooks.*;
-import org.apache.hadoop.hive.ql.hooks.Entity;
import org.apache.hadoop.hive.ql.hooks.Entity.Type;
-import org.apache.hadoop.hive.ql.hooks.ExecuteWithHookContext;
-import org.apache.hadoop.hive.ql.hooks.HookContext;
-import org.apache.hadoop.hive.ql.hooks.ReadEntity;
-import org.apache.hadoop.hive.ql.hooks.WriteEntity;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.metadata.Partition;
import org.apache.hadoop.hive.ql.metadata.Table;
@@ -360,16 +355,16 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
String changedColStringOldName = oldColList.get(0).getName();
String changedColStringNewName = changedColStringOldName;
- for (int i = 0; i < oldColList.size(); i++) {
- if (!newColHashMap.containsKey(oldColList.get(i))) {
- changedColStringOldName = oldColList.get(i).getName();
+ for (FieldSchema oldCol : oldColList) {
+ if (!newColHashMap.containsKey(oldCol)) {
+ changedColStringOldName = oldCol.getName();
break;
}
}
- for (int i = 0; i < newColList.size(); i++) {
- if (!oldColHashMap.containsKey(newColList.get(i))) {
- changedColStringNewName = newColList.get(i).getName();
+ for (FieldSchema newCol : newColList) {
+ if (!oldColHashMap.containsKey(newCol)) {
+ changedColStringNewName = newCol.getName();
break;
}
}
@@ -395,7 +390,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
if (writeEntity.getType() == Type.TABLE) {
Table newTable = writeEntity.getTable();
createOrUpdateEntities(dgiBridge, event, writeEntity, true, oldTable);
- final String newQualifiedTableName = dgiBridge.getTableQualifiedName(dgiBridge.getClusterName(),
+ final String newQualifiedTableName = HiveMetaStoreBridge.getTableQualifiedName(dgiBridge.getClusterName(),
newTable);
String oldColumnQFName = HiveMetaStoreBridge.getColumnQualifiedName(newQualifiedTableName, oldColName);
String newColumnQFName = HiveMetaStoreBridge.getColumnQualifiedName(newQualifiedTableName, newColName);
@@ -424,9 +419,9 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
Table newTable = writeEntity.getTable();
//Hive sends with both old and new table names in the outputs which is weird. So skipping that with the below check
if (!newTable.getDbName().equals(oldTable.getDbName()) || !newTable.getTableName().equals(oldTable.getTableName())) {
- final String oldQualifiedName = dgiBridge.getTableQualifiedName(dgiBridge.getClusterName(),
+ final String oldQualifiedName = HiveMetaStoreBridge.getTableQualifiedName(dgiBridge.getClusterName(),
oldTable);
- final String newQualifiedName = dgiBridge.getTableQualifiedName(dgiBridge.getClusterName(),
+ final String newQualifiedName = HiveMetaStoreBridge.getTableQualifiedName(dgiBridge.getClusterName(),
newTable);
//Create/update old table entity - create entity with oldQFNme and old tableName if it doesnt exist. If exists, will update
@@ -624,7 +619,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
// filter out select queries which do not modify data
if (!isSelectQuery) {
- SortedSet<ReadEntity> sortedHiveInputs = new TreeSet<>(entityComparator);;
+ SortedSet<ReadEntity> sortedHiveInputs = new TreeSet<>(entityComparator);
if ( event.getInputs() != null) {
sortedHiveInputs.addAll(event.getInputs());
}
@@ -671,7 +666,7 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
private <T extends Entity> void processHiveEntity(HiveMetaStoreBridge dgiBridge, HiveEventContext event, T entity, Set<String> dataSetsProcessed,
SortedMap<T, Referenceable> dataSets, Set<Referenceable> entities) throws Exception {
if (entity.getType() == Type.TABLE || entity.getType() == Type.PARTITION) {
- final String tblQFName = dgiBridge.getTableQualifiedName(dgiBridge.getClusterName(), entity.getTable());
+ final String tblQFName = HiveMetaStoreBridge.getTableQualifiedName(dgiBridge.getClusterName(), entity.getTable());
if (!dataSetsProcessed.contains(tblQFName)) {
LinkedHashMap<Type, Referenceable> result = createOrUpdateEntities(dgiBridge, event, entity, false);
dataSets.put(entity, result.get(Type.TABLE));
@@ -754,14 +749,11 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
}
private static boolean isCreateOp(HiveEventContext hiveEvent) {
- if (HiveOperation.CREATETABLE.equals(hiveEvent.getOperation())
- || HiveOperation.CREATEVIEW.equals(hiveEvent.getOperation())
- || HiveOperation.ALTERVIEW_AS.equals(hiveEvent.getOperation())
- || HiveOperation.ALTERTABLE_LOCATION.equals(hiveEvent.getOperation())
- || HiveOperation.CREATETABLE_AS_SELECT.equals(hiveEvent.getOperation())) {
- return true;
- }
- return false;
+ return HiveOperation.CREATETABLE.equals(hiveEvent.getOperation())
+ || HiveOperation.CREATEVIEW.equals(hiveEvent.getOperation())
+ || HiveOperation.ALTERVIEW_AS.equals(hiveEvent.getOperation())
+ || HiveOperation.ALTERTABLE_LOCATION.equals(hiveEvent.getOperation())
+ || HiveOperation.CREATETABLE_AS_SELECT.equals(hiveEvent.getOperation());
}
private Referenceable getProcessReferenceable(HiveMetaStoreBridge dgiBridge, HiveEventContext hiveEvent,
@@ -973,8 +965,8 @@ public class HiveHook extends AtlasHook implements ExecuteWithHookContext {
}
private static boolean addQueryType(HiveOperation op, WriteEntity entity) {
- if (((WriteEntity) entity).getWriteType() != null && HiveOperation.QUERY.equals(op)) {
- switch (((WriteEntity) entity).getWriteType()) {
+ if (entity.getWriteType() != null && HiveOperation.QUERY.equals(op)) {
+ switch (entity.getWriteType()) {
case INSERT:
case INSERT_OVERWRITE:
case UPDATE:
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/hive-bridge/src/main/java/org/apache/atlas/hive/rewrite/RewriteException.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/rewrite/RewriteException.java b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/rewrite/RewriteException.java
index 79a1afe..c87bf6b 100644
--- a/addons/hive-bridge/src/main/java/org/apache/atlas/hive/rewrite/RewriteException.java
+++ b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/rewrite/RewriteException.java
@@ -17,8 +17,6 @@
*/
package org.apache.atlas.hive.rewrite;
-import org.apache.hadoop.hive.ql.parse.ParseException;
-
public class RewriteException extends Exception {
public RewriteException(final String message, final Exception exception) {
super(message, exception);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java
index 5abf2df..4b736a8 100644
--- a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java
+++ b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/HiveITBase.java
@@ -215,8 +215,8 @@ public class HiveITBase {
protected void validateHDFSPaths(Referenceable processReference, String attributeName, String... testPaths) throws Exception {
List<Id> hdfsPathRefs = (List<Id>) processReference.get(attributeName);
- for (int i = 0; i < testPaths.length; i++) {
- final Path path = new Path(testPaths[i]);
+ for (String testPath : testPaths) {
+ final Path path = new Path(testPath);
final String testPathNormed = lower(path.toString());
String hdfsPathId = assertHDFSPathIsRegistered(testPathNormed);
Assert.assertEquals(hdfsPathRefs.get(0)._getId(), hdfsPathId);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/hive-bridge/src/test/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridgeTest.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridgeTest.java b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridgeTest.java
index 0cba27e..0256cf3 100644
--- a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridgeTest.java
+++ b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridgeTest.java
@@ -208,7 +208,7 @@ public class HiveMetaStoreBridgeTest {
when(atlasClient.getEntity("82e06b34-9151-4023-aa9d-b82103a50e77")).thenReturn(createTableReference());
String processQualifiedName = HiveMetaStoreBridge.getTableQualifiedName(CLUSTER_NAME, hiveTables.get(1));
when(atlasClient.getEntity(HiveDataTypes.HIVE_PROCESS.getName(), AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
- processQualifiedName)).thenReturn(getEntityReference(HiveDataTypes.HIVE_PROCESS.getName(), "82e06b34-9151-4023-aa9d-b82103a50e77"));;
+ processQualifiedName)).thenReturn(getEntityReference(HiveDataTypes.HIVE_PROCESS.getName(), "82e06b34-9151-4023-aa9d-b82103a50e77"));
HiveMetaStoreBridge bridge = new HiveMetaStoreBridge(CLUSTER_NAME, hiveClient, atlasClient);
try {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
----------------------------------------------------------------------
diff --git a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
index 23a13ea..e5bd65a 100755
--- a/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
+++ b/addons/hive-bridge/src/test/java/org/apache/atlas/hive/hook/HiveHookIT.java
@@ -533,7 +533,7 @@ public class HiveHookIT extends HiveITBase {
Referenceable processRef1 = validateProcess(event, expectedInputs, outputs);
//Test sorting of tbl names
- SortedSet<String> sortedTblNames = new TreeSet<String>();
+ SortedSet<String> sortedTblNames = new TreeSet<>();
sortedTblNames.add(inputTable1Name.toLowerCase());
sortedTblNames.add(inputTable2Name.toLowerCase());
@@ -584,13 +584,13 @@ public class HiveHookIT extends HiveITBase {
Set<ReadEntity> inputs = getInputs(tableName, Entity.Type.TABLE);
final Set<WriteEntity> outputs = getOutputs(pFile1, Entity.Type.DFS_DIR);
- ((WriteEntity)outputs.iterator().next()).setWriteType(WriteEntity.WriteType.PATH_WRITE);
+ outputs.iterator().next().setWriteType(WriteEntity.WriteType.PATH_WRITE);
final HiveHook.HiveEventContext hiveEventContext = constructEvent(query, HiveOperation.QUERY, inputs, outputs);
Referenceable processReference = validateProcess(hiveEventContext);
validateHDFSPaths(processReference, OUTPUTS, pFile1);
- String tableId = assertTableIsRegistered(DEFAULT_DB, tableName);
+ assertTableIsRegistered(DEFAULT_DB, tableName);
validateInputTables(processReference, inputs);
//Rerun same query with same HDFS path
@@ -630,7 +630,7 @@ public class HiveHookIT extends HiveITBase {
Set<ReadEntity> inputs = getInputs(tableName, Entity.Type.TABLE);
final Set<WriteEntity> outputs = getOutputs(pFile1, Entity.Type.DFS_DIR);
- ((WriteEntity)outputs.iterator().next()).setWriteType(WriteEntity.WriteType.PATH_WRITE);
+ outputs.iterator().next().setWriteType(WriteEntity.WriteType.PATH_WRITE);
final Set<ReadEntity> partitionIps = new LinkedHashSet<>(inputs);
partitionIps.addAll(getInputs(DEFAULT_DB + "@" + tableName + "@dt='" + PART_FILE + "'", Entity.Type.PARTITION));
@@ -646,7 +646,7 @@ public class HiveHookIT extends HiveITBase {
runCommand(query);
final Set<WriteEntity> pFile2Outputs = getOutputs(pFile2, Entity.Type.DFS_DIR);
- ((WriteEntity)pFile2Outputs.iterator().next()).setWriteType(WriteEntity.WriteType.PATH_WRITE);
+ pFile2Outputs.iterator().next().setWriteType(WriteEntity.WriteType.PATH_WRITE);
//Now the process has 2 paths - one older with deleted reference to partition and another with the the latest partition
Set<WriteEntity> p2Outputs = new LinkedHashSet<WriteEntity>() {{
addAll(pFile2Outputs);
@@ -676,7 +676,7 @@ public class HiveHookIT extends HiveITBase {
Set<ReadEntity> inputs = getInputs(tableName, Entity.Type.TABLE);
Set<WriteEntity> outputs = getOutputs(insertTableName, Entity.Type.TABLE);
outputs.iterator().next().setName(getQualifiedTblName(insertTableName + HiveMetaStoreBridge.TEMP_TABLE_PREFIX + SessionState.get().getSessionId()));
- ((WriteEntity)outputs.iterator().next()).setWriteType(WriteEntity.WriteType.INSERT);
+ outputs.iterator().next().setWriteType(WriteEntity.WriteType.INSERT);
validateProcess(constructEvent(query, HiveOperation.QUERY, inputs, outputs));
@@ -696,7 +696,7 @@ public class HiveHookIT extends HiveITBase {
final Set<ReadEntity> inputs = getInputs(tableName, Entity.Type.TABLE);
final Set<WriteEntity> outputs = getOutputs(insertTableName, Entity.Type.TABLE);
- ((WriteEntity)outputs.iterator().next()).setWriteType(WriteEntity.WriteType.INSERT);
+ outputs.iterator().next().setWriteType(WriteEntity.WriteType.INSERT);
final Set<ReadEntity> partitionIps = new LinkedHashSet<ReadEntity>() {
{
@@ -1673,7 +1673,7 @@ public class HiveHookIT extends HiveITBase {
private void verifyProperties(Struct referenceable, Map<String, String> expectedProps, boolean checkIfNotExists) {
Map<String, String> parameters = (Map<String, String>) referenceable.get(HiveMetaStoreBridge.PARAMETERS);
- if (checkIfNotExists == false) {
+ if (!checkIfNotExists) {
//Check if properties exist
Assert.assertNotNull(parameters);
for (String propKey : expectedProps.keySet()) {
@@ -1745,11 +1745,11 @@ public class HiveHookIT extends HiveITBase {
}
private String getDSTypeName(Entity entity) {
- return Entity.Type.TABLE.equals(entity.getType()) ? HiveDataTypes.HIVE_TABLE.name() : HiveMetaStoreBridge.HDFS_PATH.toString();
+ return Entity.Type.TABLE.equals(entity.getType()) ? HiveDataTypes.HIVE_TABLE.name() : HiveMetaStoreBridge.HDFS_PATH;
}
private <T extends Entity> SortedMap<T, Referenceable> getSortedProcessDataSets(Set<T> inputTbls) {
- SortedMap<T, Referenceable> inputs = new TreeMap<T, Referenceable>(entityComparator);
+ SortedMap<T, Referenceable> inputs = new TreeMap<>(entityComparator);
if (inputTbls != null) {
for (final T tbl : inputTbls) {
Referenceable inputTableRef = new Referenceable(getDSTypeName(tbl), new HashMap<String, Object>() {{
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
----------------------------------------------------------------------
diff --git a/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormTopologyUtil.java b/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
index edd95ba..d646fba 100644
--- a/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
+++ b/addons/storm-bridge/src/main/java/org/apache/atlas/storm/hook/StormTopologyUtil.java
@@ -18,6 +18,7 @@
package org.apache.atlas.storm.hook;
+import org.apache.commons.lang.StringUtils;
import org.apache.storm.generated.Bolt;
import org.apache.storm.generated.GlobalStreamId;
import org.apache.storm.generated.Grouping;
@@ -82,8 +83,7 @@ public final class StormTopologyUtil {
components.add(boltName);
components = removeSystemComponent ? removeSystemComponents(components)
: components;
- if ((removeSystemComponent && !isSystemComponent(inputComponentId)) ||
- !removeSystemComponent) {
+ if (!removeSystemComponent || !isSystemComponent(inputComponentId)) {
adjacencyMap.put(inputComponentId, components);
}
}
@@ -132,7 +132,7 @@ public final class StormTopologyUtil {
Set<Object> objectsToSkip)
throws IllegalAccessException {
if (objectsToSkip == null) {
- objectsToSkip = new HashSet<Object>();
+ objectsToSkip = new HashSet<>();
}
Map<String, String> output = new HashMap<>();
@@ -175,9 +175,7 @@ public final class StormTopologyUtil {
String keyStr = getString(mapKey, false, objectsToSkip);
String valStr = getString(mapVal, false, objectsToSkip);
- if ((valStr == null) || (valStr.isEmpty())) {
- continue;
- } else {
+ if (StringUtils.isNotEmpty(valStr)) {
output.put(String.format("%s.%s", key, keyStr), valStr);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/AtlasActionTypes.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasActionTypes.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasActionTypes.java
index b42162f..c5969db 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasActionTypes.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasActionTypes.java
@@ -18,5 +18,5 @@
package org.apache.atlas.authorize;
public enum AtlasActionTypes {
- READ, CREATE, UPDATE, DELETE;
+ READ, CREATE, UPDATE, DELETE
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizer.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizer.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizer.java
index 9c50a04..d64c692 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizer.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasAuthorizer.java
@@ -25,18 +25,18 @@ public interface AtlasAuthorizer {
/**
* This method will load the policy file and would initialize the required data-structures.
*/
- public void init();
+ void init();
/**
* This method is responsible to perform the actual authorization for every REST API call. It will check if
* user can perform action on resource.
*/
- public boolean isAccessAllowed(AtlasAccessRequest request) throws AtlasAuthorizationException;
+ boolean isAccessAllowed(AtlasAccessRequest request) throws AtlasAuthorizationException;
/**
* This method is responsible to perform the cleanup and release activities. It must be called when you are done
* with the Authorization activity and once it's called a restart would be required. Try to invoke this while
* destroying the context.
*/
- public void cleanUp();
+ void cleanUp();
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java b/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java
index e34c740..deccf84 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/AtlasResourceTypes.java
@@ -19,5 +19,5 @@
package org.apache.atlas.authorize;
public enum AtlasResourceTypes {
- UNKNOWN, ENTITY, TYPE, OPERATION, TAXONOMY, TERM;
+ UNKNOWN, ENTITY, TYPE, OPERATION, TAXONOMY, TERM
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
index e48c5ae..2ef4ea2 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
@@ -103,7 +103,7 @@ public class AtlasAuthorizationUtils {
* unprotected types are mapped with AtlasResourceTypes.UNKNOWN, access to these are allowed.
*/
public static Set<AtlasResourceTypes> getAtlasResourceType(String contextPath) {
- Set<AtlasResourceTypes> resourceTypes = new HashSet<AtlasResourceTypes>();
+ Set<AtlasResourceTypes> resourceTypes = new HashSet<>();
if (isDebugEnabled) {
LOG.debug("==> getAtlasResourceType for " + contextPath);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
index 6836249..9d9caa9 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/FileReaderUtil.java
@@ -36,7 +36,7 @@ public class FileReaderUtil {
if (isDebugEnabled) {
LOG.debug("==> FileReaderUtil readFile");
}
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
LOG.info("reading the file" + path);
List<String> fileLines = Files.readAllLines(Paths.get(path), Charset.forName("UTF-8"));
if (fileLines != null) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java
index 2a6929a..5740a1c 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyParser.java
@@ -51,7 +51,7 @@ public class PolicyParser {
if (isDebugEnabled) {
LOG.debug("==> PolicyParser getListOfAutorities");
}
- List<AtlasActionTypes> authorities = new ArrayList<AtlasActionTypes>();
+ List<AtlasActionTypes> authorities = new ArrayList<>();
for (int i = 0; i < auth.length(); i++) {
char access = auth.toLowerCase().charAt(i);
@@ -86,7 +86,7 @@ public class PolicyParser {
if (isDebugEnabled) {
LOG.debug("==> PolicyParser parsePolicies");
}
- List<PolicyDef> policyDefs = new ArrayList<PolicyDef>();
+ List<PolicyDef> policyDefs = new ArrayList<>();
for (String policy : policies) {
PolicyDef policyDef = parsePolicy(policy);
if (policyDef != null) {
@@ -129,7 +129,7 @@ public class PolicyParser {
}
boolean isValidEntity = Pattern.matches("(.+:.+)+", entity);
boolean isEmpty = entity.isEmpty();
- if (isValidEntity == false || isEmpty == true) {
+ if (!isValidEntity || isEmpty) {
if (isDebugEnabled) {
LOG.debug("group/user/resource not properly define in Policy");
LOG.debug("<== PolicyParser validateEntity");
@@ -150,7 +150,7 @@ public class PolicyParser {
}
String[] users = usersDef.split(",");
String[] userAndRole = null;
- Map<String, List<AtlasActionTypes>> usersMap = new HashMap<String, List<AtlasActionTypes>>();
+ Map<String, List<AtlasActionTypes>> usersMap = new HashMap<>();
if (validateEntity(usersDef)) {
for (String user : users) {
if (!Pattern.matches("(.+:.+)+", user)) {
@@ -179,7 +179,7 @@ public class PolicyParser {
}
String[] groups = groupsDef.split("\\,");
String[] groupAndRole = null;
- Map<String, List<AtlasActionTypes>> groupsMap = new HashMap<String, List<AtlasActionTypes>>();
+ Map<String, List<AtlasActionTypes>> groupsMap = new HashMap<>();
if (validateEntity(groupsDef.trim())) {
for (String group : groups) {
if (!Pattern.matches("(.+:.+)+", group)) {
@@ -209,7 +209,7 @@ public class PolicyParser {
}
String[] resources = resourceDef.split(",");
String[] resourceTypeAndName = null;
- Map<AtlasResourceTypes, List<String>> resourcesMap = new HashMap<AtlasResourceTypes, List<String>>();
+ Map<AtlasResourceTypes, List<String>> resourcesMap = new HashMap<>();
if (validateEntity(resourceDef)) {
for (String resource : resources) {
if (!Pattern.matches("(.+:.+)+", resource)) {
@@ -238,7 +238,7 @@ public class PolicyParser {
List<String> resourceList = resourcesMap.get(resourceType);
if (resourceList == null) {
- resourceList = new ArrayList<String>();
+ resourceList = new ArrayList<>();
}
resourceList.add(resourceTypeAndName[RESOURCE_NAME]);
resourcesMap.put(resourceType, resourceList);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
index 9508eb3..8a3850f 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/PolicyUtil.java
@@ -40,7 +40,7 @@ public class PolicyUtil {
+ " & " + principalType);
}
Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap =
- new HashMap<String, Map<AtlasResourceTypes, List<String>>>();
+ new HashMap<>();
// Iterate over the list of policies to create map
for (PolicyDef policyDef : policyDefList) {
@@ -63,7 +63,7 @@ public class PolicyUtil {
if (isDebugEnabled) {
LOG.debug("Resource list not found for " + username + ", creating it");
}
- userResourceList = new HashMap<AtlasResourceTypes, List<String>>();
+ userResourceList = new HashMap<>();
}
/*
* Iterate over resources from the current policy def and update the resource list for the current user
@@ -77,7 +77,7 @@ public class PolicyUtil {
if (resourceList == null) {
// if the resource list was not added for this type then
// create and add all the resources in this policy
- resourceList = new ArrayList<String>();
+ resourceList = new ArrayList<>();
resourceList.addAll(resourceTypeMap.getValue());
} else {
// if the resource list is present then merge both the
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java
----------------------------------------------------------------------
diff --git a/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java b/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java
index 57156b7..5956f5c 100644
--- a/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java
+++ b/authorization/src/main/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizer.java
@@ -45,7 +45,7 @@ import com.google.common.annotations.VisibleForTesting;
public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
public enum AtlasAccessorTypes {
- USER, GROUP;
+ USER, GROUP
}
private static final Logger LOG = LoggerFactory.getLogger(SimpleAtlasAuthorizer.class);
@@ -133,8 +133,8 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
+ "\nResource :: " + resource);
boolean isAccessAllowed = false;
- boolean isUser = user == null ? false : true;
- boolean isGroup = groups == null ? false : true;
+ boolean isUser = user != null;
+ boolean isGroup = groups != null;
if ((!isUser && !isGroup) || action == null || resource == null) {
if (isDebugEnabled) {
@@ -149,26 +149,22 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
case READ:
isAccessAllowed = checkAccess(user, resourceTypes, resource, userReadMap);
isAccessAllowed =
- isAccessAllowed == false ? checkAccessForGroups(groups, resourceTypes, resource, groupReadMap)
- : isAccessAllowed;
+ isAccessAllowed || checkAccessForGroups(groups, resourceTypes, resource, groupReadMap);
break;
case CREATE:
isAccessAllowed = checkAccess(user, resourceTypes, resource, userWriteMap);
isAccessAllowed =
- isAccessAllowed == false ? checkAccessForGroups(groups, resourceTypes, resource, groupWriteMap)
- : isAccessAllowed;
+ isAccessAllowed || checkAccessForGroups(groups, resourceTypes, resource, groupWriteMap);
break;
case UPDATE:
isAccessAllowed = checkAccess(user, resourceTypes, resource, userUpdateMap);
isAccessAllowed =
- isAccessAllowed == false
- ? checkAccessForGroups(groups, resourceTypes, resource, groupUpdateMap) : isAccessAllowed;
+ isAccessAllowed || checkAccessForGroups(groups, resourceTypes, resource, groupUpdateMap);
break;
case DELETE:
isAccessAllowed = checkAccess(user, resourceTypes, resource, userDeleteMap);
isAccessAllowed =
- isAccessAllowed == false
- ? checkAccessForGroups(groups, resourceTypes, resource, groupDeleteMap) : isAccessAllowed;
+ isAccessAllowed || checkAccessForGroups(groups, resourceTypes, resource, groupDeleteMap);
break;
default:
if (isDebugEnabled) {
@@ -249,7 +245,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
boolean optWildCard = true;
- List<String> policyValues = new ArrayList<String>();
+ List<String> policyValues = new ArrayList<>();
if (policyResource != null) {
boolean isWildCardPresent = !optWildCard;
@@ -302,8 +298,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
}
}
- if (isMatch == false) {
-
+ if (!isMatch) {
if (isDebugEnabled) {
StringBuilder sb = new StringBuilder();
sb.append("[");
@@ -327,8 +322,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
}
private boolean isAllValuesRequested(String resource) {
- boolean result = StringUtils.isEmpty(resource) || WILDCARD_ASTERISK.equals(resource);
- return result;
+ return StringUtils.isEmpty(resource) || WILDCARD_ASTERISK.equals(resource);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyParserTest.java
----------------------------------------------------------------------
diff --git a/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyParserTest.java b/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyParserTest.java
index 453364d..3b7869a 100644
--- a/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyParserTest.java
+++ b/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyParserTest.java
@@ -33,42 +33,42 @@ public class PolicyParserTest {
@Test
public void testParsePoliciesWithAllProperties() {
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;usr1:r,usr2:rw;;grp1:rwu,grp2:u;;entity:*abc,operation:*xyz,type:PII");
/* Creating group data */
- Map<String, List<AtlasActionTypes>> groupMap = new HashMap<String, List<AtlasActionTypes>>();
- List<AtlasActionTypes> accessList1 = new ArrayList<AtlasActionTypes>();
+ Map<String, List<AtlasActionTypes>> groupMap = new HashMap<>();
+ List<AtlasActionTypes> accessList1 = new ArrayList<>();
accessList1.add(AtlasActionTypes.READ);
accessList1.add(AtlasActionTypes.CREATE);
accessList1.add(AtlasActionTypes.UPDATE);
groupMap.put("grp1", accessList1);
- List<AtlasActionTypes> accessList2 = new ArrayList<AtlasActionTypes>();
+ List<AtlasActionTypes> accessList2 = new ArrayList<>();
accessList2.add(AtlasActionTypes.UPDATE);
groupMap.put("grp2", accessList2);
/* Creating user data */
- Map<String, List<AtlasActionTypes>> usersMap = new HashMap<String, List<AtlasActionTypes>>();
- List<AtlasActionTypes> usr1AccessList = new ArrayList<AtlasActionTypes>();
+ Map<String, List<AtlasActionTypes>> usersMap = new HashMap<>();
+ List<AtlasActionTypes> usr1AccessList = new ArrayList<>();
usr1AccessList.add(AtlasActionTypes.READ);
usersMap.put("usr1", usr1AccessList);
- List<AtlasActionTypes> usr2AccessList = new ArrayList<AtlasActionTypes>();
+ List<AtlasActionTypes> usr2AccessList = new ArrayList<>();
usr2AccessList.add(AtlasActionTypes.READ);
usr2AccessList.add(AtlasActionTypes.CREATE);
usersMap.put("usr2", usr2AccessList);
/* Creating resources data */
- Map<AtlasResourceTypes, List<String>> resourceMap = new HashMap<AtlasResourceTypes, List<String>>();
- List<String> resource1List = new ArrayList<String>();
+ Map<AtlasResourceTypes, List<String>> resourceMap = new HashMap<>();
+ List<String> resource1List = new ArrayList<>();
resource1List.add("*abc");
resourceMap.put(AtlasResourceTypes.ENTITY, resource1List);
- List<String> resource2List = new ArrayList<String>();
+ List<String> resource2List = new ArrayList<>();
resource2List.add("*xyz");
resourceMap.put(AtlasResourceTypes.OPERATION, resource2List);
- List<String> resource3List = new ArrayList<String>();
+ List<String> resource3List = new ArrayList<>();
resource3List.add("PII");
resourceMap.put(AtlasResourceTypes.TYPE, resource3List);
@@ -86,34 +86,34 @@ public class PolicyParserTest {
@Test
public void testParsePoliciesWithOutUserProperties() {
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;;;grp1:rwu,grp2:u;;entity:*abc,operation:*xyz,type:PII");
// Creating group data
- Map<String, List<AtlasActionTypes>> groupMap = new HashMap<String, List<AtlasActionTypes>>();
- List<AtlasActionTypes> accessList1 = new ArrayList<AtlasActionTypes>();
+ Map<String, List<AtlasActionTypes>> groupMap = new HashMap<>();
+ List<AtlasActionTypes> accessList1 = new ArrayList<>();
accessList1.add(AtlasActionTypes.READ);
accessList1.add(AtlasActionTypes.CREATE);
accessList1.add(AtlasActionTypes.UPDATE);
groupMap.put("grp1", accessList1);
- List<AtlasActionTypes> accessList2 = new ArrayList<AtlasActionTypes>();
+ List<AtlasActionTypes> accessList2 = new ArrayList<>();
accessList2.add(AtlasActionTypes.UPDATE);
groupMap.put("grp2", accessList2);
// Creating user data
- Map<String, List<AtlasActionTypes>> usersMap = new HashMap<String, List<AtlasActionTypes>>();
+ Map<String, List<AtlasActionTypes>> usersMap = new HashMap<>();
// Creating resources data
- Map<AtlasResourceTypes, List<String>> resourceMap = new HashMap<AtlasResourceTypes, List<String>>();
- List<String> resource1List = new ArrayList<String>();
+ Map<AtlasResourceTypes, List<String>> resourceMap = new HashMap<>();
+ List<String> resource1List = new ArrayList<>();
resource1List.add("*abc");
resourceMap.put(AtlasResourceTypes.ENTITY, resource1List);
- List<String> resource2List = new ArrayList<String>();
+ List<String> resource2List = new ArrayList<>();
resource2List.add("*xyz");
resourceMap.put(AtlasResourceTypes.OPERATION, resource2List);
- List<String> resource3List = new ArrayList<String>();
+ List<String> resource3List = new ArrayList<>();
resource3List.add("PII");
resourceMap.put(AtlasResourceTypes.TYPE, resource3List);
@@ -131,33 +131,33 @@ public class PolicyParserTest {
@Test
public void testParsePoliciesWithOutGroupProperties() {
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;usr1:r,usr2:rw;;;;entity:*abc,operation:*xyz,type:PII");
// Creating group data
- Map<String, List<AtlasActionTypes>> groupMap = new HashMap<String, List<AtlasActionTypes>>();
+ Map<String, List<AtlasActionTypes>> groupMap = new HashMap<>();
// Creating user data
- Map<String, List<AtlasActionTypes>> usersMap = new HashMap<String, List<AtlasActionTypes>>();
- List<AtlasActionTypes> usr1AccessList = new ArrayList<AtlasActionTypes>();
+ Map<String, List<AtlasActionTypes>> usersMap = new HashMap<>();
+ List<AtlasActionTypes> usr1AccessList = new ArrayList<>();
usr1AccessList.add(AtlasActionTypes.READ);
usersMap.put("usr1", usr1AccessList);
- List<AtlasActionTypes> usr2AccessList = new ArrayList<AtlasActionTypes>();
+ List<AtlasActionTypes> usr2AccessList = new ArrayList<>();
usr2AccessList.add(AtlasActionTypes.READ);
usr2AccessList.add(AtlasActionTypes.CREATE);
usersMap.put("usr2", usr2AccessList);
// Creating resources data
- Map<AtlasResourceTypes, List<String>> resourceMap = new HashMap<AtlasResourceTypes, List<String>>();
- List<String> resource1List = new ArrayList<String>();
+ Map<AtlasResourceTypes, List<String>> resourceMap = new HashMap<>();
+ List<String> resource1List = new ArrayList<>();
resource1List.add("*abc");
resourceMap.put(AtlasResourceTypes.ENTITY, resource1List);
- List<String> resource2List = new ArrayList<String>();
+ List<String> resource2List = new ArrayList<>();
resource2List.add("*xyz");
resourceMap.put(AtlasResourceTypes.OPERATION, resource2List);
- List<String> resource3List = new ArrayList<String>();
+ List<String> resource3List = new ArrayList<>();
resource3List.add("PII");
resourceMap.put(AtlasResourceTypes.TYPE, resource3List);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyUtilTest.java
----------------------------------------------------------------------
diff --git a/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyUtilTest.java b/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyUtilTest.java
index 3453bf0..1cefbcd 100644
--- a/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyUtilTest.java
+++ b/authorization/src/test/java/org/apache/atlas/authorize/simple/PolicyUtilTest.java
@@ -35,24 +35,24 @@ public class PolicyUtilTest {
@Test
public void testCreatePermissionMap() {
- HashMap<AtlasResourceTypes, List<String>> resourceMap = new HashMap<AtlasResourceTypes, List<String>>();
- List<String> resource1List = new ArrayList<String>();
+ HashMap<AtlasResourceTypes, List<String>> resourceMap = new HashMap<>();
+ List<String> resource1List = new ArrayList<>();
resource1List.add("*abc");
resourceMap.put(AtlasResourceTypes.ENTITY, resource1List);
- List<String> resource2List = new ArrayList<String>();
+ List<String> resource2List = new ArrayList<>();
resource2List.add("*xyz");
resourceMap.put(AtlasResourceTypes.OPERATION, resource2List);
- List<String> resource3List = new ArrayList<String>();
+ List<String> resource3List = new ArrayList<>();
resource3List.add("PII");
resourceMap.put(AtlasResourceTypes.TYPE, resource3List);
Map<String, HashMap<AtlasResourceTypes, List<String>>> permissionMap =
- new HashMap<String, HashMap<AtlasResourceTypes, List<String>>>();
+ new HashMap<>();
permissionMap.put("grp1", resourceMap);
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;usr1:r,usr2:rw;;grp1:rwu,grp2:u;;entity:*abc,operation:*xyz,type:PII");
List<PolicyDef> policyDefList = new PolicyParser().parsePolicies(policies);
@@ -66,25 +66,25 @@ public class PolicyUtilTest {
@Test
public void testMergeCreatePermissionMap() {
- HashMap<AtlasResourceTypes, List<String>> resourceMap = new HashMap<AtlasResourceTypes, List<String>>();
- List<String> resource1List = new ArrayList<String>();
+ HashMap<AtlasResourceTypes, List<String>> resourceMap = new HashMap<>();
+ List<String> resource1List = new ArrayList<>();
resource1List.add("*abc");
resourceMap.put(AtlasResourceTypes.ENTITY, resource1List);
- List<String> resource2List = new ArrayList<String>();
+ List<String> resource2List = new ArrayList<>();
resource2List.add("*x");
resource2List.add("*xyz");
resourceMap.put(AtlasResourceTypes.OPERATION, resource2List);
- List<String> resource3List = new ArrayList<String>();
+ List<String> resource3List = new ArrayList<>();
resource3List.add("PII");
resourceMap.put(AtlasResourceTypes.TYPE, resource3List);
Map<String, HashMap<AtlasResourceTypes, List<String>>> permissionMap =
- new HashMap<String, HashMap<AtlasResourceTypes, List<String>>>();
+ new HashMap<>();
permissionMap.put("grp1", resourceMap);
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicys;;;;grp1:rwu;;entity:*abc,operation:*xyz,operation:*x");
policies.add("hivePolicy;;;;grp1:rwu;;entity:*abc,operation:*xyz");
policies.add("hivePolicy;;usr1:r,usr2:rw;;grp1:rwu;;entity:*abc,operation:*xyz");
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/authorization/src/test/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizerTest.java
----------------------------------------------------------------------
diff --git a/authorization/src/test/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizerTest.java b/authorization/src/test/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizerTest.java
index 8b27e2e..a3fc489 100644
--- a/authorization/src/test/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizerTest.java
+++ b/authorization/src/test/java/org/apache/atlas/authorize/simple/SimpleAtlasAuthorizerTest.java
@@ -38,7 +38,7 @@ public class SimpleAtlasAuthorizerTest {
Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap = null;
Map<String, Map<AtlasResourceTypes, List<String>>> groupReadMap = null;
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;usr1:r,usr2:rw;;grp1:rwu,grp2:u;;type:*abc,type:PII");
List<PolicyDef> policyDefs = new PolicyParser().parsePolicies(policies);
@@ -50,13 +50,13 @@ public class SimpleAtlasAuthorizerTest {
userReadMap = policyUtil.createPermissionMap(policyDefs,
AtlasActionTypes.READ, SimpleAtlasAuthorizer.AtlasAccessorTypes.USER);
- Set<AtlasResourceTypes> resourceType = new HashSet<AtlasResourceTypes>();
+ Set<AtlasResourceTypes> resourceType = new HashSet<>();
resourceType.add(AtlasResourceTypes.TYPE);
String resource = "xsdfhjabc";
AtlasActionTypes action = AtlasActionTypes.READ;
String user = "usr1";
- Set<String> userGroups = new HashSet<String>();
+ Set<String> userGroups = new HashSet<>();
userGroups.add("grp3");
try {
AtlasAccessRequest request = new AtlasAccessRequest(resourceType,
@@ -83,7 +83,7 @@ public class SimpleAtlasAuthorizerTest {
Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap = null;
Map<String, Map<AtlasResourceTypes, List<String>>> groupReadMap = null;
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;usr1:r,usr2:rw;;grp1:rwu,grp2:u;;type:PII");
List<PolicyDef> policyDefs = new PolicyParser().parsePolicies(policies);
@@ -95,12 +95,12 @@ public class SimpleAtlasAuthorizerTest {
userReadMap = policyUtil.createPermissionMap(policyDefs,
AtlasActionTypes.READ, SimpleAtlasAuthorizer.AtlasAccessorTypes.USER);
- Set<AtlasResourceTypes> resourceType = new HashSet<AtlasResourceTypes>();
+ Set<AtlasResourceTypes> resourceType = new HashSet<>();
resourceType.add(AtlasResourceTypes.TYPE);
String resource = "PII";
AtlasActionTypes action = AtlasActionTypes.READ;
String user = "usr3";
- Set<String> userGroups = new HashSet<String>();
+ Set<String> userGroups = new HashSet<>();
userGroups.add("grp1");
AtlasAccessRequest request = new AtlasAccessRequest(resourceType,
resource, action, user, userGroups);
@@ -126,7 +126,7 @@ public class SimpleAtlasAuthorizerTest {
Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap = null;
Map<String, Map<AtlasResourceTypes, List<String>>> groupReadMap = null;
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;usr1:r,usr2:rw;;grp1:rwu,grp2:u;;type:PII");
List<PolicyDef> policyDefs = new PolicyParser().parsePolicies(policies);
@@ -138,12 +138,12 @@ public class SimpleAtlasAuthorizerTest {
userReadMap = policyUtil.createPermissionMap(policyDefs,
AtlasActionTypes.READ, SimpleAtlasAuthorizer.AtlasAccessorTypes.USER);
- Set<AtlasResourceTypes> resourceType = new HashSet<AtlasResourceTypes>();
+ Set<AtlasResourceTypes> resourceType = new HashSet<>();
resourceType.add(AtlasResourceTypes.TYPE);
String resource = "abc";
AtlasActionTypes action = AtlasActionTypes.READ;
String user = "usr1";
- Set<String> userGroups = new HashSet<String>();
+ Set<String> userGroups = new HashSet<>();
userGroups.add("grp1");
AtlasAccessRequest request = new AtlasAccessRequest(resourceType,
resource, action, user, userGroups);
@@ -168,7 +168,7 @@ public class SimpleAtlasAuthorizerTest {
Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap = null;
Map<String, Map<AtlasResourceTypes, List<String>>> groupReadMap = null;
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
policies.add("hivePolicy;;usr1:r,usr2:rw;;grp1:rwu,grp2:u;;type:PII");
List<PolicyDef> policyDefs = new PolicyParser().parsePolicies(policies);
@@ -180,12 +180,12 @@ public class SimpleAtlasAuthorizerTest {
userReadMap = policyUtil.createPermissionMap(policyDefs,
AtlasActionTypes.READ, SimpleAtlasAuthorizer.AtlasAccessorTypes.USER);
- Set<AtlasResourceTypes> resourceType = new HashSet<AtlasResourceTypes>();
+ Set<AtlasResourceTypes> resourceType = new HashSet<>();
resourceType.add(AtlasResourceTypes.TYPE);
String resource = "PII";
AtlasActionTypes action = AtlasActionTypes.READ;
String user = "usr3";
- Set<String> userGroups = new HashSet<String>();
+ Set<String> userGroups = new HashSet<>();
userGroups.add("grp3");
AtlasAccessRequest request = new AtlasAccessRequest(resourceType,
resource, action, user, userGroups);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java b/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java
index ee9fbba..feb9d72 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/BaseResourceProvider.java
@@ -23,8 +23,6 @@ import org.apache.atlas.catalog.exception.InvalidPayloadException;
import org.apache.atlas.catalog.exception.ResourceNotFoundException;
import org.apache.atlas.catalog.query.QueryFactory;
-import java.util.Collections;
-
/**
* Base class for resource providers.
*/
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java b/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
index f111eb6..726351a 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
@@ -85,7 +85,7 @@ public class DefaultTypeSystem implements AtlasTypeSystem {
} catch(TypeNotFoundException tne) {
//Type not found . Create
TypesDef typesDef = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
- ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(type),
+ ImmutableList.of(type),
ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
metadataService.createType(TypesSerialization.toJson(typesDef));
}
@@ -198,11 +198,11 @@ public class DefaultTypeSystem implements AtlasTypeSystem {
try {
HierarchicalTypeDefinition<T> definition = null;
if ( isTrait) {
- definition = new HierarchicalTypeDefinition<T>(type, name, description,
- ImmutableSet.<String>of(TaxonomyResourceProvider.TAXONOMY_TERM_TYPE), attributes.toArray(new AttributeDefinition[attributes.size()]));
+ definition = new HierarchicalTypeDefinition<>(type, name, description,
+ ImmutableSet.of(TaxonomyResourceProvider.TAXONOMY_TERM_TYPE), attributes.toArray(new AttributeDefinition[attributes.size()]));
} else {
- definition = new HierarchicalTypeDefinition<T>(type, name, description,
- ImmutableSet.<String>of(), attributes.toArray(new AttributeDefinition[attributes.size()]));
+ definition = new HierarchicalTypeDefinition<>(type, name, description,
+ ImmutableSet.<String>of(), attributes.toArray(new AttributeDefinition[attributes.size()]));
}
metadataService.createType(TypesSerialization.toJson(definition, isTrait));
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/catalog/src/main/java/org/apache/atlas/catalog/TermVertexWrapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/TermVertexWrapper.java b/catalog/src/main/java/org/apache/atlas/catalog/TermVertexWrapper.java
index d60e3f3..14fcca7 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/TermVertexWrapper.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/TermVertexWrapper.java
@@ -20,10 +20,6 @@ package org.apache.atlas.catalog;
import com.tinkerpop.blueprints.Vertex;
import org.apache.atlas.catalog.definition.EntityTagResourceDefinition;
-import org.apache.atlas.catalog.definition.ResourceDefinition;
-import org.apache.atlas.repository.Constants;
-
-import java.util.Collections;
/**
* Wrapper for term vertices.
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/catalog/src/main/java/org/apache/atlas/catalog/definition/TaxonomyResourceDefinition.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/definition/TaxonomyResourceDefinition.java b/catalog/src/main/java/org/apache/atlas/catalog/definition/TaxonomyResourceDefinition.java
index 47d182c..434a189 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/definition/TaxonomyResourceDefinition.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/definition/TaxonomyResourceDefinition.java
@@ -20,7 +20,6 @@ package org.apache.atlas.catalog.definition;
import com.tinkerpop.pipes.PipeFunction;
import com.tinkerpop.pipes.transform.TransformFunctionPipe;
-import org.apache.atlas.AtlasConstants;
import org.apache.atlas.catalog.Request;
import org.apache.atlas.catalog.TaxonomyResourceProvider;
import org.apache.atlas.catalog.VertexWrapper;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/catalog/src/main/java/org/apache/atlas/catalog/query/QueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/query/QueryExpression.java b/catalog/src/main/java/org/apache/atlas/catalog/query/QueryExpression.java
index 78436c0..c53b94b 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/query/QueryExpression.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/query/QueryExpression.java
@@ -88,7 +88,7 @@ public interface QueryExpression {
*
* @param fieldName field name
*/
- public void setField(String fieldName);
+ void setField(String fieldName);
/**
* Get the expected value for the expression.
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/catalog/src/test/java/org/apache/atlas/catalog/EntityTagResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/catalog/src/test/java/org/apache/atlas/catalog/EntityTagResourceProviderTest.java b/catalog/src/test/java/org/apache/atlas/catalog/EntityTagResourceProviderTest.java
index 510378e..96cb523 100644
--- a/catalog/src/test/java/org/apache/atlas/catalog/EntityTagResourceProviderTest.java
+++ b/catalog/src/test/java/org/apache/atlas/catalog/EntityTagResourceProviderTest.java
@@ -30,8 +30,6 @@ import org.testng.annotations.Test;
import java.util.*;
import static org.easymock.EasyMock.*;
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.replay;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/client/src/main/java/org/apache/atlas/AtlasAdminClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasAdminClient.java b/client/src/main/java/org/apache/atlas/AtlasAdminClient.java
index 63e9213..19f9575 100644
--- a/client/src/main/java/org/apache/atlas/AtlasAdminClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasAdminClient.java
@@ -28,6 +28,8 @@ import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.configuration.Configuration;
+import java.util.Arrays;
+
/**
* An application that allows users to run admin commands against an Atlas server.
@@ -83,7 +85,7 @@ public class AtlasAdminClient {
System.out.println(atlasClient.getAdminStatus());
cmdStatus = 0;
} catch (AtlasServiceException e) {
- System.err.println("Could not retrieve status of the server at " + atlasServerUri);
+ System.err.println("Could not retrieve status of the server at " + Arrays.toString(atlasServerUri));
printStandardHttpErrorDetails(e);
}
} else {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/client/src/main/java/org/apache/atlas/security/SecureClientUtils.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/security/SecureClientUtils.java b/client/src/main/java/org/apache/atlas/security/SecureClientUtils.java
index e13d826..d5392b2 100644
--- a/client/src/main/java/org/apache/atlas/security/SecureClientUtils.java
+++ b/client/src/main/java/org/apache/atlas/security/SecureClientUtils.java
@@ -30,7 +30,6 @@ import org.apache.hadoop.security.ssl.SSLFactory;
import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticatedURL;
import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticator;
import org.apache.hadoop.security.token.delegation.web.KerberosDelegationTokenAuthenticator;
-import org.apache.hadoop.security.token.delegation.web.PseudoDelegationTokenAuthenticator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,7 +55,7 @@ import static org.apache.atlas.security.SecurityProperties.TRUSTSTORE_FILE_KEY;
*/
public class SecureClientUtils {
- public final static int DEFAULT_SOCKET_TIMEOUT = 1 * 60 * 1000; // 1 minute
+ public final static int DEFAULT_SOCKET_TIMEOUT_IN_MSECS = 1 * 60 * 1000; // 1 minute
private static final Logger LOG = LoggerFactory.getLogger(SecureClientUtils.class);
@@ -120,14 +119,14 @@ public class SecureClientUtils {
private final static ConnectionConfigurator DEFAULT_TIMEOUT_CONN_CONFIGURATOR = new ConnectionConfigurator() {
@Override
public HttpURLConnection configure(HttpURLConnection conn) throws IOException {
- setTimeouts(conn, DEFAULT_SOCKET_TIMEOUT);
+ setTimeouts(conn, DEFAULT_SOCKET_TIMEOUT_IN_MSECS);
return conn;
}
};
private static ConnectionConfigurator newConnConfigurator(Configuration conf) {
try {
- return newSslConnConfigurator(DEFAULT_SOCKET_TIMEOUT, conf);
+ return newSslConnConfigurator(DEFAULT_SOCKET_TIMEOUT_IN_MSECS, conf);
} catch (Exception e) {
LOG.debug("Cannot load customized ssl related configuration. " + "Fallback to system-generic settings.", e);
return DEFAULT_TIMEOUT_CONN_CONFIGURATOR;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/client/src/test/java/org/apache/atlas/AtlasClientTest.java
----------------------------------------------------------------------
diff --git a/client/src/test/java/org/apache/atlas/AtlasClientTest.java b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
index 3a67689..56c4ae6 100644
--- a/client/src/test/java/org/apache/atlas/AtlasClientTest.java
+++ b/client/src/test/java/org/apache/atlas/AtlasClientTest.java
@@ -107,8 +107,7 @@ public class AtlasClientTest {
private WebResource.Builder setupBuilder(AtlasClient.API api, WebResource webResource) {
when(webResource.path(api.getPath())).thenReturn(service);
- WebResource.Builder builder = getBuilder(service);
- return builder;
+ return getBuilder(service);
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/common/src/main/java/org/apache/atlas/groovy/FunctionCallExpression.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/groovy/FunctionCallExpression.java b/common/src/main/java/org/apache/atlas/groovy/FunctionCallExpression.java
index b60edef..dd9b1d5 100644
--- a/common/src/main/java/org/apache/atlas/groovy/FunctionCallExpression.java
+++ b/common/src/main/java/org/apache/atlas/groovy/FunctionCallExpression.java
@@ -32,7 +32,7 @@ public class FunctionCallExpression extends AbstractGroovyExpression {
private GroovyExpression target;
private String functionName;
- private List<GroovyExpression> arguments = new ArrayList<GroovyExpression>();
+ private List<GroovyExpression> arguments = new ArrayList<>();
public FunctionCallExpression(String functionName, List<? extends GroovyExpression> arguments) {
this.target = null;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java b/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java
index fb32ff5..ed42aa6 100644
--- a/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java
+++ b/common/src/main/java/org/apache/atlas/security/InMemoryJAASConfiguration.java
@@ -231,7 +231,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
String clientId = tokenizer.nextToken();
SortedSet<Integer> indexList = jaasClients.get(clientId);
if (indexList == null) {
- indexList = new TreeSet<Integer>();
+ indexList = new TreeSet<>();
jaasClients.put(clientId, indexList);
}
String indexStr = tokenizer.nextToken();
@@ -275,20 +275,26 @@ public final class InMemoryJAASConfiguration extends Configuration {
AppConfigurationEntry.LoginModuleControlFlag loginControlFlag = null;
if (controlFlag != null) {
controlFlag = controlFlag.trim().toLowerCase();
- if (controlFlag.equals("optional")) {
- loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
- } else if (controlFlag.equals("requisite")) {
- loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUISITE;
- } else if (controlFlag.equals("sufficient")) {
- loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;
- } else if (controlFlag.equals("required")) {
- loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
- } else {
- String validValues = "optional|requisite|sufficient|required";
- LOG.warn("Unknown JAAS configuration value for (" + keyParam
- + ") = [" + controlFlag + "], valid value are [" + validValues
- + "] using the default value, REQUIRED");
- loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
+ switch (controlFlag) {
+ case "optional":
+ loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
+ break;
+ case "requisite":
+ loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUISITE;
+ break;
+ case "sufficient":
+ loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;
+ break;
+ case "required":
+ loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
+ break;
+ default:
+ String validValues = "optional|requisite|sufficient|required";
+ LOG.warn("Unknown JAAS configuration value for (" + keyParam
+ + ") = [" + controlFlag + "], valid value are [" + validValues
+ + "] using the default value, REQUIRED");
+ loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
+ break;
}
} else {
LOG.warn("Unable to find JAAS configuration ("
@@ -336,7 +342,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
List<AppConfigurationEntry> retList = applicationConfigEntryMap.get(jaasClient);
if (retList == null) {
- retList = new ArrayList<AppConfigurationEntry>();
+ retList = new ArrayList<>();
applicationConfigEntryMap.put(jaasClient, retList);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/common/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java b/common/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java
index bf1175f..6430fb1 100644
--- a/common/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java
+++ b/common/src/main/java/org/apache/atlas/utils/AuthenticationUtil.java
@@ -46,13 +46,7 @@ public final class AuthenticationUtil {
}
public static boolean isKerberosAuthenticationEnabled(Configuration atlasConf) {
- boolean isKerberosAuthenticationEnabled;
- if ("true".equalsIgnoreCase(atlasConf.getString("atlas.authentication.method.kerberos"))) {
- isKerberosAuthenticationEnabled = true;
- } else {
- isKerberosAuthenticationEnabled = false;
- }
- return isKerberosAuthenticationEnabled;
+ return atlasConf.getBoolean("atlas.authentication.method.kerberos", false);
}
public static String[] getBasicAuthenticationInput() {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java b/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
index 43569c4..d5cf15c 100644
--- a/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
+++ b/common/src/main/java/org/apache/atlas/utils/PropertiesUtil.java
@@ -32,9 +32,9 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
* Util class for Properties.
*/
public final class PropertiesUtil extends PropertyPlaceholderConfigurer {
- private static Map<String, String> propertiesMap = new HashMap<String, String>();
+ private static Map<String, String> propertiesMap = new HashMap<>();
private static Logger logger = Logger.getLogger(PropertiesUtil.class);
- protected List<String> xmlPropertyConfigurer = new ArrayList<String>();
+ protected List<String> xmlPropertyConfigurer = new ArrayList<>();
private PropertiesUtil() {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/dashboardv2/public/js/views/tag/addTagModalView.js
----------------------------------------------------------------------
diff --git a/dashboardv2/public/js/views/tag/addTagModalView.js b/dashboardv2/public/js/views/tag/addTagModalView.js
index fdaea5b..206d826 100644
--- a/dashboardv2/public/js/views/tag/addTagModalView.js
+++ b/dashboardv2/public/js/views/tag/addTagModalView.js
@@ -103,11 +103,11 @@ define(['require',
this.tagsCollection();
}, this);
this.listenTo(this.commonCollection, 'reset', function() {
- --this.asyncAttrFetchCounter
+ --this.asyncAttrFetchCounter;
this.subAttributeData();
}, this);
this.listenTo(this.commonCollection, 'error', function() {
- --this.asyncAttrFetchCounter
+ --this.asyncAttrFetchCounter;
this.$('.attrLoader').hide();
}, this);
},
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
index 5d60c67..bd7b35e 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasGraphQuery.java
@@ -50,7 +50,7 @@ public interface AtlasGraphQuery<V, E> {
* @param value
* @return
*/
- AtlasGraphQuery<V, E> in(String propertyKey, Collection<? extends Object> values);
+ AtlasGraphQuery<V, E> in(String propertyKey, Collection<?> values);
/**
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
index f2e0f9d..1ff9d5e 100644
--- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
+++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/AtlasIndexQuery.java
@@ -41,7 +41,7 @@ public interface AtlasIndexQuery<V, E> {
* @param <V>
* @param <E>
*/
- public interface Result<V, E> {
+ interface Result<V, E> {
/**
* Gets the vertex for this result.
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
index 39c309d..662a270 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/NativeTitanGraphQuery.java
@@ -46,7 +46,7 @@ public interface NativeTitanGraphQuery<V, E> {
* @param propertyName
* @param values
*/
- void in(String propertyName, Collection<? extends Object> values);
+ void in(String propertyName, Collection<?> values);
/**
* Adds a has condition to the query.
[3/4] incubator-atlas git commit: ATLAS-1304: Redundant code removal
and code simplification
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
index c205b97..056088c 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/TitanGraphQuery.java
@@ -144,7 +144,7 @@ public abstract class TitanGraphQuery<V, E> implements AtlasGraphQuery<V, E> {
@Override
- public AtlasGraphQuery<V, E> in(String propertyKey, Collection<? extends Object> values) {
+ public AtlasGraphQuery<V, E> in(String propertyKey, Collection<?> values) {
queryCondition.andWith(new InPredicate(propertyKey, values));
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
index 46831a5..ca0e8ab 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/InPredicate.java
@@ -28,9 +28,9 @@ import org.apache.atlas.repository.graphdb.titan.query.NativeTitanGraphQuery;
public class InPredicate implements QueryPredicate {
private String propertyName;
- private Collection<? extends Object> values;
+ private Collection<?> values;
- public InPredicate(String propertyName, Collection<? extends Object> values) {
+ public InPredicate(String propertyName, Collection<?> values) {
super();
this.propertyName = propertyName;
this.values = values;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
----------------------------------------------------------------------
diff --git a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
index 80033b4..e7a8a75 100644
--- a/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
+++ b/graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/titan/query/expr/OrCondition.java
@@ -43,7 +43,7 @@ public class OrCondition {
}
public OrCondition(boolean addInitialTerm) {
- this.children = new ArrayList<AndCondition>();
+ this.children = new ArrayList<>();
if (addInitialTerm) {
children.add(new AndCondition());
}
@@ -96,7 +96,7 @@ public class OrCondition {
//it creates a new AndCondition that combines the two AndConditions together. These combined
//AndConditions become the new set of AndConditions in this OrCondition.
- List<AndCondition> expandedExpressionChildren = new ArrayList<AndCondition>();
+ List<AndCondition> expandedExpressionChildren = new ArrayList<>();
for (AndCondition otherExprTerm : other.getAndTerms()) {
for (AndCondition currentExpr : children) {
AndCondition currentAndConditionCopy = currentExpr.copy();
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompat.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompat.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompat.java
index c9b03aa..c1af7b6 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompat.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompat.java
@@ -36,7 +36,7 @@ public interface HBaseCompat {
* @param algo
* compression type to use
*/
- public void setCompression(HColumnDescriptor cd, String algo);
+ void setCompression(HColumnDescriptor cd, String algo);
/**
* Create and return a HTableDescriptor instance with the given name. The
@@ -50,7 +50,7 @@ public interface HBaseCompat {
* HBase table name
* @return a new table descriptor instance
*/
- public HTableDescriptor newTableDescriptor(String tableName);
+ HTableDescriptor newTableDescriptor(String tableName);
ConnectionMask createConnection(Configuration conf) throws IOException;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompatLoader.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompatLoader.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompatLoader.java
index 2c0d6fe..4d61b60 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompatLoader.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseCompatLoader.java
@@ -67,11 +67,7 @@ public class HBaseCompatLoader {
try {
compat = (HBaseCompat)Class.forName(className).newInstance();
log.info("Instantiated HBase compatibility layer {}: {}", classNameSource, compat.getClass().getCanonicalName());
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e.getClass().getSimpleName() + errTemplate, e);
- } catch (InstantiationException e) {
- throw new RuntimeException(e.getClass().getSimpleName() + errTemplate, e);
- } catch (ClassNotFoundException e) {
+ } catch (IllegalAccessException | ClassNotFoundException | InstantiationException e) {
throw new RuntimeException(e.getClass().getSimpleName() + errTemplate, e);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStore.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStore.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStore.java
index c5f6e0d..d454f37 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStore.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStore.java
@@ -48,7 +48,6 @@ import javax.annotation.Nullable;
import java.io.Closeable;
import java.io.IOException;
import java.util.*;
-import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
@@ -151,7 +150,7 @@ public class HBaseKeyColumnValueStore implements KeyColumnValueStore {
void handleLockFailure(StoreTransaction txh, KeyColumn lockID, int trialCount) throws PermanentLockingException {
if (trialCount < lockMaxRetries) {
try {
- Thread.sleep(lockMaxWaitTimeMs.getLength(TimeUnit.DAYS.MILLISECONDS));
+ Thread.sleep(lockMaxWaitTimeMs.getLength(TimeUnit.MILLISECONDS));
} catch (InterruptedException e) {
throw new PermanentLockingException(
"Interrupted while waiting for acquiring lock for transaction "
@@ -199,7 +198,7 @@ public class HBaseKeyColumnValueStore implements KeyColumnValueStore {
}
private Map<StaticBuffer,EntryList> getHelper(List<StaticBuffer> keys, Filter getFilter) throws BackendException {
- List<Get> requests = new ArrayList<Get>(keys.size());
+ List<Get> requests = new ArrayList<>(keys.size());
{
for (StaticBuffer key : keys) {
Get g = new Get(key.as(StaticBuffer.ARRAY_FACTORY)).addFamily(columnFamilyBytes).setFilter(getFilter);
@@ -212,7 +211,7 @@ public class HBaseKeyColumnValueStore implements KeyColumnValueStore {
}
}
- Map<StaticBuffer,EntryList> resultMap = new HashMap<StaticBuffer,EntryList>(keys.size());
+ Map<StaticBuffer,EntryList> resultMap = new HashMap<>(keys.size());
try {
TableMask table = null;
@@ -336,7 +335,7 @@ public class HBaseKeyColumnValueStore implements KeyColumnValueStore {
@Override
public boolean hasNext() {
ensureOpen();
- return kv == null ? false : kv.hasNext();
+ return kv != null && kv.hasNext();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseStoreManager.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseStoreManager.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseStoreManager.java
index a94a7e4..4bdd320 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseStoreManager.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseStoreManager.java
@@ -99,32 +99,32 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
new ConfigNamespace(GraphDatabaseConfiguration.STORAGE_NS, "hbase", "HBase storage options");
public static final ConfigOption<Boolean> SHORT_CF_NAMES =
- new ConfigOption<Boolean>(HBASE_NS, "short-cf-names",
- "Whether to shorten the names of Titan's column families to one-character mnemonics " +
- "to conserve storage space", ConfigOption.Type.FIXED, true);
+ new ConfigOption<>(HBASE_NS, "short-cf-names",
+ "Whether to shorten the names of Titan's column families to one-character mnemonics " +
+ "to conserve storage space", ConfigOption.Type.FIXED, true);
public static final String COMPRESSION_DEFAULT = "-DEFAULT-";
public static final ConfigOption<String> COMPRESSION =
- new ConfigOption<String>(HBASE_NS, "compression-algorithm",
- "An HBase Compression.Algorithm enum string which will be applied to newly created column families. " +
- "The compression algorithm must be installed and available on the HBase cluster. Titan cannot install " +
- "and configure new compression algorithms on the HBase cluster by itself.",
- ConfigOption.Type.MASKABLE, "GZ");
+ new ConfigOption<>(HBASE_NS, "compression-algorithm",
+ "An HBase Compression.Algorithm enum string which will be applied to newly created column families. " +
+ "The compression algorithm must be installed and available on the HBase cluster. Titan cannot install " +
+ "and configure new compression algorithms on the HBase cluster by itself.",
+ ConfigOption.Type.MASKABLE, "GZ");
public static final ConfigOption<Boolean> SKIP_SCHEMA_CHECK =
- new ConfigOption<Boolean>(HBASE_NS, "skip-schema-check",
- "Assume that Titan's HBase table and column families already exist. " +
- "When this is true, Titan will not check for the existence of its table/CFs, " +
- "nor will it attempt to create them under any circumstances. This is useful " +
- "when running Titan without HBase admin privileges.",
- ConfigOption.Type.MASKABLE, false);
+ new ConfigOption<>(HBASE_NS, "skip-schema-check",
+ "Assume that Titan's HBase table and column families already exist. " +
+ "When this is true, Titan will not check for the existence of its table/CFs, " +
+ "nor will it attempt to create them under any circumstances. This is useful " +
+ "when running Titan without HBase admin privileges.",
+ ConfigOption.Type.MASKABLE, false);
public static final ConfigOption<String> HBASE_TABLE =
- new ConfigOption<String>(HBASE_NS, "table",
- "The name of the table Titan will use. When " + ConfigElement.getPath(SKIP_SCHEMA_CHECK) +
- " is false, Titan will automatically create this table if it does not already exist.",
- ConfigOption.Type.LOCAL, "titan");
+ new ConfigOption<>(HBASE_NS, "table",
+ "The name of the table Titan will use. When " + ConfigElement.getPath(SKIP_SCHEMA_CHECK) +
+ " is false, Titan will automatically create this table if it does not already exist.",
+ ConfigOption.Type.LOCAL, "titan");
/**
* Related bug fixed in 0.98.0, 0.94.7, 0.95.0:
@@ -139,15 +139,15 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
* Titan connects to an HBase backend for the first time.
*/
public static final ConfigOption<Integer> REGION_COUNT =
- new ConfigOption<Integer>(HBASE_NS, "region-count",
- "The number of initial regions set when creating Titan's HBase table",
- ConfigOption.Type.MASKABLE, Integer.class, new Predicate<Integer>() {
+ new ConfigOption<>(HBASE_NS, "region-count",
+ "The number of initial regions set when creating Titan's HBase table",
+ ConfigOption.Type.MASKABLE, Integer.class, new Predicate<Integer>() {
@Override
public boolean apply(Integer input) {
return null != input && MIN_REGION_COUNT <= input;
}
}
- );
+ );
/**
* This setting is used only when {@link #REGION_COUNT} is unset.
@@ -183,9 +183,9 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
* These considerations may differ for other HBase implementations (e.g. MapR).
*/
public static final ConfigOption<Integer> REGIONS_PER_SERVER =
- new ConfigOption<Integer>(HBASE_NS, "regions-per-server",
- "The number of regions per regionserver to set when creating Titan's HBase table",
- ConfigOption.Type.MASKABLE, Integer.class);
+ new ConfigOption<>(HBASE_NS, "regions-per-server",
+ "The number of regions per regionserver to set when creating Titan's HBase table",
+ ConfigOption.Type.MASKABLE, Integer.class);
/**
* If this key is present in either the JVM system properties or the process
@@ -217,11 +217,11 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
*
*/
public static final ConfigOption<String> COMPAT_CLASS =
- new ConfigOption<String>(HBASE_NS, "compat-class",
- "The package and class name of the HBaseCompat implementation. HBaseCompat masks version-specific HBase API differences. " +
- "When this option is unset, Titan calls HBase's VersionInfo.getVersion() and loads the matching compat class " +
- "at runtime. Setting this option forces Titan to instead reflectively load and instantiate the specified class.",
- ConfigOption.Type.MASKABLE, String.class);
+ new ConfigOption<>(HBASE_NS, "compat-class",
+ "The package and class name of the HBaseCompat implementation. HBaseCompat masks version-specific HBase API differences. " +
+ "When this option is unset, Titan calls HBase's VersionInfo.getVersion() and loads the matching compat class " +
+ "at runtime. Setting this option forces Titan to instead reflectively load and instantiate the specified class.",
+ ConfigOption.Type.MASKABLE, String.class);
public static final int PORT_DEFAULT = 9160;
@@ -266,7 +266,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
private final HBaseCompat compat;
private static final ConcurrentHashMap<HBaseStoreManager, Throwable> openManagers =
- new ConcurrentHashMap<HBaseStoreManager, Throwable>();
+ new ConcurrentHashMap<>();
// Mutable instance state
private final ConcurrentMap<String, HBaseKeyColumnValueStore> openStores;
@@ -342,7 +342,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
}
logger.debug("End of HBase config key=value pairs");
- openStores = new ConcurrentHashMap<String, HBaseKeyColumnValueStore>();
+ openStores = new ConcurrentHashMap<>();
}
@Override
@@ -420,7 +420,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
commitTime.getAdditionTime(times.getUnit()),
commitTime.getDeletionTime(times.getUnit()));
- List<Row> batch = new ArrayList<Row>(commandsPerKey.size()); // actual batch operation
+ List<Row> batch = new ArrayList<>(commandsPerKey.size()); // actual batch operation
// convert sorted commands into representation required for 'batch' operation
for (Pair<Put, Delete> commands : commandsPerKey.values()) {
@@ -442,9 +442,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
} finally {
IOUtils.closeQuietly(table);
}
- } catch (IOException e) {
- throw new TemporaryBackendException(e);
- } catch (InterruptedException e) {
+ } catch (IOException | InterruptedException e) {
throw new TemporaryBackendException(e);
}
@@ -466,7 +464,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
final String cfName = shortCfNames ? shortenCfName(longName) : longName;
final String llmPrefix = getName();
- llm = LocalLockMediators.INSTANCE.<StoreTransaction>get(llmPrefix, times);
+ llm = LocalLockMediators.INSTANCE.get(llmPrefix, times);
HBaseKeyColumnValueStore newStore = new HBaseKeyColumnValueStore(this, cnx, tableName, cfName, longName, llm);
store = openStores.putIfAbsent(longName, newStore); // nothing bad happens if we loose to other thread
@@ -511,7 +509,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
@Override
public List<KeyRange> getLocalKeyPartition() throws BackendException {
- List<KeyRange> result = new LinkedList<KeyRange>();
+ List<KeyRange> result = new LinkedList<>();
TableMask table = null;
try {
@@ -645,7 +643,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
}
// Require either no null key bounds or a pair of them
- Preconditions.checkState(!(null == nullStart ^ null == nullEnd));
+ Preconditions.checkState((null == nullStart) == (null == nullEnd));
// Check that every key in the result is at least 4 bytes long
Map<KeyRange, ServerName> result = b.build();
@@ -675,8 +673,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
byte padded[] = new byte[targetLength];
- for (int i = 0; i < dataToPad.length; i++)
- padded[i] = dataToPad[i];
+ System.arraycopy(dataToPad, 0, padded, 0, dataToPad.length);
for (int i = dataToPad.length; i < padded.length; i++)
padded[i] = (byte)0;
@@ -856,7 +853,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
private Map<StaticBuffer, Pair<Put, Delete>> convertToCommands(Map<String, Map<StaticBuffer, KCVMutation>> mutations,
final long putTimestamp,
final long delTimestamp) throws PermanentBackendException {
- Map<StaticBuffer, Pair<Put, Delete>> commandsPerKey = new HashMap<StaticBuffer, Pair<Put, Delete>>();
+ Map<StaticBuffer, Pair<Put, Delete>> commandsPerKey = new HashMap<>();
for (Map.Entry<String, Map<StaticBuffer, KCVMutation>> entry : mutations.entrySet()) {
@@ -870,7 +867,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
Pair<Put, Delete> commands = commandsPerKey.get(m.getKey());
if (commands == null) {
- commands = new Pair<Put, Delete>();
+ commands = new Pair<>();
commandsPerKey.put(m.getKey(), commands);
}
@@ -928,7 +925,7 @@ public class HBaseStoreManager extends DistributedStoreManager implements KeyCol
* Similar to {@link Function}, except that the {@code apply} method is allowed
* to throw {@link BackendException}.
*/
- private static interface BackendFunction<F, T> {
+ private interface BackendFunction<F, T> {
T apply(F input) throws BackendException;
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediator.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediator.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediator.java
index 20c59e1..95669af 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediator.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediator.java
@@ -77,7 +77,7 @@ public class LocalLockMediator<T> {
* according to {@link AuditRecord#expires}, in which case the lock should
* be considered invalid.
*/
- private final ConcurrentHashMap<KeyColumn, AuditRecord<T>> locks = new ConcurrentHashMap<KeyColumn, AuditRecord<T>>();
+ private final ConcurrentHashMap<KeyColumn, AuditRecord<T>> locks = new ConcurrentHashMap<>();
public LocalLockMediator(String name, TimestampProvider times) {
this.name = name;
@@ -125,7 +125,7 @@ public class LocalLockMediator<T> {
assert null != kc;
assert null != requestor;
- AuditRecord<T> audit = new AuditRecord<T>(requestor, expires);
+ AuditRecord<T> audit = new AuditRecord<>(requestor, expires);
AuditRecord<T> inmap = locks.putIfAbsent(kc, audit);
boolean success = false;
@@ -134,7 +134,7 @@ public class LocalLockMediator<T> {
// Uncontended lock succeeded
if (log.isTraceEnabled()) {
log.trace("New local lock created: {} namespace={} txn={}",
- new Object[]{kc, name, requestor});
+ kc, name, requestor);
}
success = true;
} else if (inmap.equals(audit)) {
@@ -144,13 +144,13 @@ public class LocalLockMediator<T> {
if (success) {
log.trace(
"Updated local lock expiration: {} namespace={} txn={} oldexp={} newexp={}",
- new Object[]{kc, name, requestor, inmap.expires,
- audit.expires});
+ kc, name, requestor, inmap.expires,
+ audit.expires);
} else {
log.trace(
"Failed to update local lock expiration: {} namespace={} txn={} oldexp={} newexp={}",
- new Object[]{kc, name, requestor, inmap.expires,
- audit.expires});
+ kc, name, requestor, inmap.expires,
+ audit.expires);
}
}
} else if (0 > inmap.expires.compareTo(times.getTime())) {
@@ -159,14 +159,14 @@ public class LocalLockMediator<T> {
if (log.isTraceEnabled()) {
log.trace(
"Discarding expired lock: {} namespace={} txn={} expired={}",
- new Object[]{kc, name, inmap.holder, inmap.expires});
+ kc, name, inmap.holder, inmap.expires);
}
} else {
// we lost to a valid lock
if (log.isTraceEnabled()) {
log.trace(
"Local lock failed: {} namespace={} txn={} (already owned by {})",
- new Object[]{kc, name, requestor, inmap});
+ kc, name, requestor, inmap);
}
}
@@ -190,13 +190,13 @@ public class LocalLockMediator<T> {
return false;
}
- AuditRecord<T> unlocker = new AuditRecord<T>(requestor, null);
+ AuditRecord<T> unlocker = new AuditRecord<>(requestor, null);
AuditRecord<T> holder = locks.get(kc);
if (!holder.equals(unlocker)) {
log.error("Local unlock of {} by {} failed: it is held by {}",
- new Object[]{kc, unlocker, holder});
+ kc, unlocker, holder);
return false;
}
@@ -206,7 +206,7 @@ public class LocalLockMediator<T> {
expiryQueue.remove(kc);
if (log.isTraceEnabled()) {
log.trace("Local unlock succeeded: {} namespace={} txn={}",
- new Object[]{kc, name, requestor});
+ kc, name, requestor);
}
} else {
log.warn("Local unlock warning: lock record for {} disappeared "
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/solr/Solr5Index.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/solr/Solr5Index.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/solr/Solr5Index.java
index f3b9fd9..90d24e4 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/solr/Solr5Index.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/solr/Solr5Index.java
@@ -119,73 +119,73 @@ public class Solr5Index implements IndexProvider {
public static final ConfigNamespace SOLR_NS =
new ConfigNamespace(GraphDatabaseConfiguration.INDEX_NS, "solr", "Solr index configuration");
- public static final ConfigOption<String> SOLR_MODE = new ConfigOption<String>(SOLR_NS,"mode",
+ public static final ConfigOption<String> SOLR_MODE = new ConfigOption<>(SOLR_NS, "mode",
"The operation mode for Solr which is either via HTTP (`http`) or using SolrCloud (`cloud`)",
ConfigOption.Type.GLOBAL_OFFLINE, "cloud");
- public static final ConfigOption<Boolean> DYNAMIC_FIELDS = new ConfigOption<Boolean>(SOLR_NS,"dyn-fields",
+ public static final ConfigOption<Boolean> DYNAMIC_FIELDS = new ConfigOption<>(SOLR_NS, "dyn-fields",
"Whether to use dynamic fields (which appends the data type to the field name). If dynamic fields is disabled" +
"the user must map field names and define them explicitly in the schema.",
ConfigOption.Type.GLOBAL_OFFLINE, true);
- public static final ConfigOption<String[]> KEY_FIELD_NAMES = new ConfigOption<String[]>(SOLR_NS,"key-field-names",
+ public static final ConfigOption<String[]> KEY_FIELD_NAMES = new ConfigOption<>(SOLR_NS, "key-field-names",
"Field name that uniquely identifies each document in Solr. Must be specified as a list of `collection=field`.",
ConfigOption.Type.GLOBAL, String[].class);
- public static final ConfigOption<String> TTL_FIELD = new ConfigOption<String>(SOLR_NS,"ttl_field",
+ public static final ConfigOption<String> TTL_FIELD = new ConfigOption<>(SOLR_NS, "ttl_field",
"Name of the TTL field for Solr collections.",
ConfigOption.Type.GLOBAL_OFFLINE, "ttl");
/** SolrCloud Configuration */
- public static final ConfigOption<String> ZOOKEEPER_URL = new ConfigOption<String>(SOLR_NS,"zookeeper-url",
+ public static final ConfigOption<String> ZOOKEEPER_URL = new ConfigOption<>(SOLR_NS, "zookeeper-url",
"URL of the Zookeeper instance coordinating the SolrCloud cluster",
ConfigOption.Type.MASKABLE, "localhost:2181");
- public static final ConfigOption<Integer> ZOOKEEPER_CONNECT_TIMEOUT = new ConfigOption<Integer>(SOLR_NS,"zookeeper-connect-timeout",
+ public static final ConfigOption<Integer> ZOOKEEPER_CONNECT_TIMEOUT = new ConfigOption<>(SOLR_NS,"zookeeper-connect-timeout",
"SolrCloud Zookeeper connect timeout",
ConfigOption.Type.MASKABLE, 60000);
- public static final ConfigOption<Integer> ZOOKEEPER_SESSION_TIMEOUT = new ConfigOption<Integer>(SOLR_NS,"zookeeper-session-timeout",
+ public static final ConfigOption<Integer> ZOOKEEPER_SESSION_TIMEOUT = new ConfigOption<>(SOLR_NS,"zookeeper-session-timeout",
"SolrCloud Zookeeper session timeout",
ConfigOption.Type.MASKABLE, 60000);
- public static final ConfigOption<Integer> NUM_SHARDS = new ConfigOption<Integer>(SOLR_NS,"num-shards",
+ public static final ConfigOption<Integer> NUM_SHARDS = new ConfigOption<>(SOLR_NS,"num-shards",
"Number of shards for a collection. This applies when creating a new collection which is only supported under the SolrCloud operation mode.",
ConfigOption.Type.GLOBAL_OFFLINE, 1);
- public static final ConfigOption<Integer> MAX_SHARDS_PER_NODE = new ConfigOption<Integer>(SOLR_NS,"max-shards-per-node",
+ public static final ConfigOption<Integer> MAX_SHARDS_PER_NODE = new ConfigOption<>(SOLR_NS, "max-shards-per-node",
"Maximum number of shards per node. This applies when creating a new collection which is only supported under the SolrCloud operation mode.",
ConfigOption.Type.GLOBAL_OFFLINE, 1);
- public static final ConfigOption<Integer> REPLICATION_FACTOR = new ConfigOption<Integer>(SOLR_NS,"replication-factor",
+ public static final ConfigOption<Integer> REPLICATION_FACTOR = new ConfigOption<>(SOLR_NS, "replication-factor",
"Replication factor for a collection. This applies when creating a new collection which is only supported under the SolrCloud operation mode.",
ConfigOption.Type.GLOBAL_OFFLINE, 1);
/** HTTP Configuration */
- public static final ConfigOption<String[]> HTTP_URLS = new ConfigOption<String[]>(SOLR_NS,"http-urls",
+ public static final ConfigOption<String[]> HTTP_URLS = new ConfigOption<>(SOLR_NS, "http-urls",
"List of URLs to use to connect to Solr Servers (LBHttpSolrClient is used), don't add core or collection name to the URL.",
- ConfigOption.Type.MASKABLE, new String[] { "http://localhost:8983/solr" });
+ ConfigOption.Type.MASKABLE, new String[]{"http://localhost:8983/solr"});
- public static final ConfigOption<Integer> HTTP_CONNECTION_TIMEOUT = new ConfigOption<Integer>(SOLR_NS,"http-connection-timeout",
+ public static final ConfigOption<Integer> HTTP_CONNECTION_TIMEOUT = new ConfigOption<>(SOLR_NS, "http-connection-timeout",
"Solr HTTP connection timeout.",
ConfigOption.Type.MASKABLE, 5000);
- public static final ConfigOption<Boolean> HTTP_ALLOW_COMPRESSION = new ConfigOption<Boolean>(SOLR_NS,"http-compression",
+ public static final ConfigOption<Boolean> HTTP_ALLOW_COMPRESSION = new ConfigOption<>(SOLR_NS, "http-compression",
"Enable/disable compression on the HTTP connections made to Solr.",
ConfigOption.Type.MASKABLE, false);
- public static final ConfigOption<Integer> HTTP_MAX_CONNECTIONS_PER_HOST = new ConfigOption<Integer>(SOLR_NS,"http-max-per-host",
+ public static final ConfigOption<Integer> HTTP_MAX_CONNECTIONS_PER_HOST = new ConfigOption<>(SOLR_NS, "http-max-per-host",
"Maximum number of HTTP connections per Solr host.",
ConfigOption.Type.MASKABLE, 20);
- public static final ConfigOption<Integer> HTTP_GLOBAL_MAX_CONNECTIONS = new ConfigOption<Integer>(SOLR_NS,"http-max",
+ public static final ConfigOption<Integer> HTTP_GLOBAL_MAX_CONNECTIONS = new ConfigOption<>(SOLR_NS, "http-max",
"Maximum number of HTTP connections in total to all Solr servers.",
ConfigOption.Type.MASKABLE, 100);
- public static final ConfigOption<Boolean> WAIT_SEARCHER = new ConfigOption<Boolean>(SOLR_NS, "wait-searcher",
+ public static final ConfigOption<Boolean> WAIT_SEARCHER = new ConfigOption<>(SOLR_NS, "wait-searcher",
"When mutating - wait for the index to reflect new mutations before returning. This can have a negative impact on performance.",
ConfigOption.Type.LOCAL, false);
@@ -245,7 +245,7 @@ public class Solr5Index implements IndexProvider {
}
private Map<String, String> parseKeyFieldsForCollections(Configuration config) throws BackendException {
- Map<String, String> keyFieldNames = new HashMap<String, String>();
+ Map<String, String> keyFieldNames = new HashMap<>();
String[] collectionFieldStatements = config.has(KEY_FIELD_NAMES)?config.get(KEY_FIELD_NAMES):new String[0];
for (String collectionFieldStatement : collectionFieldStatements) {
String[] parts = collectionFieldStatement.trim().split("=");
@@ -282,13 +282,7 @@ public class Solr5Index implements IndexProvider {
CloudSolrClient client = (CloudSolrClient) solrClient;
try {
createCollectionIfNotExists(client, configuration, store);
- } catch (IOException e) {
- throw new PermanentBackendException(e);
- } catch (SolrServerException e) {
- throw new PermanentBackendException(e);
- } catch (InterruptedException e) {
- throw new PermanentBackendException(e);
- } catch (KeeperException e) {
+ } catch (IOException | KeeperException | InterruptedException | SolrServerException e) {
throw new PermanentBackendException(e);
}
}
@@ -303,8 +297,8 @@ public class Solr5Index implements IndexProvider {
String collectionName = stores.getKey();
String keyIdField = getKeyFieldId(collectionName);
- List<String> deleteIds = new ArrayList<String>();
- Collection<SolrInputDocument> changes = new ArrayList<SolrInputDocument>();
+ List<String> deleteIds = new ArrayList<>();
+ Collection<SolrInputDocument> changes = new ArrayList<>();
for (Map.Entry<String, IndexMutation> entry : stores.getValue().entrySet()) {
String docId = entry.getKey();
@@ -380,8 +374,8 @@ public class Solr5Index implements IndexProvider {
for (Map.Entry<String, Map<String, List<IndexEntry>>> stores : documents.entrySet()) {
final String collectionName = stores.getKey();
- List<String> deleteIds = new ArrayList<String>();
- List<SolrInputDocument> newDocuments = new ArrayList<SolrInputDocument>();
+ List<String> deleteIds = new ArrayList<>();
+ List<SolrInputDocument> newDocuments = new ArrayList<>();
for (Map.Entry<String, List<IndexEntry>> entry : stores.getValue().entrySet()) {
final String docID = entry.getKey();
@@ -491,7 +485,7 @@ public class Solr5Index implements IndexProvider {
if (!query.hasLimit() && totalHits >= maxResults)
logger.warn("Query result set truncated to first [{}] elements for query: {}", maxResults, query);
- result = new ArrayList<String>(totalHits);
+ result = new ArrayList<>(totalHits);
for (SolrDocument hit : response.getResults()) {
result.add(hit.getFieldValue(keyIdField).toString());
}
@@ -525,11 +519,11 @@ public class Solr5Index implements IndexProvider {
if (!query.hasLimit() && totalHits >= maxResults) {
logger.warn("Query result set truncated to first [{}] elements for query: {}", maxResults, query);
}
- result = new ArrayList<RawQuery.Result<String>>(totalHits);
+ result = new ArrayList<>(totalHits);
for (SolrDocument hit : response.getResults()) {
double score = Double.parseDouble(hit.getFieldValue("score").toString());
- result.add(new RawQuery.Result<String>(hit.getFieldValue(keyIdField).toString(), score));
+ result.add(new RawQuery.Result<>(hit.getFieldValue(keyIdField).toString(), score));
}
} catch (IOException e) {
logger.error("Query did not complete : ", e);
@@ -595,9 +589,9 @@ public class Solr5Index implements IndexProvider {
} else if (terms.size() == 1) {
return (key + ":(" + escapeValue(terms.get(0)) + ")");
} else {
- And<TitanElement> andTerms = new And<TitanElement>();
+ And<TitanElement> andTerms = new And<>();
for (String term : terms) {
- andTerms.add(new PredicateCondition<String, TitanElement>(key, titanPredicate, term));
+ andTerms.add(new PredicateCondition<>(key, titanPredicate, term));
}
return buildQueryFilter(andTerms, informations);
}
@@ -727,7 +721,7 @@ public class Solr5Index implements IndexProvider {
}
private List<Geoshape.Point> getPolygonPoints(Geoshape polygon) {
- List<Geoshape.Point> locations = new ArrayList<Geoshape.Point>();
+ List<Geoshape.Point> locations = new ArrayList<>();
int index = 0;
boolean hasCoordinates = true;
@@ -953,8 +947,8 @@ public class Solr5Index implements IndexProvider {
Map<String, Replica> shards = entry.getValue().getReplicasMap();
for (Map.Entry<String, Replica> shard : shards.entrySet()) {
String state = shard.getValue().getStr(ZkStateReader.STATE_PROP);
- if ((state.equals(Replica.State.RECOVERING)
- || state.equals(Replica.State.DOWN))
+ if ((state.equals(Replica.State.RECOVERING.toString())
+ || state.equals(Replica.State.DOWN.toString()))
&& clusterState.liveNodesContain(shard.getValue().getStr(
ZkStateReader.NODE_NAME_PROP))) {
sawLiveRecovering = true;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
index 89c02c8..54ff7cb 100644
--- a/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
+++ b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/graphdb/query/graph/GraphCentricQueryBuilder.java
@@ -19,7 +19,6 @@ import com.google.common.base.Predicate;
import com.google.common.collect.*;
import com.thinkaurelius.titan.core.*;
import com.thinkaurelius.titan.core.attribute.Cmp;
-import com.thinkaurelius.titan.core.Cardinality;
import com.thinkaurelius.titan.core.schema.SchemaStatus;
import com.thinkaurelius.titan.core.schema.TitanSchemaType;
import com.thinkaurelius.titan.graphdb.database.IndexSerializer;
@@ -78,7 +77,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
Preconditions.checkNotNull(serializer);
this.tx = tx;
this.serializer = serializer;
- this.constraints = new ArrayList<PredicateCondition<String, TitanElement>>(5);
+ this.constraints = new ArrayList<>(5);
}
/* ---------------------------------------------------------------
@@ -90,7 +89,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(predicate);
Preconditions.checkArgument(predicate.isValidCondition(condition), "Invalid condition: %s", condition);
- constraints.add(new PredicateCondition<String, TitanElement>(key, predicate, condition));
+ constraints.add(new PredicateCondition<>(key, predicate, condition));
return this;
}
@@ -172,19 +171,19 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
@Override
public Iterable<Vertex> vertices() {
GraphCentricQuery query = constructQuery(ElementCategory.VERTEX);
- return Iterables.filter(new QueryProcessor<GraphCentricQuery, TitanElement, JointIndexQuery>(query, tx.elementProcessor), Vertex.class);
+ return Iterables.filter(new QueryProcessor<>(query, tx.elementProcessor), Vertex.class);
}
@Override
public Iterable<Edge> edges() {
GraphCentricQuery query = constructQuery(ElementCategory.EDGE);
- return Iterables.filter(new QueryProcessor<GraphCentricQuery, TitanElement, JointIndexQuery>(query, tx.elementProcessor), Edge.class);
+ return Iterables.filter(new QueryProcessor<>(query, tx.elementProcessor), Edge.class);
}
@Override
public Iterable<TitanProperty> properties() {
GraphCentricQuery query = constructQuery(ElementCategory.PROPERTY);
- return Iterables.filter(new QueryProcessor<GraphCentricQuery, TitanElement, JointIndexQuery>(query, tx.elementProcessor), TitanProperty.class);
+ return Iterables.filter(new QueryProcessor<>(query, tx.elementProcessor), TitanProperty.class);
}
private QueryDescription describe(ElementCategory category) {
@@ -232,7 +231,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
if (orders.isEmpty()) orders = OrderList.NO_ORDER;
//Compile all indexes that cover at least one of the query conditions
- final Set<IndexType> indexCandidates = new HashSet<IndexType>();
+ final Set<IndexType> indexCandidates = new HashSet<>();
ConditionUtil.traversal(conditions, new Predicate<Condition<TitanElement>>() {
@Override
public boolean apply(@Nullable Condition<TitanElement> condition) {
@@ -281,7 +280,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
log.warn("The query optimizer currently does not support multiple label constraints in query: {}", this);
continue;
}
- if (!type.getName().equals((String)Iterables.getOnlyElement(labels))) continue;
+ if (!type.getName().equals(Iterables.getOnlyElement(labels))) continue;
subcover.add(equalCon.getKey());
}
@@ -345,9 +344,9 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
}
indexLimit = Math.min(HARD_MAX_LIMIT, QueryUtil.adjustLimitForTxModifications(tx, coveredClauses.size(), indexLimit));
jointQuery.setLimit(indexLimit);
- query = new BackendQueryHolder<JointIndexQuery>(jointQuery, coveredClauses.size()==conditions.numChildren(), isSorted, null);
+ query = new BackendQueryHolder<>(jointQuery, coveredClauses.size() == conditions.numChildren(), isSorted, null);
} else {
- query = new BackendQueryHolder<JointIndexQuery>(new JointIndexQuery(), false, isSorted, null);
+ query = new BackendQueryHolder<>(new JointIndexQuery(), false, isSorted, null);
}
return new GraphCentricQuery(resultType, conditions, orders, query, limit);
@@ -366,8 +365,8 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
if (index.getStatus()!= SchemaStatus.ENABLED) return null;
IndexField[] fields = index.getFieldKeys();
Object[] indexValues = new Object[fields.length];
- Set<Condition> coveredClauses = new HashSet<Condition>(fields.length);
- List<Object[]> indexCovers = new ArrayList<Object[]>(4);
+ Set<Condition> coveredClauses = new HashSet<>(fields.length);
+ List<Object[]> indexCovers = new ArrayList<>(4);
constructIndexCover(indexValues, 0, fields, condition, indexCovers, coveredClauses);
if (!indexCovers.isEmpty()) {
@@ -384,7 +383,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
} else {
IndexField field = fields[position];
Map.Entry<Condition, Collection<Object>> equalCon = getEqualityConditionValues(condition, field.getFieldKey());
- if (equalCon!=null) {
+ if (equalCon != null) {
coveredClauses.add(equalCon.getKey());
assert equalCon.getValue().size()>0;
for (Object value : equalCon.getValue()) {
@@ -392,7 +391,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
newValues[position]=value;
constructIndexCover(newValues, position+1, fields, condition, indexCovers, coveredClauses);
}
- } else return;
+ }
}
}
@@ -419,7 +418,7 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
final IndexSerializer indexInfo, final Set<Condition> covered) {
assert QueryUtil.isQueryNormalForm(condition);
assert condition instanceof And;
- And<TitanElement> subcondition = new And<TitanElement>(condition.numChildren());
+ And<TitanElement> subcondition = new And<>(condition.numChildren());
for (Condition<TitanElement> subclause : condition.getChildren()) {
if (coversAll(index, subclause, indexInfo)) {
subcondition.add(subclause);
@@ -439,9 +438,9 @@ public class GraphCentricQueryBuilder implements TitanGraphQuery<GraphCentricQue
PropertyKey key = (PropertyKey) atom.getKey();
ParameterIndexField[] fields = index.getFieldKeys();
ParameterIndexField match = null;
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].getStatus()!= SchemaStatus.ENABLED) continue;
- if (fields[i].getFieldKey().equals(key)) match = fields[i];
+ for (ParameterIndexField field : fields) {
+ if (field.getStatus() != SchemaStatus.ENABLED) continue;
+ if (field.getFieldKey().equals(key)) match = field;
}
if (match==null) return false;
return indexInfo.supports(index, match, atom.getPredicate());
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
index 7c8cfe8..f1b38e1 100644
--- a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
+++ b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Graph.java
@@ -319,12 +319,12 @@ public class Titan0Graph implements AtlasGraph<Titan0Vertex, Titan0Edge> {
public Iterable<AtlasEdge<Titan0Vertex, Titan0Edge>> wrapEdges(Iterator<Edge> it) {
- Iterable<Edge> iterable = new IteratorToIterableAdapter<Edge>(it);
+ Iterable<Edge> iterable = new IteratorToIterableAdapter<>(it);
return wrapEdges(iterable);
}
public Iterable<AtlasVertex<Titan0Vertex, Titan0Edge>> wrapVertices(Iterator<Vertex> it) {
- Iterable<Vertex> iterable = new IteratorToIterableAdapter<Vertex>(it);
+ Iterable<Vertex> iterable = new IteratorToIterableAdapter<>(it);
return wrapVertices(iterable);
}
@@ -341,7 +341,7 @@ public class Titan0Graph implements AtlasGraph<Titan0Vertex, Titan0Edge> {
}
public Iterable<AtlasEdge<Titan0Vertex, Titan0Edge>> wrapEdges(Iterable<Edge> it) {
- Iterable<Edge> result = (Iterable<Edge>)it;
+ Iterable<Edge> result = it;
return Iterables.transform(result, new Function<Edge, AtlasEdge<Titan0Vertex, Titan0Edge>>(){
@Override
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0GraphIndex.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0GraphIndex.java b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0GraphIndex.java
index 7beed78..3d4152e 100644
--- a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0GraphIndex.java
+++ b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0GraphIndex.java
@@ -86,7 +86,7 @@ public class Titan0GraphIndex implements AtlasGraphIndex {
@Override
public Set<AtlasPropertyKey> getFieldKeys() {
PropertyKey[] keys = wrappedIndex.getFieldKeys();
- Set<AtlasPropertyKey> result = new HashSet<AtlasPropertyKey>();
+ Set<AtlasPropertyKey> result = new HashSet<>();
for(PropertyKey key : keys) {
result.add(GraphDbObjectFactory.createPropertyKey(key));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Vertex.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Vertex.java b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Vertex.java
index 9ca0441..ca48e3d 100644
--- a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Vertex.java
+++ b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/Titan0Vertex.java
@@ -103,7 +103,7 @@ public class Titan0Vertex extends Titan0Element<Vertex> implements AtlasVertex<T
public <T> Collection<T> getPropertyValues(String key, Class<T> clazz) {
TitanVertex tv = getAsTitanVertex();
- Collection<T> result = new ArrayList<T>();
+ Collection<T> result = new ArrayList<>();
for (TitanProperty property : tv.getProperties(key)) {
result.add((T) property.getValue());
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/query/NativeTitan0GraphQuery.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/query/NativeTitan0GraphQuery.java b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/query/NativeTitan0GraphQuery.java
index 9f9c8ae..5ad176b 100644
--- a/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/query/NativeTitan0GraphQuery.java
+++ b/graphdb/titan0/src/main/java/org/apache/atlas/repository/graphdb/titan0/query/NativeTitan0GraphQuery.java
@@ -56,7 +56,7 @@ public class NativeTitan0GraphQuery implements NativeTitanGraphQuery<Titan0Verte
@Override
- public void in(String propertyName, Collection<? extends Object> values) {
+ public void in(String propertyName, Collection<?> values) {
query.has(propertyName, Contain.IN, values);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java b/graphdb/titan0/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
index d0fd401..b3cf4f7 100644
--- a/graphdb/titan0/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
+++ b/graphdb/titan0/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
@@ -39,13 +39,13 @@ public class LocalLockMediatorTest {
public void testLock() throws InterruptedException {
TimestampProvider times = Timestamps.MICRO;
LocalLockMediator<HBaseTransaction> llm =
- new LocalLockMediator<HBaseTransaction>(LOCK_NAMESPACE, times);
+ new LocalLockMediator<>(LOCK_NAMESPACE, times);
//Expire immediately
Assert.assertTrue(llm.lock(kc, mockTx1, times.getTime(0, TimeUnit.NANOSECONDS)));
Assert.assertTrue(llm.lock(kc, mockTx2, times.getTime(Long.MAX_VALUE, TimeUnit.NANOSECONDS)));
- llm = new LocalLockMediator<HBaseTransaction>(LOCK_NAMESPACE, times);
+ llm = new LocalLockMediator<>(LOCK_NAMESPACE, times);
//Expire later
Assert.assertTrue(llm.lock(kc, mockTx1, times.getTime(Long.MAX_VALUE, TimeUnit.NANOSECONDS)));
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/GraphQueryTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/GraphQueryTest.java b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/GraphQueryTest.java
index bf4519c..5e02205 100644
--- a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/GraphQueryTest.java
+++ b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/GraphQueryTest.java
@@ -402,7 +402,7 @@ public class GraphQueryTest extends AbstractGraphDatabaseTest {
}
private static <T> List<T> toList(Iterable<T> itr) {
- List<T> result = new ArrayList<T>();
+ List<T> result = new ArrayList<>();
for(T object : itr) {
result.add(object);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
----------------------------------------------------------------------
diff --git a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
index e82de48..ade395b 100644
--- a/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
+++ b/graphdb/titan0/src/test/java/org/apache/atlas/repository/graphdb/titan0/Titan0DatabaseTest.java
@@ -90,38 +90,24 @@ public class Titan0DatabaseTest {
testProperty(graph, "booleanProperty", Boolean.TRUE);
testProperty(graph, "booleanProperty", Boolean.FALSE);
- testProperty(graph, "booleanProperty", new Boolean(Boolean.TRUE));
- testProperty(graph, "booleanProperty", new Boolean(Boolean.FALSE));
testProperty(graph, "byteProperty", Byte.MAX_VALUE);
testProperty(graph, "byteProperty", Byte.MIN_VALUE);
- testProperty(graph, "byteProperty", new Byte(Byte.MAX_VALUE));
- testProperty(graph, "byteProperty", new Byte(Byte.MIN_VALUE));
testProperty(graph, "shortProperty", Short.MAX_VALUE);
testProperty(graph, "shortProperty", Short.MIN_VALUE);
- testProperty(graph, "shortProperty", new Short(Short.MAX_VALUE));
- testProperty(graph, "shortProperty", new Short(Short.MIN_VALUE));
testProperty(graph, "intProperty", Integer.MAX_VALUE);
testProperty(graph, "intProperty", Integer.MIN_VALUE);
- testProperty(graph, "intProperty", new Integer(Integer.MAX_VALUE));
- testProperty(graph, "intProperty", new Integer(Integer.MIN_VALUE));
testProperty(graph, "longProperty", Long.MIN_VALUE);
testProperty(graph, "longProperty", Long.MAX_VALUE);
- testProperty(graph, "longProperty", new Long(Long.MIN_VALUE));
- testProperty(graph, "longProperty", new Long(Long.MAX_VALUE));
testProperty(graph, "doubleProperty", Double.MAX_VALUE);
testProperty(graph, "doubleProperty", Double.MIN_VALUE);
- testProperty(graph, "doubleProperty", new Double(Double.MAX_VALUE));
- testProperty(graph, "doubleProperty", new Double(Double.MIN_VALUE));
testProperty(graph, "floatProperty", Float.MAX_VALUE);
testProperty(graph, "floatProperty", Float.MIN_VALUE);
- testProperty(graph, "floatProperty", new Float(Float.MAX_VALUE));
- testProperty(graph, "floatProperty", new Float(Float.MIN_VALUE));
// enumerations - TypeCategory
testProperty(graph, "typeCategoryProperty", TypeCategory.CLASS);
@@ -147,7 +133,7 @@ public class Titan0DatabaseTest {
@Test
public <V, E> void testMultiplicityOnePropertySupport() {
- AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
+ AtlasGraph<V, E> graph = getGraph();
AtlasVertex<V, E> vertex = graph.addVertex();
vertex.setProperty("name", "Jeff");
@@ -183,7 +169,7 @@ public class Titan0DatabaseTest {
@Test
public <V, E> void testRemoveEdge() {
- AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
+ AtlasGraph<V, E> graph = getGraph();
AtlasVertex<V, E> v1 = graph.addVertex();
AtlasVertex<V, E> v2 = graph.addVertex();
@@ -205,7 +191,7 @@ public class Titan0DatabaseTest {
@Test
public <V, E> void testRemoveVertex() {
- AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
+ AtlasGraph<V, E> graph = getGraph();
AtlasVertex<V, E> v1 = graph.addVertex();
@@ -219,7 +205,7 @@ public class Titan0DatabaseTest {
@Test
public <V, E> void testGetEdges() {
- AtlasGraph<V, E> graph = (AtlasGraph<V, E>) getGraph();
+ AtlasGraph<V, E> graph = getGraph();
AtlasVertex<V, E> v1 = graph.addVertex();
AtlasVertex<V, E> v2 = graph.addVertex();
AtlasVertex<V, E> v3 = graph.addVertex();
@@ -296,7 +282,7 @@ public class Titan0DatabaseTest {
AtlasGraph<V, E> graph = getGraph();
AtlasVertex<V, E> vertex = graph.addVertex();
- vertex.setListProperty("colors", Arrays.asList(new String[] { "red", "blue", "green" }));
+ vertex.setListProperty("colors", Arrays.asList("red", "blue", "green"));
List<String> colors = vertex.getListProperty("colors");
assertTrue(colors.contains("red"));
assertTrue(colors.contains("blue"));
@@ -419,7 +405,7 @@ public class Titan0DatabaseTest {
}
private static <T> List<T> toList(Iterable<? extends T> iterable) {
- List<T> result = new ArrayList<T>();
+ List<T> result = new ArrayList<>();
for (T item : iterable) {
result.add(item);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/SearchFilter.java b/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
index 6edf415..4d8b258 100644
--- a/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
+++ b/intg/src/main/java/org/apache/atlas/model/SearchFilter.java
@@ -48,7 +48,7 @@ public class SearchFilter {
/**
* to specify whether the result should be sorted? If yes, whether asc or desc.
*/
- public enum SortType { NONE, ASC, DESC };
+ public enum SortType { NONE, ASC, DESC }
private MultivaluedMap<String, String> params = null;
private long startIndex = 0;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java
index 4e4a9e8..2ad0f76 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java
@@ -55,7 +55,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
/**
* Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store.
*/
- public enum Status { STATUS_ACTIVE, STATUS_DELETED };
+ public enum Status { STATUS_ACTIVE, STATUS_DELETED }
private String guid = null;
private Status status = Status.STATUS_ACTIVE;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
index 0c4de4d..538534f 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityHeader.java
@@ -18,7 +18,6 @@
package org.apache.atlas.model.instance;
import java.io.Serializable;
-import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityWithAssociations.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityWithAssociations.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityWithAssociations.java
index 146d3c9..932a40d 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityWithAssociations.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntityWithAssociations.java
@@ -29,7 +29,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import java.io.Serializable;
-import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java
index 41385f5..794310a 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java
@@ -119,7 +119,7 @@ public class AtlasStruct implements Serializable {
if (a != null) {
a.put(name, value);
} else {
- a = new HashMap<String, Object>();
+ a = new HashMap<>();
a.put(name, value);
this.attributes = a;
@@ -208,7 +208,7 @@ public class AtlasStruct implements Serializable {
return sb;
}
- public static StringBuilder dumpObjects(Collection<? extends Object> objects, StringBuilder sb) {
+ public static StringBuilder dumpObjects(Collection<?> objects, StringBuilder sb) {
if (sb == null) {
sb = new StringBuilder();
}
@@ -228,14 +228,14 @@ public class AtlasStruct implements Serializable {
return sb;
}
- public static StringBuilder dumpObjects(Map<? extends Object, ? extends Object> objects, StringBuilder sb) {
+ public static StringBuilder dumpObjects(Map<?, ?> objects, StringBuilder sb) {
if (sb == null) {
sb = new StringBuilder();
}
if (MapUtils.isNotEmpty(objects)) {
int i = 0;
- for (Map.Entry<? extends Object, ? extends Object> e : objects.entrySet()) {
+ for (Map.Entry<?, ?> e : objects.entrySet()) {
if (i > 0) {
sb.append(", ");
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
index 45efb04..35f2f14 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutationResponse.java
@@ -29,7 +29,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -71,7 +70,7 @@ public class EntityMutationResponse {
public void addEntity(EntityMutations.EntityOperation op, AtlasEntityHeader header) {
if (entitiesMutated == null) {
- entitiesMutated = new HashMap<EntityMutations.EntityOperation, List<AtlasEntityHeader>>();
+ entitiesMutated = new HashMap<>();
}
if (entitiesMutated != null && entitiesMutated.get(op) == null) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/instance/EntityMutations.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutations.java b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutations.java
index 6119daf..3501c90 100644
--- a/intg/src/main/java/org/apache/atlas/model/instance/EntityMutations.java
+++ b/intg/src/main/java/org/apache/atlas/model/instance/EntityMutations.java
@@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java
index e2d6181..f8083de 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java
@@ -20,6 +20,7 @@ package org.apache.atlas.model.typedef;
import org.apache.atlas.model.TypeCategory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@@ -278,6 +279,7 @@ public abstract class AtlasBaseTypeDef implements java.io.Serializable {
return sb;
}
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -313,11 +315,6 @@ public abstract class AtlasBaseTypeDef implements java.io.Serializable {
return result;
}
- @Override
- public String toString() {
- return toString(new StringBuilder()).toString();
- }
-
public static String getArrayTypeName(String elemTypeName) {
return ATLAS_TYPE_ARRAY_PREFIX + elemTypeName + ATLAS_TYPE_ARRAY_SUFFIX;
}
@@ -327,7 +324,7 @@ public abstract class AtlasBaseTypeDef implements java.io.Serializable {
valueTypeName, ATLAS_TYPE_MAP_SUFFIX);
}
- public static StringBuilder dumpObjects(Collection<? extends Object> objects, StringBuilder sb) {
+ public static StringBuilder dumpObjects(Collection<?> objects, StringBuilder sb) {
if (sb == null) {
sb = new StringBuilder();
}
@@ -347,14 +344,14 @@ public abstract class AtlasBaseTypeDef implements java.io.Serializable {
return sb;
}
- public static StringBuilder dumpObjects(Map<? extends Object, ? extends Object> objects, StringBuilder sb) {
+ public static StringBuilder dumpObjects(Map<?, ?> objects, StringBuilder sb) {
if (sb == null) {
sb = new StringBuilder();
}
if (MapUtils.isNotEmpty(objects)) {
int i = 0;
- for (Map.Entry<? extends Object, ? extends Object> e : objects.entrySet()) {
+ for (Map.Entry<?, ?> e : objects.entrySet()) {
if (i > 0) {
sb.append(", ");
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java
index 7032182..eeaf714 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java
@@ -103,9 +103,9 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se
}
if (CollectionUtils.isEmpty(superTypes)) {
- this.superTypes = new HashSet<String>();
+ this.superTypes = new HashSet<>();
} else {
- this.superTypes = new HashSet<String>(superTypes);
+ this.superTypes = new HashSet<>(superTypes);
}
}
@@ -117,7 +117,7 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se
Set<String> s = this.superTypes;
if (!hasSuperType(s, typeName)) {
- s = new HashSet<String>(s);
+ s = new HashSet<>(s);
s.add(typeName);
@@ -129,7 +129,7 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se
Set<String> s = this.superTypes;
if (hasSuperType(s, typeName)) {
- s = new HashSet<String>(s);
+ s = new HashSet<>(s);
s.remove(typeName);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java
index 480b27b..85e9d77 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java
@@ -101,9 +101,9 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
}
if (CollectionUtils.isEmpty(superTypes)) {
- this.superTypes = new HashSet<String>();
+ this.superTypes = new HashSet<>();
} else {
- this.superTypes = new HashSet<String>(superTypes);
+ this.superTypes = new HashSet<>(superTypes);
}
}
@@ -115,7 +115,7 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
Set<String> s = this.superTypes;
if (!hasSuperType(s, typeName)) {
- s = new HashSet<String>(s);
+ s = new HashSet<>(s);
s.add(typeName);
@@ -127,7 +127,7 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
Set<String> s = this.superTypes;
if (hasSuperType(s, typeName)) {
- s = new HashSet<String>(s);
+ s = new HashSet<>(s);
s.remove(typeName);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java
index 69d7b30..a9aaed2 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java
@@ -107,11 +107,11 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable {
}
if (CollectionUtils.isEmpty(elementDefs)) {
- this.elementDefs = new ArrayList<AtlasEnumElementDef>();
+ this.elementDefs = new ArrayList<>();
} else {
// if multiple elements with same value are present, keep only the last entry
- List<AtlasEnumElementDef> tmpList = new ArrayList<AtlasEnumElementDef>(elementDefs.size());
- Set<String> elementValues = new HashSet<String>();
+ List<AtlasEnumElementDef> tmpList = new ArrayList<>(elementDefs.size());
+ Set<String> elementValues = new HashSet<>();
ListIterator<AtlasEnumElementDef> iter = elementDefs.listIterator(elementDefs.size());
while (iter.hasPrevious()) {
@@ -149,7 +149,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable {
public void addElement(AtlasEnumElementDef elementDef) {
List<AtlasEnumElementDef> e = this.elementDefs;
- List<AtlasEnumElementDef> tmpList = new ArrayList<AtlasEnumElementDef>();
+ List<AtlasEnumElementDef> tmpList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(e)) {
// copy existing elements, except ones having same value as the element being added
for (AtlasEnumElementDef existingElem : e) {
@@ -168,7 +168,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable {
// if element doesn't exist, no need to create the tmpList below
if (hasElement(e, elemValue)) {
- List<AtlasEnumElementDef> tmpList = new ArrayList<AtlasEnumElementDef>();
+ List<AtlasEnumElementDef> tmpList = new ArrayList<>();
// copy existing elements, except ones having same value as the element being removed
for (AtlasEnumElementDef existingElem : e) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java
index 4de7179..aee26ef 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java
@@ -106,11 +106,11 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
}
if (CollectionUtils.isEmpty(attributeDefs)) {
- this.attributeDefs = new ArrayList<AtlasAttributeDef>();
+ this.attributeDefs = new ArrayList<>();
} else {
// if multiple attributes with same name are present, keep only the last entry
- List<AtlasAttributeDef> tmpList = new ArrayList<AtlasAttributeDef>(attributeDefs.size());
- Set<String> attribNames = new HashSet<String>();
+ List<AtlasAttributeDef> tmpList = new ArrayList<>(attributeDefs.size());
+ Set<String> attribNames = new HashSet<>();
ListIterator<AtlasAttributeDef> iter = attributeDefs.listIterator(attributeDefs.size());
while (iter.hasPrevious()) {
@@ -144,7 +144,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
List<AtlasAttributeDef> a = this.attributeDefs;
- List<AtlasAttributeDef> tmpList = new ArrayList<AtlasAttributeDef>();
+ List<AtlasAttributeDef> tmpList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(a)) {
// copy existing attributes, except ones having same name as the attribute being added
for (AtlasAttributeDef existingAttrDef : a) {
@@ -162,7 +162,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
List<AtlasAttributeDef> a = this.attributeDefs;
if (hasAttribute(a, attrName)) {
- List<AtlasAttributeDef> tmpList = new ArrayList<AtlasAttributeDef>();
+ List<AtlasAttributeDef> tmpList = new ArrayList<>();
// copy existing attributes, except ones having same name as the attribute being removed
for (AtlasAttributeDef existingAttrDef : a) {
@@ -256,7 +256,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
/**
* single-valued attribute or multi-valued attribute.
*/
- public enum Cardinality { SINGLE, LIST, SET };
+ public enum Cardinality { SINGLE, LIST, SET }
public static final int COUNT_NOT_SET = -1;
@@ -376,7 +376,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
if (CollectionUtils.isEmpty(constraintDefs)) {
this.constraintDefs = null;
} else {
- this.constraintDefs = new ArrayList<AtlasConstraintDef>(constraintDefs);
+ this.constraintDefs = new ArrayList<>(constraintDefs);
}
}
@@ -482,7 +482,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
this.type = type;
if (params != null) {
- this.params = new HashMap<String, Object>(params);
+ this.params = new HashMap<>(params);
}
}
@@ -491,7 +491,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
this.type = that.type;
if (that.params != null) {
- this.params = new HashMap<String, Object>(that.params);
+ this.params = new HashMap<>(that.params);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java b/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
index 48d0a27..02851c4 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
@@ -111,8 +111,8 @@ public class AtlasArrayType extends AtlasType {
}
@Override
- public Collection<? extends Object> createDefaultValue() {
- Collection<Object> ret = new ArrayList<Object>();
+ public Collection<?> createDefaultValue() {
+ Collection<Object> ret = new ArrayList<>();
ret.add(elementType.createDefaultValue());
@@ -161,13 +161,13 @@ public class AtlasArrayType extends AtlasType {
}
@Override
- public Collection<? extends Object> getNormalizedValue(Object obj) {
+ public Collection<?> getNormalizedValue(Object obj) {
if (obj == null) {
return null;
}
if (obj instanceof List || obj instanceof Set) {
- List<Object> ret = new ArrayList<Object>();
+ List<Object> ret = new ArrayList<>();
Collection objList = (Collection) obj;
@@ -191,7 +191,7 @@ public class AtlasArrayType extends AtlasType {
return ret;
} else if (obj.getClass().isArray()) {
- List<Object> ret = new ArrayList<Object>();
+ List<Object> ret = new ArrayList<>();
int arrayLen = Array.getLength(obj);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java b/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
index c135073..5ad3a55 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
@@ -73,7 +73,7 @@ public class AtlasBuiltInTypes {
* class that implements behaviour of byte type.
*/
public static class AtlasByteType extends AtlasType {
- private static final Byte DEFAULT_VALUE = new Byte((byte)0);
+ private static final Byte DEFAULT_VALUE = (byte) 0;
public AtlasByteType() {
super(AtlasBaseTypeDef.ATLAS_TYPE_BYTE, TypeCategory.PRIMITIVE);
@@ -117,7 +117,7 @@ public class AtlasBuiltInTypes {
* class that implements behaviour of short type.
*/
public static class AtlasShortType extends AtlasType {
- private static final Short DEFAULT_VALUE = new Short((short)0);
+ private static final Short DEFAULT_VALUE = (short) 0;
public AtlasShortType() {
super(AtlasBaseTypeDef.ATLAS_TYPE_SHORT, TypeCategory.PRIMITIVE);
@@ -161,7 +161,7 @@ public class AtlasBuiltInTypes {
* class that implements behaviour of integer type.
*/
public static class AtlasIntType extends AtlasType {
- private static final Integer DEFAULT_VALUE = new Integer(0);
+ private static final Integer DEFAULT_VALUE = 0;
public AtlasIntType() {
super(AtlasBaseTypeDef.ATLAS_TYPE_INT, TypeCategory.PRIMITIVE);
@@ -205,7 +205,7 @@ public class AtlasBuiltInTypes {
* class that implements behaviour of long type.
*/
public static class AtlasLongType extends AtlasType {
- private static final Long DEFAULT_VALUE = new Long(0);
+ private static final Long DEFAULT_VALUE = 0L;
public AtlasLongType() {
super(AtlasBaseTypeDef.ATLAS_TYPE_LONG, TypeCategory.PRIMITIVE);
@@ -249,7 +249,7 @@ public class AtlasBuiltInTypes {
* class that implements behaviour of float type.
*/
public static class AtlasFloatType extends AtlasType {
- private static final Float DEFAULT_VALUE = new Float(0);
+ private static final Float DEFAULT_VALUE = 0f;
public AtlasFloatType() {
super(AtlasBaseTypeDef.ATLAS_TYPE_FLOAT, TypeCategory.PRIMITIVE);
@@ -293,7 +293,7 @@ public class AtlasBuiltInTypes {
* class that implements behaviour of double type.
*/
public static class AtlasDoubleType extends AtlasType {
- private static final Double DEFAULT_VALUE = new Double(0);
+ private static final Double DEFAULT_VALUE = 0d;
public AtlasDoubleType() {
super(AtlasBaseTypeDef.ATLAS_TYPE_DOUBLE, TypeCategory.PRIMITIVE);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java b/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
index 83b6385..8772720 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
@@ -20,7 +20,6 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
@@ -146,11 +145,11 @@ public class AtlasClassificationType extends AtlasStructType {
}
public boolean isSuperTypeOf(AtlasClassificationType classificationType) {
- return classificationType != null ? classificationType.getAllSuperTypes().contains(this.getTypeName()) : false;
+ return classificationType != null && classificationType.getAllSuperTypes().contains(this.getTypeName());
}
public boolean isSubTypeOf(AtlasClassificationType classificationType) {
- return classificationType != null ? allSuperTypes.contains(classificationType.getTypeName()) : false;
+ return classificationType != null && allSuperTypes.contains(classificationType.getTypeName());
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java b/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
index 96f3da4..3625f72 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
@@ -20,7 +20,6 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
@@ -144,11 +143,11 @@ public class AtlasEntityType extends AtlasStructType {
}
public boolean isSuperTypeOf(AtlasEntityType entityType) {
- return entityType != null ? entityType.getAllSuperTypes().contains(this.getTypeName()) : false;
+ return entityType != null && entityType.getAllSuperTypes().contains(this.getTypeName());
}
public boolean isSubTypeOf(AtlasEntityType entityType) {
- return entityType != null ? allSuperTypes.contains(entityType.getTypeName()) : false;
+ return entityType != null && allSuperTypes.contains(entityType.getTypeName());
}
@Override
[2/4] incubator-atlas git commit: ATLAS-1304: Redundant code removal
and code simplification
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java b/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
index eba87a7..db169d0 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
@@ -39,7 +38,7 @@ public class AtlasEnumType extends AtlasType {
public AtlasEnumType(AtlasEnumDef enumDef) {
super(enumDef);
- Map<String, AtlasEnumElementDef> e = new HashMap<String, AtlasEnumElementDef>();
+ Map<String, AtlasEnumElementDef> e = new HashMap<>();
for (AtlasEnumElementDef elementDef : enumDef.getElementDefs()) {
e.put(elementDef.getValue().toLowerCase(), elementDef);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
index 60899fd..6e6c522 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
@@ -93,7 +93,7 @@ public class AtlasMapType extends AtlasType {
@Override
public Map<Object, Object> createDefaultValue() {
- Map<Object, Object> ret = new HashMap<Object, Object>();
+ Map<Object, Object> ret = new HashMap<>();
ret.put(keyType.createDefaultValue(), valueType.createDefaultValue());
@@ -126,7 +126,7 @@ public class AtlasMapType extends AtlasType {
}
if (obj instanceof Map) {
- Map<Object, Object> ret = new HashMap<Object, Object>();
+ Map<Object, Object> ret = new HashMap<>();
Map<Object, Objects> map = (Map<Object, Objects>) obj;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
index ef5f736..e20af76 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -51,7 +51,7 @@ public class AtlasStructType extends AtlasType {
private Map<String, AtlasType> attrTypes = Collections.emptyMap();
private Set<String> foreignKeyAttributes = new HashSet<>();
- private Map<String, TypeAttributePair> mappedFromRefAttributes = new HashMap<String, TypeAttributePair>();
+ private Map<String, TypeAttributePair> mappedFromRefAttributes = new HashMap<>();
public AtlasStructType(AtlasStructDef structDef) {
@@ -101,7 +101,7 @@ public class AtlasStructType extends AtlasType {
@Override
public void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException {
- Map<String, AtlasType> a = new HashMap<String, AtlasType>();
+ Map<String, AtlasType> a = new HashMap<>();
for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) {
AtlasType attrType = typeRegistry.getType(attributeDef.getTypeName());
@@ -275,7 +275,7 @@ public class AtlasStructType extends AtlasType {
Map<String, Object> attributes = obj.getAttributes();
if (attributes == null) {
- attributes = new HashMap<String, Object>();
+ attributes = new HashMap<>();
}
for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) {
@@ -348,13 +348,16 @@ public class AtlasStructType extends AtlasType {
continue;
}
- if (constraintType.equals(AtlasConstraintDef.CONSTRAINT_TYPE_FOREIGN_KEY)) {
- resolveForeignKeyConstraint(attribDef, constraintDef, attribType);
- } else if (constraintType.equals(CONSTRAINT_TYPE_MAPPED_FROM_REF)) {
- resolveMappedFromRefConstraint(attribDef, constraintDef, attribType);
- } else {
- throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_CONSTRAINT, constraintType,
- getTypeName(), attribDef.getName());
+ switch (constraintType) {
+ case AtlasConstraintDef.CONSTRAINT_TYPE_FOREIGN_KEY:
+ resolveForeignKeyConstraint(attribDef, constraintDef, attribType);
+ break;
+ case CONSTRAINT_TYPE_MAPPED_FROM_REF:
+ resolveMappedFromRefConstraint(attribDef, constraintDef, attribType);
+ break;
+ default:
+ throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_CONSTRAINT, constraintType,
+ getTypeName(), attribDef.getName());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
index 0c118f0..7aa4f29 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -539,12 +539,12 @@ public class AtlasTypeRegistry {
LOG.debug("==> AtlasTypeRegistry.updateType({})", typeDef);
}
- if (typeDef == null) {
- // ignore
- } else if (StringUtils.isNotBlank(typeDef.getGuid())) {
- updateTypeByGuidWithNoRefResolve(typeDef.getGuid(), typeDef);
- } else if (StringUtils.isNotBlank(typeDef.getName())) {
- updateTypeByNameWithNoRefResolve(typeDef.getName(), typeDef);
+ if (typeDef != null) {
+ if (StringUtils.isNotBlank(typeDef.getGuid())) {
+ updateTypeByGuidWithNoRefResolve(typeDef.getGuid(), typeDef);
+ } else if (StringUtils.isNotBlank(typeDef.getName())) {
+ updateTypeByNameWithNoRefResolve(typeDef.getName(), typeDef);
+ }
}
if (LOG.isDebugEnabled()) {
@@ -694,15 +694,13 @@ class TypeCache {
}
public AtlasType getTypeByGuid(String guid) {
- AtlasType ret = guid != null ? typeGuidMap.get(guid) : null;
- return ret;
+ return guid != null ? typeGuidMap.get(guid) : null;
}
public AtlasType getTypeByName(String name) {
- AtlasType ret = name != null ? typeNameMap.get(name) : null;
- return ret;
+ return name != null ? typeNameMap.get(name) : null;
}
public void updateGuid(String typeName, String currGuid, String newGuid) {
@@ -768,15 +766,13 @@ class TypeDefCache<T extends AtlasBaseTypeDef> {
}
public T getTypeDefByGuid(String guid) {
- T ret = guid != null ? typeDefGuidMap.get(guid) : null;
- return ret;
+ return guid != null ? typeDefGuidMap.get(guid) : null;
}
public T getTypeDefByName(String name) {
- T ret = name != null ? typeDefNameMap.get(name) : null;
- return ret;
+ return name != null ? typeDefNameMap.get(name) : null;
}
public void updateGuid(String typeName, String newGuid) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
index 6eed60f..b0a4e07 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
@@ -51,14 +51,14 @@ import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_SUF
* Utility methods for AtlasType/AtlasTypeDef.
*/
public class AtlasTypeUtil {
- private static final Set<String> ATLAS_BUILTIN_TYPENAMES = new HashSet<String>();
+ private static final Set<String> ATLAS_BUILTIN_TYPENAMES = new HashSet<>();
static {
Collections.addAll(ATLAS_BUILTIN_TYPENAMES, AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES);
}
public static Set<String> getReferencedTypeNames(String typeName) {
- Set<String> ret = new HashSet<String>();
+ Set<String> ret = new HashSet<>();
getReferencedTypeNames(typeName, ret);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
index 249af6e..53b109c 100755
--- a/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
+++ b/intg/src/test/java/org/apache/atlas/TestUtilsV2.java
@@ -656,7 +656,7 @@ public final class TestUtilsV2 {
AtlasTypeUtil.createRequiredAttrDef("level", "int"));
AtlasClassificationDef janitorSecurityClearanceTypeDef =
- AtlasTypeUtil.createTraitTypeDef("JanitorClearance", "JanitorClearance_description", ImmutableSet.<String>of("SecurityClearance1"),
+ AtlasTypeUtil.createTraitTypeDef("JanitorClearance", "JanitorClearance_description", ImmutableSet.of("SecurityClearance1"),
AtlasTypeUtil.createRequiredAttrDef("level", "int"));
return Arrays.asList(securityClearanceTypeDef, janitorSecurityClearanceTypeDef);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
index c0bb1f2..ee78350 100644
--- a/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
+++ b/intg/src/test/java/org/apache/atlas/model/ModelTestUtil.java
@@ -357,28 +357,28 @@ public final class ModelTestUtil {
}
public static List<AtlasAttributeDef> newAttributeDefsWithAllBuiltInTypes(String attrNamePrefix) {
- List<AtlasAttributeDef> ret = new ArrayList<AtlasAttributeDef>();
+ List<AtlasAttributeDef> ret = new ArrayList<>();
// add all built-in types
- for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, ATLAS_BUILTIN_TYPES[i]));
+ for (String ATLAS_BUILTIN_TYPE2 : ATLAS_BUILTIN_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, ATLAS_BUILTIN_TYPE2));
}
// add enum types
ret.add(getAttributeDef(attrNamePrefix, ENUM_DEF.getName()));
ret.add(getAttributeDef(attrNamePrefix, ENUM_DEF_WITH_NO_DEFAULT.getName()));
// add array of built-in types
- for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ATLAS_BUILTIN_TYPES[i])));
+ for (String ATLAS_BUILTIN_TYPE1 : ATLAS_BUILTIN_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ATLAS_BUILTIN_TYPE1)));
}
// add array of enum types
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF.getName())));
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName())));
// add few map types
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+ for (String ATLAS_PRIMITIVE_TYPE3 : ATLAS_PRIMITIVE_TYPES) {
ret.add(getAttributeDef(attrNamePrefix,
- AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType())));
+ AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE3, getRandomBuiltInType())));
}
// add map types with enum as key
ret.add(getAttributeDef(attrNamePrefix,
@@ -392,7 +392,7 @@ public final class ModelTestUtil {
AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF_WITH_NO_DEFAULT.getName())));
// add few array of arrays
- for (int i = 0; i < ATLAS_BUILTIN_TYPES.length; i++) {
+ for (String ATLAS_BUILTIN_TYPE : ATLAS_BUILTIN_TYPES) {
ret.add(getAttributeDef(attrNamePrefix,
AtlasBaseTypeDef.getArrayTypeName(AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
}
@@ -400,9 +400,9 @@ public final class ModelTestUtil {
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(ENUM_DEF_WITH_NO_DEFAULT.getName())));
// add few array of maps
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
+ for (String ATLAS_PRIMITIVE_TYPE2 : ATLAS_PRIMITIVE_TYPES) {
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
- AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType()))));
+ AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE2, getRandomBuiltInType()))));
}
ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getArrayTypeName(
AtlasBaseTypeDef.getMapTypeName(ENUM_DEF.getName(), getRandomBuiltInType()))));
@@ -414,15 +414,15 @@ public final class ModelTestUtil {
AtlasBaseTypeDef.getMapTypeName(getRandomPrimitiveType(), ENUM_DEF_WITH_NO_DEFAULT.getName()))));
// add few map of arrays
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i],
- AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
+ for (String ATLAS_PRIMITIVE_TYPE1 : ATLAS_PRIMITIVE_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE1,
+ AtlasBaseTypeDef.getArrayTypeName(getRandomBuiltInType()))));
}
// add few map of maps
- for (int i = 0; i < ATLAS_PRIMITIVE_TYPES.length; i++) {
- ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i],
- AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPES[i], getRandomBuiltInType()))));
+ for (String ATLAS_PRIMITIVE_TYPE : ATLAS_PRIMITIVE_TYPES) {
+ ret.add(getAttributeDef(attrNamePrefix, AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE,
+ AtlasBaseTypeDef.getMapTypeName(ATLAS_PRIMITIVE_TYPE, getRandomBuiltInType()))));
}
return ret;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
index b8cc77c..46d4d06 100644
--- a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEntityDef.java
@@ -103,7 +103,7 @@ public class TestAtlasEntityDef {
AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes();
Set<String> oldSuperTypes = entityDef.getSuperTypes();
- Set<String> newSuperTypes = new HashSet<String>();
+ Set<String> newSuperTypes = new HashSet<>();
newSuperTypes.add("newType-abcd-1234");
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
index 61e102e..e0a6a00 100644
--- a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasEnumDef.java
@@ -93,7 +93,7 @@ public class TestAtlasEnumDef {
AtlasEnumDef enumDef = ModelTestUtil.newEnumDef();
List<AtlasEnumElementDef> oldElements = enumDef.getElementDefs();
- List<AtlasEnumElementDef> newElements = new ArrayList<AtlasEnumElementDef>();
+ List<AtlasEnumElementDef> newElements = new ArrayList<>();
newElements.add(new AtlasEnumElementDef("newElement", "new Element", 100));
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
index e1a9658..e882473 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasArrayType.java
@@ -33,14 +33,14 @@ public class TestAtlasArrayType {
private final Object[] invalidValues;
{
- List<Integer> intList = new ArrayList<Integer>();
- Set<Integer> intSet = new HashSet<Integer>();
+ List<Integer> intList = new ArrayList<>();
+ Set<Integer> intSet = new HashSet<>();
Integer[] intArray = new Integer[] { 1, 2, 3 };
- List<Object> objList = new ArrayList<Object>();
- Set<Object> objSet = new HashSet<Object>();
+ List<Object> objList = new ArrayList<>();
+ Set<Object> objSet = new HashSet<>();
Object[] objArray = new Object[] { 1, 2, 3 };
- List<String> strList = new ArrayList<String>();
- Set<String> strSet = new HashSet<String>();
+ List<String> strList = new ArrayList<>();
+ Set<String> strSet = new HashSet<>();
String[] strArray = new String[] { "1", "2", "3" };
for (int i = 0; i < 10; i++) {
@@ -105,7 +105,7 @@ public class TestAtlasArrayType {
@Test
public void testArrayTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(intArrayType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
index 0d8c65f..8538b80 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigDecimalType.java
@@ -94,7 +94,7 @@ public class TestAtlasBigDecimalType {
@Test
public void testBigDecimalTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(bigDecimalType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
index f234bb8..f94fec4 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBigIntegerType.java
@@ -95,7 +95,7 @@ public class TestAtlasBigIntegerType {
@Test
public void testBigIntegerTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(bigIntegerType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
index 4373a38..ec5f75a 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasBooleanType.java
@@ -73,7 +73,7 @@ public class TestAtlasBooleanType {
@Test
public void testBooleanTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(booleanType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
index 338ceda..a7ada38 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasByteType.java
@@ -95,7 +95,7 @@ public class TestAtlasByteType {
@Test
public void testByteTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(byteType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
index fc2de25..aaf4a6a 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java
@@ -31,8 +31,8 @@ import static org.testng.Assert.*;
public class TestAtlasClassificationType {
private final AtlasClassificationType classificationType;
- private final List<Object> validValues = new ArrayList<Object>();
- private final List<Object> invalidValues = new ArrayList<Object>();
+ private final List<Object> validValues = new ArrayList<>();
+ private final List<Object> invalidValues = new ArrayList<>();
{
classificationType = getClassificationType(ModelTestUtil.getClassificationDefWithSuperTypes());
@@ -55,7 +55,7 @@ public class TestAtlasClassificationType {
invalidValues.add(invalidValue2);
invalidValues.add(invalidValue3);
invalidValues.add(new AtlasClassification()); // no values for mandatory attributes
- invalidValues.add(new HashMap<Object, Object>()); // no values for mandatory attributes
+ invalidValues.add(new HashMap<>()); // no values for mandatory attributes
invalidValues.add(1); // incorrect datatype
invalidValues.add(new HashSet()); // incorrect datatype
invalidValues.add(new ArrayList()); // incorrect datatype
@@ -102,7 +102,7 @@ public class TestAtlasClassificationType {
@Test
public void testClassificationTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(classificationType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
index a28840a..1b3bbc7 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasDateType.java
@@ -107,7 +107,7 @@ public class TestAtlasDateType {
@Test
public void testDateTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(dateType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
index 1b1e013..b3cbe72 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasDoubleType.java
@@ -95,7 +95,7 @@ public class TestAtlasDoubleType {
@Test
public void testDoubleTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(doubleType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
index 90fea9f..710840f 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasEntityType.java
@@ -38,8 +38,8 @@ import static org.testng.Assert.*;
public class TestAtlasEntityType {
private final AtlasEntityType entityType;
- private final List<Object> validValues = new ArrayList<Object>();
- private final List<Object> invalidValues = new ArrayList<Object>();
+ private final List<Object> validValues = new ArrayList<>();
+ private final List<Object> invalidValues = new ArrayList<>();
{
entityType = getEntityType(ModelTestUtil.getEntityDefWithSuperTypes());
@@ -62,7 +62,7 @@ public class TestAtlasEntityType {
invalidValues.add(invalidValue2);
invalidValues.add(invalidValue3);
invalidValues.add(new AtlasEntity()); // no values for mandatory attributes
- invalidValues.add(new HashMap<Object, Object>()); // no values for mandatory attributes
+ invalidValues.add(new HashMap<>()); // no values for mandatory attributes
invalidValues.add(1); // incorrect datatype
invalidValues.add(new HashSet()); // incorrect datatype
invalidValues.add(new ArrayList()); // incorrect datatype
@@ -109,7 +109,7 @@ public class TestAtlasEntityType {
@Test
public void testEntityTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(entityType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
index dbfcf1d..64fc3e3 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasFloatType.java
@@ -95,7 +95,7 @@ public class TestAtlasFloatType {
@Test
public void testFloatTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(floatType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
index f6f6041..c2b5eb4 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasIntType.java
@@ -95,7 +95,7 @@ public class TestAtlasIntType {
@Test
public void testIntTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(intType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
index b9fb089..7eefcc2 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasLongType.java
@@ -95,7 +95,7 @@ public class TestAtlasLongType {
@Test
public void testLongTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(longType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
index 6f75d54..dcee3fe 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasMapType.java
@@ -34,13 +34,13 @@ public class TestAtlasMapType {
private final Object[] invalidValues;
{
- Map<String, Integer> strIntMap = new HashMap<String, Integer>();
- Map<String, Double> strDoubleMap = new HashMap<String, Double>();
- Map<String, String> strStringMap = new HashMap<String, String>();
- Map<Integer, Integer> intIntMap = new HashMap<Integer, Integer>();
- Map<Object, Object> objObjMap = new HashMap<Object, Object>();
- Map<Object, Object> invObjObjMap1 = new HashMap<Object, Object>();
- Map<Object, Object> invObjObjMap2 = new HashMap<Object, Object>();
+ Map<String, Integer> strIntMap = new HashMap<>();
+ Map<String, Double> strDoubleMap = new HashMap<>();
+ Map<String, String> strStringMap = new HashMap<>();
+ Map<Integer, Integer> intIntMap = new HashMap<>();
+ Map<Object, Object> objObjMap = new HashMap<>();
+ Map<Object, Object> invObjObjMap1 = new HashMap<>();
+ Map<Object, Object> invObjObjMap2 = new HashMap<>();
for (int i = 0; i < 10; i++) {
strIntMap.put(Integer.toString(i), i);
@@ -54,7 +54,7 @@ public class TestAtlasMapType {
invObjObjMap2.put("123", "xyz"); // invalid value
validValues = new Object[] {
- null, new HashMap<String, Integer>(), new HashMap<Object, Object>(), strIntMap, strDoubleMap, strStringMap,
+ null, new HashMap<String, Integer>(), new HashMap<>(), strIntMap, strDoubleMap, strStringMap,
intIntMap, objObjMap,
};
@@ -101,7 +101,7 @@ public class TestAtlasMapType {
@Test
public void testMapTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(intIntMapType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
index 61f9146..7d55233 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasObjectIdType.java
@@ -37,11 +37,11 @@ public class TestAtlasObjectIdType {
private final Object[] invalidValues;
{
- Map<String, String> objectId1 = new HashMap<String, String>();
- Map<Object, Object> objectId2 = new HashMap<Object, Object>();
- Map<Object, Object> objectId3 = new HashMap<Object, Object>();
- Map<Object, Object> objectId4 = new HashMap<Object, Object>();
- Map<Object, Object> objectId5 = new HashMap<Object, Object>();
+ Map<String, String> objectId1 = new HashMap<>();
+ Map<Object, Object> objectId2 = new HashMap<>();
+ Map<Object, Object> objectId3 = new HashMap<>();
+ Map<Object, Object> objectId4 = new HashMap<>();
+ Map<Object, Object> objectId5 = new HashMap<>();
objectId1.put(AtlasObjectId.KEY_TYPENAME, "testType");
objectId1.put(AtlasObjectId.KEY_GUID, "guid-1234");
@@ -107,7 +107,7 @@ public class TestAtlasObjectIdType {
@Test
public void testObjectIdTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(objectIdType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
index a266305..2b15ba0 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasShortType.java
@@ -95,7 +95,7 @@ public class TestAtlasShortType {
@Test
public void testShortTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(shortType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
index c171d98..c4c7611 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasStringType.java
@@ -75,7 +75,7 @@ public class TestAtlasStringType {
@Test
public void testStringTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(stringType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
index ee05ba3..7fe4c70 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasStructType.java
@@ -78,8 +78,8 @@ public class TestAtlasStructType {
structDef.addAttribute(multiValuedAttribMax);
structType = getStructType(structDef);
- validValues = new ArrayList<Object>();
- invalidValues = new ArrayList<Object>();
+ validValues = new ArrayList<>();
+ invalidValues = new ArrayList<>();
AtlasStruct invalidValue1 = structType.createDefaultValue();
AtlasStruct invalidValue2 = structType.createDefaultValue();
@@ -121,7 +121,7 @@ public class TestAtlasStructType {
invalidValues.add(invalidValue6);
invalidValues.add(invalidValue7);
invalidValues.add(new AtlasStruct()); // no values for mandatory attributes
- invalidValues.add(new HashMap<Object, Object>()); // no values for mandatory attributes
+ invalidValues.add(new HashMap<>()); // no values for mandatory attributes
invalidValues.add(1); // incorrect datatype
invalidValues.add(new HashSet()); // incorrect datatype
invalidValues.add(new ArrayList()); // incorrect datatype
@@ -168,7 +168,7 @@ public class TestAtlasStructType {
@Test
public void testStructTypeValidateValue() {
- List<String> messages = new ArrayList<String>();
+ List<String> messages = new ArrayList<>();
for (Object value : validValues) {
assertTrue(structType.validateValue(value, "testObj", messages));
assertEquals(messages.size(), 0, "value=" + value);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
----------------------------------------------------------------------
diff --git a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
index 2309ede..0ebfd47 100644
--- a/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
+++ b/notification/src/main/java/org/apache/atlas/kafka/KafkaNotification.java
@@ -277,7 +277,7 @@ public class KafkaNotification extends AbstractNotification implements Service {
protected <T> org.apache.atlas.kafka.KafkaConsumer<T>
createKafkaConsumer(Class<T> type, MessageDeserializer<T> deserializer, KafkaStream stream,
int consumerId, ConsumerConnector consumerConnector, boolean autoCommitEnabled) {
- return new org.apache.atlas.kafka.KafkaConsumer<T>(deserializer, stream,
+ return new org.apache.atlas.kafka.KafkaConsumer<>(deserializer, stream,
consumerId, consumerConnector, autoCommitEnabled);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
----------------------------------------------------------------------
diff --git a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
index c3ec5e2..69b61d6 100644
--- a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
+++ b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoaderUtil.java
@@ -45,7 +45,7 @@ final class AtlasPluginClassLoaderUtil {
LOG.debug("==> AtlasPluginClassLoaderUtil.getFilesInDirectories()");
}
- List<URL> ret = new ArrayList<URL>();
+ List<URL> ret = new ArrayList<>();
for (String libDir : libDirs) {
getFilesInDirectory(libDir, ret);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index b3640d0..792b333 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
+ATLAS-1304 Redundant code removal and code simplification (apoorvnaik via mneethiraj)
ATLAS-1345 Enhance search APIs to resolve hierarchical references (apoorvnaik via sumasai)
ATLAS-1287 Subtasks: ATLAS-1288/ATLAS-1289 Integrated V2 API for Lineage,Entity Details,Tag assign to entity,Tags listing,tag create (kevalbhatt)
ATLAS-1303 Update hashCode and equals method to use standard JDK libraries (apoorvnaik via svimal2106)
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java b/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
index d3903fb..8e086c9 100755
--- a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
+++ b/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java
@@ -101,9 +101,9 @@ public class RepositoryMetadataModule extends com.google.inject.AbstractModule {
Configuration configuration = getConfiguration();
bindAuditRepository(binder(), configuration);
- bind(DeleteHandler.class).to((Class<? extends DeleteHandler>) AtlasRepositoryConfiguration.getDeleteHandlerImpl()).asEagerSingleton();
+ bind(DeleteHandler.class).to(AtlasRepositoryConfiguration.getDeleteHandlerImpl()).asEagerSingleton();
- bind(TypeCache.class).to((Class<? extends TypeCache>) AtlasRepositoryConfiguration.getTypeCache()).asEagerSingleton();
+ bind(TypeCache.class).to(AtlasRepositoryConfiguration.getTypeCache()).asEagerSingleton();
//Add EntityAuditListener as EntityChangeListener
Multibinder<EntityChangeListener> entityChangeListenerBinder =
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java b/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
index fcf120a..fb027ef 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/DataSetLineageService.java
@@ -218,11 +218,9 @@ public class DataSetLineageService implements LineageService {
* @param guid entity id
*/
private String validateDatasetExists(String guid) throws AtlasException {
- Iterator<AtlasVertex> results = graph.query().has(Constants.GUID_PROPERTY_KEY, guid)
- .has(Constants.SUPER_TYPES_PROPERTY_KEY, AtlasClient.DATA_SET_SUPER_TYPE)
- .vertices().iterator();
- while (results.hasNext()) {
- AtlasVertex vertex = results.next();
+ for (AtlasVertex vertex : (Iterable<AtlasVertex>) graph.query().has(Constants.GUID_PROPERTY_KEY, guid)
+ .has(Constants.SUPER_TYPES_PROPERTY_KEY, AtlasClient.DATA_SET_SUPER_TYPE)
+ .vertices()) {
return GraphHelper.getTypeName(vertex);
}
throw new EntityNotFoundException("Dataset with guid = " + guid + " does not exist");
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
index c0cc25c..f2a1fe9 100755
--- a/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/graph/GraphBackedDiscoveryService.java
@@ -19,7 +19,6 @@
package org.apache.atlas.discovery.graph;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
index 6b68961..41dc65f 100644
--- a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
+++ b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin2ExpressionFactory.java
@@ -115,8 +115,7 @@ public class Gremlin2ExpressionFactory extends GremlinExpressionFactory {
GroovyExpression typeMatchesExpr = new ComparisonExpression(typeAttrExpr, ComparisonOperator.EQUALS, typeNameExpr);
GroovyExpression isSuperTypeExpr = new FunctionCallExpression(superTypeAttrExpr, CONTAINS, typeNameExpr);
- GroovyExpression hasSuperTypeAttrExpr = superTypeAttrExpr;
- GroovyExpression superTypeMatchesExpr = new TernaryOperatorExpression(hasSuperTypeAttrExpr, isSuperTypeExpr, LiteralExpression.FALSE);
+ GroovyExpression superTypeMatchesExpr = new TernaryOperatorExpression(superTypeAttrExpr, isSuperTypeExpr, LiteralExpression.FALSE);
return new LogicalExpression(typeMatchesExpr, LogicalOperator.OR, superTypeMatchesExpr);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
index ca1ad5d..e862769 100644
--- a/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
+++ b/repository/src/main/java/org/apache/atlas/gremlin/Gremlin3ExpressionFactory.java
@@ -130,8 +130,7 @@ public class Gremlin3ExpressionFactory extends GremlinExpressionFactory {
@Override
public GroovyExpression getLoopExpressionParent(GroovyExpression inputQry) {
- GroovyExpression curTraversal = new IdentifierExpression("__");
- return curTraversal;
+ return new IdentifierExpression("__");
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
index f2bfc6d..0c5cac6 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
@@ -53,9 +53,7 @@ public class AtlasGraphProvider implements IAtlasGraphProvider {
}
return graphDb_;
}
- catch (IllegalAccessException e) {
- throw new RuntimeException("Error initializing graph database", e);
- } catch (InstantiationException e) {
+ catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException("Error initializing graph database", e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java b/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
index ae1ec45..51e9ab1 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
@@ -202,8 +202,7 @@ public abstract class DeleteHandler {
boolean forceDeleteStructTrait) throws AtlasException {
LOG.debug("Deleting {}", string(edge));
boolean forceDelete =
- (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT)
- ? forceDeleteStructTrait : false;
+ (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT) && forceDeleteStructTrait;
if (typeCategory == DataTypes.TypeCategory.STRUCT || typeCategory == DataTypes.TypeCategory.TRAIT
|| (typeCategory == DataTypes.TypeCategory.CLASS && isComposite)) {
//If the vertex is of type struct/trait, delete the edge and then the reference vertex as the vertex is not shared by any other entities.
@@ -249,10 +248,8 @@ public abstract class DeleteHandler {
protected void deleteVertex(AtlasVertex instanceVertex, boolean force) throws AtlasException {
//Update external references(incoming edges) to this vertex
LOG.debug("Setting the external references to {} to null(removing edges)", string(instanceVertex));
- Iterator<AtlasEdge> edges = instanceVertex.getEdges(AtlasEdgeDirection.IN).iterator();
- while(edges.hasNext()) {
- AtlasEdge edge = edges.next();
+ for (AtlasEdge edge : (Iterable<AtlasEdge>) instanceVertex.getEdges(AtlasEdgeDirection.IN)) {
Id.EntityState edgeState = GraphHelper.getState(edge);
if (edgeState == Id.EntityState.ACTIVE) {
//Delete only the active edge references
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java b/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
index 59472e4..6eb2e8a 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/EntityProcessor.java
@@ -40,7 +40,7 @@ public final class EntityProcessor implements ObjectGraphWalker.NodeProcessor {
}
public Collection<IReferenceableInstance> getInstances() {
- ArrayList<IReferenceableInstance> instances = new ArrayList<IReferenceableInstance>(idToInstanceMap.values());
+ ArrayList<IReferenceableInstance> instances = new ArrayList<>(idToInstanceMap.values());
Collections.reverse(instances);
return instances;
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
index 1a3faf7..f0647a4 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
@@ -19,7 +19,6 @@
package org.apache.atlas.repository.graph;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -349,7 +348,6 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
// Entity does not exist - treat as non-error, since the caller
// wanted to delete the entity and it's already gone.
LOG.info("Deletion request ignored for non-existent entity with guid " + guid);
- continue;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
index 9ef3160..42a22a8 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
@@ -549,7 +549,7 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateCh
if (existingIndex == null) {
- List<AtlasPropertyKey> keys = new ArrayList<AtlasPropertyKey>(2);
+ List<AtlasPropertyKey> keys = new ArrayList<>(2);
keys.add(propertyKey);
keys.add(typePropertyKey);
management.createExactMatchIndex(indexName, false, keys);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
index cb54c3e..6eeddae 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
@@ -388,7 +388,7 @@ public final class GraphHelper {
String actualPropertyName = GraphHelper.encodePropertyKey(propertyName);
LOG.debug("Reading property {} from {}", actualPropertyName, elementStr);
- return (T)element.getProperty(actualPropertyName, clazz);
+ return element.getProperty(actualPropertyName, clazz);
}
@@ -510,7 +510,7 @@ public final class GraphHelper {
}
public static String getIdFromVertex(AtlasVertex vertex) {
- return vertex.<String>getProperty(Constants.GUID_PROPERTY_KEY, String.class);
+ return vertex.getProperty(Constants.GUID_PROPERTY_KEY, String.class);
}
public static String getTypeName(AtlasVertex instanceVertex) {
@@ -687,7 +687,6 @@ public final class GraphHelper {
}
break;
default:
- continue;
}
}
}
@@ -797,7 +796,7 @@ public final class GraphHelper {
}
public static String string(ITypedReferenceableInstance instance) {
- return String.format("entity[type=%s guid=%]", instance.getTypeName(), instance.getId()._getId());
+ return String.format("entity[type=%s guid=%s]", instance.getTypeName(), instance.getId()._getId());
}
public static String string(AtlasVertex<?,?> vertex) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
index 51d5928..8b03b6a 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphSchemaInitializer.java
@@ -18,11 +18,8 @@
package org.apache.atlas.repository.graph;
-import org.apache.atlas.repository.graphdb.AtlasGraph;
-import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.setup.SetupException;
import org.apache.atlas.setup.SetupStep;
-import org.apache.commons.configuration.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
index 84608d9..1a3c31c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphToTypedInstanceMapper.java
@@ -218,8 +218,8 @@ public final class GraphToTypedInstanceMapper {
String edgeLabel = GraphHelper.EDGE_LABEL_PREFIX + propertyName;
ArrayList values = new ArrayList();
- for (int index = 0; index < list.size(); index++) {
- values.add(mapVertexToCollectionEntry(instanceVertex, attributeInfo, elementType, list.get(index),
+ for (Object aList : list) {
+ values.add(mapVertexToCollectionEntry(instanceVertex, attributeInfo, elementType, aList,
edgeLabel));
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java b/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
index a0cbb62..952f73a 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/AttributeStores.java
@@ -100,7 +100,7 @@ public class AttributeStores {
AbstractAttributeStore(AttributeInfo attrInfo) {
this.attrInfo = attrInfo;
this.nullList = new BooleanArrayList();
- hiddenVals = new HashMap<Integer, Map<String, Object>>();
+ hiddenVals = new HashMap<>();
}
final void setNull(int pos, boolean flag) {
@@ -115,7 +115,7 @@ public class AttributeStores {
List<String> attrNames = type.getNames(attrInfo);
Map<String, Object> m = hiddenVals.get(pos);
if (m == null) {
- m = new HashMap<String, Object>();
+ m = new HashMap<>();
hiddenVals.put(pos, m);
}
for (int i = 2; i < attrNames.size(); i++) {
@@ -455,7 +455,7 @@ public class AttributeStores {
@Override
public void ensureCapacity(int pos) throws RepositoryException {
while (list.size() < pos + 1) {
- list.add((T) null);
+ list.add(null);
}
nullList.size(pos + 1);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java b/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
index 7fcfffe..4196768 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/ClassStore.java
@@ -26,6 +26,7 @@ import org.apache.atlas.typesystem.persistence.ReferenceableInstance;
import org.apache.atlas.typesystem.types.ClassType;
import java.util.ArrayList;
+import java.util.Objects;
public class ClassStore extends HierarchicalTypeStore {
@@ -35,7 +36,7 @@ public class ClassStore extends HierarchicalTypeStore {
public ClassStore(MemRepository repository, ClassType hierarchicalType) throws RepositoryException {
super(repository, hierarchicalType);
classType = hierarchicalType;
- traitNamesStore = new ArrayList<ImmutableList<String>>();
+ traitNamesStore = new ArrayList<>();
}
void store(ReferenceableInstance i) throws RepositoryException {
@@ -61,7 +62,7 @@ public class ClassStore extends HierarchicalTypeStore {
}
String typeName = typeNameList.get(pos);
- if (typeName != hierarchicalType.getName()) {
+ if (!Objects.equals(typeName, hierarchicalType.getName())) {
throw new RepositoryException(
String.format("Invalid Id (incorrect typeName, type is %s) : %s", typeName, id));
}
@@ -75,7 +76,7 @@ public class ClassStore extends HierarchicalTypeStore {
ReferenceableInstance createInstance(MemRepository repo, Id id) throws RepositoryException {
Integer pos = idPosMap.get(id);
String typeName = typeNameList.get(pos);
- if (typeName != hierarchicalType.getName()) {
+ if (!Objects.equals(typeName, hierarchicalType.getName())) {
return repo.getClassStore(typeName).createInstance(repo, id);
}
@@ -83,8 +84,7 @@ public class ClassStore extends HierarchicalTypeStore {
String[] tNs = traitNames.toArray(new String[]{});
try {
- ReferenceableInstance r = (ReferenceableInstance) classType.createInstance(id, tNs);
- return r;
+ return (ReferenceableInstance) classType.createInstance(id, tNs);
} catch (AtlasException me) {
throw new RepositoryException(me);
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java b/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
index d7acf97..33d78d3 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/HierarchicalTypeStore.java
@@ -64,7 +64,7 @@ public abstract class HierarchicalTypeStore {
this.hierarchicalType = (IConstructableType) hierarchicalType;
this.repository = repository;
ImmutableMap.Builder<AttributeInfo, IAttributeStore> b =
- new ImmutableBiMap.Builder<AttributeInfo, IAttributeStore>();
+ new ImmutableBiMap.Builder<>();
typeNameList = Lists.newArrayList((String) null);
ImmutableList<AttributeInfo> l = hierarchicalType.immediateAttrs;
for (AttributeInfo i : l) {
@@ -72,7 +72,7 @@ public abstract class HierarchicalTypeStore {
}
attrStores = b.build();
- ImmutableList.Builder<HierarchicalTypeStore> b1 = new ImmutableList.Builder<HierarchicalTypeStore>();
+ ImmutableList.Builder<HierarchicalTypeStore> b1 = new ImmutableList.Builder<>();
Set<String> allSuperTypeNames = hierarchicalType.getAllSuperTypeNames();
for (String s : allSuperTypeNames) {
b1.add(repository.getStore(s));
@@ -80,8 +80,8 @@ public abstract class HierarchicalTypeStore {
superTypeStores = b1.build();
nextPos = 0;
- idPosMap = new HashMap<Id, Integer>();
- freePositions = new ArrayList<Integer>();
+ idPosMap = new HashMap<>();
+ freePositions = new ArrayList<>();
lock = new ReentrantReadWriteLock();
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java b/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
index 75b4979..51f50ac 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/MemRepository.java
@@ -117,10 +117,10 @@ public class MemRepository implements IRepository {
* - create a ITypedReferenceableInstance.
* replace any old References ( ids or object references) with new Ids.
*/
- List<ITypedReferenceableInstance> newInstances = new ArrayList<ITypedReferenceableInstance>();
+ List<ITypedReferenceableInstance> newInstances = new ArrayList<>();
ITypedReferenceableInstance retInstance = null;
- Set<ClassType> classTypes = new TreeSet<ClassType>();
- Set<TraitType> traitTypes = new TreeSet<TraitType>();
+ Set<ClassType> classTypes = new TreeSet<>();
+ Set<TraitType> traitTypes = new TreeSet<>();
for (IReferenceableInstance transientInstance : discoverInstances.idToInstanceMap.values()) {
try {
ClassType cT = typeSystem.getDataType(ClassType.class, transientInstance.getTypeName());
@@ -274,8 +274,8 @@ public class MemRepository implements IRepository {
}
public void defineTypes(List<HierarchicalType> types) throws RepositoryException {
- List<TraitType> tTypes = new ArrayList<TraitType>();
- List<ClassType> cTypes = new ArrayList<ClassType>();
+ List<TraitType> tTypes = new ArrayList<>();
+ List<ClassType> cTypes = new ArrayList<>();
for (HierarchicalType h : types) {
if (h.getTypeCategory() == DataTypes.TypeCategory.TRAIT) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java b/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
index 9351be9..6741eb8 100755
--- a/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
+++ b/repository/src/main/java/org/apache/atlas/repository/memory/ReplaceIdWithInstance.java
@@ -50,23 +50,23 @@ public class ReplaceIdWithInstance implements ObjectGraphWalker.NodeProcessor {
@Override
public void processNode(ObjectGraphWalker.Node nd) throws AtlasException {
- if (nd.attributeName == null) {
- // do nothing
- } else if (!nd.aInfo.isComposite || nd.value == null) {
- // do nothing
- } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
- if (nd.value != null && nd.value instanceof Id) {
- Id id = (Id) nd.value;
- ITypedReferenceableInstance r = getInstance(id);
- nd.instance.set(nd.attributeName, r);
+ if (nd.attributeName != null) {
+ if (nd.aInfo.isComposite && nd.value != null) {
+ if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
+ if (nd.value instanceof Id) {
+ Id id = (Id) nd.value;
+ ITypedReferenceableInstance r = getInstance(id);
+ nd.instance.set(nd.attributeName, r);
+ }
+ } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
+ DataTypes.ArrayType aT = (DataTypes.ArrayType) nd.aInfo.dataType();
+ nd.instance.set(nd.attributeName,
+ convertToInstances((ImmutableCollection) nd.value, nd.aInfo.multiplicity, aT));
+ } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
+ DataTypes.MapType mT = (DataTypes.MapType) nd.aInfo.dataType();
+ nd.instance.set(nd.attributeName, convertToInstances((ImmutableMap) nd.value, nd.aInfo.multiplicity, mT));
+ }
}
- } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
- DataTypes.ArrayType aT = (DataTypes.ArrayType) nd.aInfo.dataType();
- nd.instance.set(nd.attributeName,
- convertToInstances((ImmutableCollection) nd.value, nd.aInfo.multiplicity, aT));
- } else if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
- DataTypes.MapType mT = (DataTypes.MapType) nd.aInfo.dataType();
- nd.instance.set(nd.attributeName, convertToInstances((ImmutableMap) nd.value, nd.aInfo.multiplicity, mT));
}
}
@@ -78,9 +78,7 @@ public class ReplaceIdWithInstance implements ObjectGraphWalker.NodeProcessor {
}
ImmutableCollection.Builder b = m.isUnique ? ImmutableSet.builder() : ImmutableList.builder();
- Iterator it = val.iterator();
- while (it.hasNext()) {
- Object elem = it.next();
+ for (Object elem : val) {
if (elem instanceof Id) {
Id id = (Id) elem;
elem = getInstance(id);
@@ -100,9 +98,7 @@ public class ReplaceIdWithInstance implements ObjectGraphWalker.NodeProcessor {
return val;
}
ImmutableMap.Builder b = ImmutableMap.builder();
- Iterator<Map.Entry> it = val.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry elem = it.next();
+ for (Map.Entry elem : (Iterable<Map.Entry>) val.entrySet()) {
Object oldKey = elem.getKey();
Object oldValue = elem.getValue();
Object newKey = oldKey;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
index 1ad04b3..48f8bce 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
@@ -19,7 +19,6 @@ package org.apache.atlas.repository.store.graph;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter;
-import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
index 19c8701..97542d5 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
@@ -27,7 +27,6 @@ import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.store.graph.AtlasEnumDefStore;
import org.apache.atlas.repository.util.FilterUtil;
-import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import org.apache.commons.collections.CollectionUtils;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
index bef6d18..18b3b85 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
@@ -69,7 +69,7 @@ public class AtlasGraphUtilsV1 {
}
public static String getIdFromVertex(AtlasVertex vertex) {
- return vertex.<String>getProperty(Constants.GUID_PROPERTY_KEY, String.class);
+ return vertex.getProperty(Constants.GUID_PROPERTY_KEY, String.class);
}
public static String getTypeName(AtlasVertex instanceVertex) {
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
index ab3b3d9..287ef09 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
@@ -24,10 +24,6 @@ import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.listener.TypeDefChangeListener;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
-import org.apache.atlas.model.typedef.AtlasClassificationDef;
-import org.apache.atlas.model.typedef.AtlasEntityDef;
-import org.apache.atlas.model.typedef.AtlasEnumDef;
-import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graph.AtlasGraphProvider;
import org.apache.atlas.repository.graphdb.AtlasEdge;
@@ -119,9 +115,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(Constants.TYPENAME_PROPERTY_KEY, typeName)
.vertices().iterator();
- AtlasVertex ret = (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
-
- return ret;
+ return (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
}
AtlasVertex findTypeVertexByNameAndCategory(String typeName, TypeCategory category) {
@@ -130,9 +124,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(TYPE_CATEGORY_PROPERTY_KEY, category)
.vertices().iterator();
- AtlasVertex ret = (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
-
- return ret;
+ return (results != null && results.hasNext()) ? (AtlasVertex) results.next() : null;
}
AtlasVertex findTypeVertexByGuid(String typeGuid) {
@@ -140,9 +132,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(Constants.GUID_PROPERTY_KEY, typeGuid)
.vertices().iterator();
- AtlasVertex ret = (vertices != null && vertices.hasNext()) ? vertices.next() : null;
-
- return ret;
+ return (vertices != null && vertices.hasNext()) ? vertices.next() : null;
}
AtlasVertex findTypeVertexByGuidAndCategory(String typeGuid, TypeCategory category) {
@@ -151,17 +141,14 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
.has(TYPE_CATEGORY_PROPERTY_KEY, category)
.vertices().iterator();
- AtlasVertex ret = (vertices != null && vertices.hasNext()) ? vertices.next() : null;
-
- return ret;
+ return (vertices != null && vertices.hasNext()) ? vertices.next() : null;
}
Iterator<AtlasVertex> findTypeVerticesByCategory(TypeCategory category) {
- Iterator<AtlasVertex> ret = atlasGraph.query().has(VERTEX_TYPE_PROPERTY_KEY, VERTEX_TYPE)
+
+ return (Iterator<AtlasVertex>) atlasGraph.query().has(VERTEX_TYPE_PROPERTY_KEY, VERTEX_TYPE)
.has(TYPE_CATEGORY_PROPERTY_KEY, category)
.vertices().iterator();
-
- return ret;
}
AtlasVertex createTypeVertex(AtlasBaseTypeDef typeDef) {
@@ -175,7 +162,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
}
if (typeDef.getVersion() == null) {
- typeDef.setVersion(Long.valueOf(1l));
+ typeDef.setVersion(1L);
}
if (StringUtils.isBlank(typeDef.getGuid())) {
@@ -286,9 +273,7 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
boolean isTypeVertex(AtlasVertex vertex) {
String vertexType = vertex.getProperty(Constants.VERTEX_TYPE_PROPERTY_KEY, String.class);
- boolean ret = VERTEX_TYPE.equals(vertexType);
-
- return ret;
+ return VERTEX_TYPE.equals(vertexType);
}
boolean isTypeVertex(AtlasVertex vertex, TypeCategory category) {
@@ -340,9 +325,8 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
}
AtlasEdge addEdge(AtlasVertex outVertex, AtlasVertex inVertex, String edgeLabel) {
- AtlasEdge ret = atlasGraph.addEdge(outVertex, inVertex, edgeLabel);
- return ret;
+ return atlasGraph.addEdge(outVertex, inVertex, edgeLabel);
}
void createSuperTypeEdges(AtlasVertex vertex, Set<String> superTypes, TypeCategory typeCategory)
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
index ee63061..c1c2a94 100755
--- a/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
@@ -284,9 +284,7 @@ public class GraphBackedTypeStore implements ITypeStore {
private ImmutableSet<String> getSuperTypes(AtlasVertex vertex) {
Set<String> superTypes = new HashSet<>();
- Iterator<AtlasEdge> edges = vertex.getEdges(AtlasEdgeDirection.OUT, SUPERTYPE_EDGE_LABEL).iterator();
- while (edges.hasNext()) {
- AtlasEdge edge = edges.next();
+ for (AtlasEdge edge : (Iterable<AtlasEdge>) vertex.getEdges(AtlasEdgeDirection.OUT, SUPERTYPE_EDGE_LABEL)) {
superTypes.add(edge.getInVertex().getProperty(Constants.TYPENAME_PROPERTY_KEY, String.class));
}
return ImmutableSet.copyOf(superTypes);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
index d2793d2..c2f8b3f 100755
--- a/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
+++ b/repository/src/main/java/org/apache/atlas/services/DefaultMetadataService.java
@@ -55,15 +55,11 @@ import org.apache.atlas.typesystem.persistence.ReferenceableInstance;
import org.apache.atlas.typesystem.types.AttributeInfo;
import org.apache.atlas.typesystem.types.ClassType;
import org.apache.atlas.typesystem.types.DataTypes;
-import org.apache.atlas.typesystem.types.EnumTypeDefinition;
-import org.apache.atlas.typesystem.types.HierarchicalTypeDefinition;
import org.apache.atlas.typesystem.types.IDataType;
import org.apache.atlas.typesystem.types.Multiplicity;
-import org.apache.atlas.typesystem.types.StructTypeDefinition;
import org.apache.atlas.typesystem.types.TraitType;
import org.apache.atlas.typesystem.types.TypeSystem;
import org.apache.atlas.typesystem.types.cache.TypeCache;
-import org.apache.atlas.typesystem.types.utils.TypesUtil;
import org.apache.atlas.utils.ParamChecker;
import org.apache.commons.configuration.Configuration;
import org.codehaus.jettison.json.JSONException;
@@ -595,8 +591,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang
guid = ParamChecker.notEmpty(guid, "entity id");
final ITypedReferenceableInstance instance = repository.getEntityDefinition(guid);
- IStruct struct = instance.getTrait(traitName);
- return struct;
+ return instance.getTrait(traitName);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java b/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
index a270b97..4b6f88f 100644
--- a/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
+++ b/repository/src/main/java/org/apache/atlas/util/AtlasRepositoryConfiguration.java
@@ -24,7 +24,6 @@ import org.apache.atlas.repository.audit.HBaseBasedAuditRepository;
import org.apache.atlas.repository.graph.DeleteHandler;
import org.apache.atlas.repository.graph.SoftDeleteHandler;
import org.apache.atlas.repository.graphdb.GraphDatabase;
-import org.apache.atlas.repository.typestore.GraphBackedTypeStore;
import org.apache.atlas.typesystem.types.cache.DefaultTypeCache;
import org.apache.atlas.typesystem.types.cache.TypeCache;
import org.apache.commons.configuration.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1620284e/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java b/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
index 0ed370c..733aefd 100644
--- a/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
+++ b/repository/src/main/java/org/apache/atlas/util/TypeDefSorter.java
@@ -17,12 +17,9 @@
*/
package org.apache.atlas.util;
-import com.google.common.collect.ImmutableSet;
-
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasStructDef;
-import org.apache.atlas.typesystem.types.HierarchicalType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;