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:06 UTC
[3/4] incubator-atlas git commit: ATLAS-1304: Redundant code removal
and code simplification
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