Repository: tinkerpop Updated Branches: refs/heads/master 4a8897951 -> add211a69
removed deprecated methods in TraversalSideEffects and removed finalization.LazyBarrierStrategy. Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ef2ca2a5 Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ef2ca2a5 Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ef2ca2a5 Branch: refs/heads/master Commit: ef2ca2a5659b20c1ff474c03f7252b05beeab0a8 Parents: 5554fea Author: Marko A. Rodriguez <okramma...@gmail.com> Authored: Mon Jul 10 16:40:05 2017 -0600 Committer: Marko A. Rodriguez <okramma...@gmail.com> Committed: Mon Jul 10 16:40:05 2017 -0600 ---------------------------------------------------------------------- CHANGELOG.asciidoc | 2 + docs/src/upgrade/release-3.3.x.asciidoc | 5 +- .../traversal/MemoryTraversalSideEffects.java | 12 -- .../AbstractRemoteTraversalSideEffects.java | 10 -- .../process/traversal/TraversalSideEffects.java | 72 ------------ .../traversal/step/sideEffect/SubgraphStep.java | 16 ++- .../finalization/LazyBarrierStrategy.java | 111 ------------------- .../util/DefaultTraversalSideEffects.java | 46 -------- .../util/EmptyTraversalSideEffects.java | 11 -- 9 files changed, 19 insertions(+), 266 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/CHANGELOG.asciidoc ---------------------------------------------------------------------- diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 8c08d5d..37afd9c 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -26,6 +26,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima TinkerPop 3.3.0 (Release Date: NOT OFFICIALLY RELEASED YET) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Removed previously deprecated `TraversalSideEffects` methods. +* Removed previously deprecated `finalization.LazyBarrierStrategy` (moved to `optimization.LazyBarrierStrategy`). * Established the Gryo 3.0 format. * `GryoVersion` now includes a default `ClassResolver` to supply to the `GryoMapper`. * `GryoClassResolver` renamed to `GryoClassResolverV1d0` which has an abstract class that for providers to extend in `AbstractGryoClassResolver`. http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/docs/src/upgrade/release-3.3.x.asciidoc ---------------------------------------------------------------------- diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index e02bc6e..f039793 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -216,6 +216,8 @@ The following deprecated classes, methods or fields have been removed in this ve ** `org.apache.tinkerpop.gremlin.process.traversal.util.OrP(P...)` ** `org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptFunction` ** `org.apache.tinkerpop.gremlin.process.traversal.util.TraversalScriptHelper` +** `org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.LazyBarrierStrategy` +** `org.apache.tinkerpop.gremlin.process.traversal.TraversalSideEffects` (various methods) ** `org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexPropertyFeatures#supportsAddProperty()` ** `org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexPropertyFeatures#FEATURE_ADD_PROPERTY` ** `org.apache.tinkerpop.gremlin.structure.Graph.OptIn#SUITE_GROOVY_PROCESS_STANDARD` @@ -309,7 +311,8 @@ link:https://issues.apache.org/jira/browse/TINKERPOP-1612[TINKERPOP-1612], link:https://issues.apache.org/jira/browse/TINKERPOP-1622[TINKERPOP-1622], link:https://issues.apache.org/jira/browse/TINKERPOP-1651[TINKERPOP-1651], link:https://issues.apache.org/jira/browse/TINKERPOP-1694[TINKERPOP-1694], -link:https://issues.apache.org/jira/browse/TINKERPOP-1700[TINKERPOP-1700] +link:https://issues.apache.org/jira/browse/TINKERPOP-1700[TINKERPOP-1700], +link:https://issues.apache.org/jira/browse/TINKERPOP-1719[TINKERPOP-1719] Gremlin-server.sh and Init Scripts ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/MemoryTraversalSideEffects.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/MemoryTraversalSideEffects.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/MemoryTraversalSideEffects.java index bf9f8c0..cb87b83 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/MemoryTraversalSideEffects.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/MemoryTraversalSideEffects.java @@ -105,18 +105,6 @@ public final class MemoryTraversalSideEffects implements TraversalSideEffects { } @Override - @Deprecated - public void registerSupplier(final String key, final Supplier supplier) { - this.sideEffects.registerSupplier(key, supplier); - } - - @Override - @Deprecated - public <V> Optional<Supplier<V>> getRegisteredSupplier(final String key) { - return this.sideEffects.getRegisteredSupplier(key); - } - - @Override public <S> void setSack(final Supplier<S> initialValue, final UnaryOperator<S> splitOperator, final BinaryOperator<S> mergeOperator) { this.sideEffects.setSack(initialValue, splitOperator, mergeOperator); } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/AbstractRemoteTraversalSideEffects.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/AbstractRemoteTraversalSideEffects.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/AbstractRemoteTraversalSideEffects.java index aa29da2..3c00a5d 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/AbstractRemoteTraversalSideEffects.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/AbstractRemoteTraversalSideEffects.java @@ -96,14 +96,4 @@ public abstract class AbstractRemoteTraversalSideEffects implements RemoteTraver public void mergeInto(final TraversalSideEffects sideEffects) { throw new UnsupportedOperationException("Remote traversals do not support this method"); } - - @Override - public void registerSupplier(final String key, final Supplier supplier) { - throw new UnsupportedOperationException("Remote traversals do not support this method"); - } - - @Override - public <V> Optional<Supplier<V>> getRegisteredSupplier(final String key) { - throw new UnsupportedOperationException("Remote traversals do not support this method"); - } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java index 108eb99..eaef865 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSideEffects.java @@ -230,76 +230,4 @@ public interface TraversalSideEffects extends Cloneable, Serializable, AutoClose return new IllegalArgumentException("The side-effect key does not exist in the side-effects: " + key); } } - - /////////////////// DEPRECATED METHOD SINCE 3.2.0 - - /** - * Register a {@link java.util.function.Supplier} with the provided key. - * When sideEffects get() are called, if no object exists and there exists a registered supplier for the key, the object is generated. - * Registered suppliers are used for the lazy generation of sideEffect data. - * - * @param key the key to register the supplier with - * @param supplier the supplier that will generate an object when get() is called if it hasn't already been created - * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#register(String, Supplier, BinaryOperator)}. - */ - @Deprecated - public void registerSupplier(final String key, final Supplier supplier); - - - /** - * A helper method to register a {@link java.util.function.Supplier} if it has not already been registered. - * - * @param key the key of the supplier to register - * @param supplier the supplier to register if the key has not already been registered - * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#registerIfAbsent(String, Supplier, BinaryOperator)}. - */ - @Deprecated - public default void registerSupplierIfAbsent(final String key, final Supplier supplier) { - if (!this.getRegisteredSupplier(key).isPresent()) - this.registerSupplier(key, supplier); - } - - /** - * Get the registered {@link java.util.function.Supplier} associated with the specified key. - * - * @param key the key associated with the supplier - * @param <V> The object type of the supplier - * @return A non-empty optional if the supplier exists - * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#getSupplier(String)}. - */ - @Deprecated - public <V> Optional<Supplier<V>> getRegisteredSupplier(final String key); - - - /** - * If the sideEffect contains an object associated with the key, return it. - * Else if a "with" supplier exists for the key, generate the object, store it in the sideEffects and return the object. - * Else use the provided supplier to generate the object, store it in the sideEffects and return the object. - * Note that if the orCreate supplier is used, it is NOT registered as a {@link java.util.function.Supplier}. - * - * @param key the key of the object to get - * @param orCreate if the object doesn't exist as an object or suppliable object, then generate it with the specified supplier - * @param <V> the return type of the object - * @return the object that is either retrieved, generated, or supplier via orCreate - * @deprecated As of release 3.2.0, replaced by {@link TraversalSideEffects#register(String, Supplier, BinaryOperator)} to register side-effects. - */ - @Deprecated - public default <V> V getOrCreate(final String key, final Supplier<V> orCreate) { - final V value = this.exists(key) ? this.get(key) : null; - if (null != value) - return value; - final Optional<Supplier<V>> with = this.getRegisteredSupplier(key); - if (with.isPresent()) { - final V v = with.get().get(); - this.set(key, v); - return v; - } else { - final V v = orCreate.get(); - this.set(key, v); - return v; - } - } - - - /////////////////// } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphStep.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphStep.java index aa88b5d..ca5100b 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphStep.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphStep.java @@ -18,15 +18,25 @@ */ package org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect; +import org.apache.tinkerpop.gremlin.process.traversal.Operator; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.Traverser; import org.apache.tinkerpop.gremlin.process.traversal.step.SideEffectCapable; import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement; -import org.apache.tinkerpop.gremlin.structure.*; +import org.apache.tinkerpop.gremlin.structure.Direction; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; import org.apache.tinkerpop.gremlin.structure.util.StringFactory; -import java.util.*; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; /** * A side-effect step that produces an edge induced subgraph. @@ -53,7 +63,7 @@ public final class SubgraphStep extends SideEffectStep<Edge> implements SideEffe public SubgraphStep(final Traversal.Admin traversal, final String sideEffectKey) { super(traversal); this.sideEffectKey = sideEffectKey; - this.getTraversal().asAdmin().getSideEffects().registerSupplierIfAbsent(this.sideEffectKey, () -> GraphFactory.open(DEFAULT_CONFIGURATION)); + this.getTraversal().asAdmin().getSideEffects().registerIfAbsent(this.sideEffectKey, () -> GraphFactory.open(DEFAULT_CONFIGURATION), Operator.assign); } @Override http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java deleted file mode 100644 index 4a89b1b..0000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java +++ /dev/null @@ -1,111 +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.tinkerpop.gremlin.process.traversal.strategy.finalization; - -import org.apache.tinkerpop.gremlin.process.traversal.Step; -import org.apache.tinkerpop.gremlin.process.traversal.Traversal; -import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; -import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier; -import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; -import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy; -import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement; -import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author Marko A. Rodriguez (http://markorodriguez.com) - * @deprecated As of release 3.2.3. Please use {@link org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy}. - */ -@Deprecated -public final class LazyBarrierStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy { - - private static final LazyBarrierStrategy INSTANCE = new LazyBarrierStrategy(); - private static final Set<Class<? extends FinalizationStrategy>> PRIORS = new HashSet<>(); - private static final Set<Class<? extends FinalizationStrategy>> POSTS = new HashSet<>(); - - private static final int REQUIRED_DEPTH = 2; - private static final int BIG_START_SIZE = 5; - protected static final int MAX_BARRIER_SIZE = 10000; - - static { - POSTS.add(ProfileStrategy.class); - } - - - private LazyBarrierStrategy() { - } - - @Override - public void apply(final Traversal.Admin<?, ?> traversal) { - if (TraversalHelper.onGraphComputer(traversal)) - return; - - if (traversal.getTraverserRequirements().contains(TraverserRequirement.PATH)) - return; - - int depth = 0; - for (final Step<?, ?> step : traversal.getSteps()) { - if (step instanceof VertexStep) - depth++; - } - - if (depth > REQUIRED_DEPTH) { - boolean bigStart = false; - char foundVertexStep = 'x'; - for (int i = 0; i < traversal.getSteps().size() - 1; i++) { - final Step<?, ?> step = traversal.getSteps().get(i); - if (i == 0) - bigStart = step instanceof GraphStep && (((GraphStep) step).getIds().length >= BIG_START_SIZE || (((GraphStep) step).getIds().length == 0 && step instanceof HasContainerHolder && ((HasContainerHolder) step).getHasContainers().isEmpty())); - else if ('v' == foundVertexStep || bigStart) { - if (!(step instanceof FilterStep) && !(step instanceof Barrier) && !(step instanceof VertexStep && ((VertexStep) step).returnsEdge())) { - TraversalHelper.insertAfterStep(new NoOpBarrierStep<>(traversal, MAX_BARRIER_SIZE), step, traversal); - } - } - - if ('x' == foundVertexStep && step instanceof VertexStep) - foundVertexStep = ((VertexStep) step).returnsVertex() ? 'v' : 'e'; - else if ('e' == foundVertexStep && step instanceof EdgeVertexStep) - foundVertexStep = 'v'; - } - } - } - - - @Override - public Set<Class<? extends FinalizationStrategy>> applyPrior() { - return PRIORS; - } - - @Override - public Set<Class<? extends FinalizationStrategy>> applyPost() { - return POSTS; - } - - public static LazyBarrierStrategy instance() { - return INSTANCE; - } -} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalSideEffects.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalSideEffects.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalSideEffects.java index 8a8c5e2..b512cf3 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalSideEffects.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversalSideEffects.java @@ -233,50 +233,4 @@ public class DefaultTraversalSideEffects implements TraversalSideEffects { throw new IllegalStateException(e.getMessage(), e); } } - - ////////// - - /** - * {@inheritDoc} - */ - @Deprecated - @Override - public void registerSupplier(final String key, final Supplier supplier) { - this.register(key, supplier, null); - - } - - /** - * {@inheritDoc} - */ - @Deprecated - @Override - public void registerSupplierIfAbsent(final String key, final Supplier supplier) { - this.registerIfAbsent(key, supplier, null); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public <V> Optional<Supplier<V>> getRegisteredSupplier(final String key) { - return Optional.ofNullable(this.supplierMap.get(key)); - } - - /** - * {@inheritDoc} - */ - @Override - @Deprecated - public <V> V getOrCreate(final String key, final Supplier<V> orCreate) { - final V value = this.exists(key) ? this.get(key) : null; - if (null != value) - return value; - else { - final V newValue = orCreate.get(); - this.objectMap.put(key, newValue); - return newValue; - } - } } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ef2ca2a5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/EmptyTraversalSideEffects.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/EmptyTraversalSideEffects.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/EmptyTraversalSideEffects.java index a4c5adf..f1b4aa0 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/EmptyTraversalSideEffects.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/EmptyTraversalSideEffects.java @@ -84,17 +84,6 @@ public final class EmptyTraversalSideEffects implements TraversalSideEffects { throw TraversalSideEffects.Exceptions.sideEffectKeyDoesNotExist(key); } - - @Override - public void registerSupplier(final String key, final Supplier supplier) { - - } - - @Override - public <V> Optional<Supplier<V>> getRegisteredSupplier(final String key) { - return Optional.empty(); - } - @Override public <S> void setSack(final Supplier<S> initialValue, final UnaryOperator<S> splitOperator, final BinaryOperator<S> mergeOperator) {