diff --git a/client/src/main/java/com/orientechnologies/orient/client/remote/message/OCommandResponse.java b/client/src/main/java/com/orientechnologies/orient/client/remote/message/OCommandResponse.java index 4348461a709..8d884667db8 100644 --- a/client/src/main/java/com/orientechnologies/orient/client/remote/message/OCommandResponse.java +++ b/client/src/main/java/com/orientechnologies/orient/client/remote/message/OCommandResponse.java @@ -35,7 +35,6 @@ import com.orientechnologies.orient.core.serialization.serializer.record.ORecordSerializer; import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerNetworkV37Client; import com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract; -import com.orientechnologies.orient.core.sql.query.OBasicLegacyResultSet; import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol; import com.orientechnologies.orient.enterprise.channel.binary.OChannelDataInput; import com.orientechnologies.orient.enterprise.channel.binary.OChannelDataOutput; @@ -210,10 +209,7 @@ protected Object readSynchResult( final int tot = network.readInt(); final Collection coll; - coll = - type == 's' - ? new HashSet(tot) - : new OBasicLegacyResultSet(tot); + coll = new HashSet(tot); for (int i = 0; i < tot; ++i) { final OIdentifiable resultItem = OMessageHelper.readIdentifiable(network, serializer); if (resultItem instanceof ORecord) @@ -224,7 +220,7 @@ protected Object readSynchResult( result = coll; break; case 'i': - coll = new OBasicLegacyResultSet(); + coll = new HashSet(); byte status; while ((status = network.readByte()) > 0) { final OIdentifiable record = OMessageHelper.readIdentifiable(network, serializer); diff --git a/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java b/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java index 30dd4760ac1..0d21c9b856c 100755 --- a/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java +++ b/core/src/main/java/com/orientechnologies/common/collection/OMultiValue.java @@ -734,21 +734,6 @@ else if (iObject.getClass().isArray()) { return false; } - public static int indexOf(final Object iObject, final Object iItem) { - if (iObject == null) return -1; - - if (iObject instanceof List) return ((List) iObject).indexOf(iItem); - else if (iObject.getClass().isArray()) { - final int size = Array.getLength(iObject); - for (int i = 0; i < size; ++i) { - final Object item = Array.get(iObject, i); - if (item != null && item.equals(iItem)) return i; - } - } - - return -1; - } - public static Object toSet(final Object o) { if (o instanceof Set) return o; else if (o instanceof Collection) return new HashSet((Collection) o); diff --git a/core/src/main/java/com/orientechnologies/common/collection/OSortedMultiIterator.java b/core/src/main/java/com/orientechnologies/common/collection/OSortedMultiIterator.java deleted file mode 100644 index a5e3866d0f3..00000000000 --- a/core/src/main/java/com/orientechnologies/common/collection/OSortedMultiIterator.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * - * * Copyright 2010-2016 OrientDB LTD (http://orientdb.com) - * * - * * Licensed 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. - * * - * * For more information: http://orientdb.com - * - */ -package com.orientechnologies.common.collection; - -import com.orientechnologies.orient.core.db.record.OIdentifiable; -import com.orientechnologies.orient.core.record.impl.ODocument; -import com.orientechnologies.orient.core.sql.parser.OOrderBy; -import com.orientechnologies.orient.core.sql.parser.OOrderByItem; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class OSortedMultiIterator implements Iterator { - - private static final int STATUS_INIT = 0; - private static final int STATUS_RUNNING = 1; - - private final OOrderBy orderBy; - - private List> sourceIterators = new ArrayList>(); - private List heads = new ArrayList(); - - private int status = STATUS_INIT; - - public OSortedMultiIterator(OOrderBy orderBy) { - this.orderBy = orderBy; - } - - public void add(Iterator iterator) { - if (status == STATUS_INIT) { - sourceIterators.add(iterator); - if (iterator.hasNext()) { - heads.add(iterator.next()); - } else { - heads.add(null); - } - } else { - throw new IllegalStateException( - "You are trying to add a sub-iterator on a running OSortedMultiIterator"); - } - } - - @Override - public boolean hasNext() { - if (status == STATUS_INIT) { - status = STATUS_RUNNING; - } - for (T o : heads) { - if (o != null) { - return true; - } - } - return false; - } - - @Override - public T next() { - if (status == STATUS_INIT) { - status = STATUS_RUNNING; - } - int nextItemPosition = findNextPosition(); - T result = heads.get(nextItemPosition); - if (sourceIterators.get(nextItemPosition).hasNext()) { - heads.set(nextItemPosition, sourceIterators.get(nextItemPosition).next()); - } else { - heads.set(nextItemPosition, null); - } - return result; - } - - private int findNextPosition() { - int lastPosition = 0; - while (heads.size() < lastPosition && heads.get(lastPosition) == null) { - lastPosition++; - } - T lastItem = heads.get(lastPosition); - for (int i = lastPosition + 1; i < heads.size(); i++) { - T item = heads.get(i); - if (item == null) { - continue; - } - if (comesFrist(item, lastItem)) { - lastItem = item; - lastPosition = i; - } - } - return lastPosition; - } - - protected boolean comesFrist(T left, T right) { - if (orderBy == null || orderBy.getItems() == null || orderBy.getItems().size() == 0) { - return true; - } - if (right == null) { - return true; - } - if (left == null) { - return false; - } - - ODocument leftDoc = - (left instanceof ODocument) ? (ODocument) left : (ODocument) left.getRecord(); - ODocument rightDoc = - (right instanceof ODocument) ? (ODocument) right : (ODocument) right.getRecord(); - - for (OOrderByItem orderItem : orderBy.getItems()) { - Object leftVal = leftDoc.field(orderItem.getRecordAttr()); - Object rightVal = rightDoc.field(orderItem.getRecordAttr()); - if (rightVal == null) { - return true; - } - if (leftVal == null) { - return false; - } - if (leftVal instanceof Comparable) { - int compare = ((Comparable) leftVal).compareTo(rightVal); - if (compare == 0) { - continue; - } - boolean greater = compare > 0; - if (OOrderByItem.DESC.equals(orderItem.getType())) { - return greater; - } else { - return !greater; - } - } - } - - return false; - } - - public void remove() { - throw new UnsupportedOperationException("remove"); - } -} diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java index d06d5c5d95e..1e7850a4ed1 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OProjection.java @@ -8,8 +8,12 @@ import com.orientechnologies.orient.core.sql.OCommandSQLParsingException; import com.orientechnologies.orient.core.sql.executor.OResult; import com.orientechnologies.orient.core.sql.executor.OResultInternal; -import com.orientechnologies.orient.core.sql.query.OLegacyResultSet; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; public class OProjection extends SimpleNode { @@ -188,13 +192,6 @@ private void initExcludes(OCommandContext iContext) { } } - public OLegacyResultSet calculateExpand(OCommandContext iContext, OResult iRecord) { - if (!isExpand()) { - throw new IllegalStateException("This is not an expand projection:" + toString()); - } - throw new UnsupportedOperationException("Implement expand in projection"); - } - public boolean isExpand() { return items != null && items.size() == 1 && items.get(0).isExpand(); } diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OBasicLegacyResultSet.java b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OBasicLegacyResultSet.java deleted file mode 100755 index aea567f98d2..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OBasicLegacyResultSet.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * - * * Copyright 2010-2016 OrientDB LTD (http://orientdb.com) - * * - * * Licensed 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. - * * - * * For more information: http://orientdb.com - * - */ -package com.orientechnologies.orient.core.sql.query; - -import com.orientechnologies.orient.core.record.ORecord; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -/** - * ResultSet class that implements List interface for retro compatibility. - * - * @author Luca Garulli (l.garulli--(at)--orientdb.com) - * @param - */ -public class OBasicLegacyResultSet implements OLegacyResultSet { - protected List underlying; - protected transient int limit = -1; - // Reference to temporary record for avoid garbace collection - private List temporaryRecordCache; - - public OBasicLegacyResultSet() { - underlying = Collections.synchronizedList(new ArrayList()); - } - - public OBasicLegacyResultSet(final int iCapacity) { - underlying = Collections.synchronizedList(new ArrayList(iCapacity)); - } - - public OBasicLegacyResultSet setCompleted() { - return this; - } - - public T set(int index, T element) { - return underlying.set(index, element); - } - - @Override - public int currentSize() { - return underlying.size(); - } - - @Override - public int size() { - return underlying.size(); - } - - @Override - public boolean isEmpty() { - boolean empty = underlying.isEmpty(); - if (empty) { - empty = underlying.isEmpty(); - } - return empty; - } - - @Override - public boolean contains(final Object o) { - return underlying.contains(o); - } - - @Override - public Iterator iterator() { - return new Iterator() { - private int index = 0; - - @Override - public boolean hasNext() { - return index < size(); - } - - @Override - public T next() { - if (index > size() || size() == 0) - throw new NoSuchElementException( - "Error on browsing at element " - + index - + " while the resultset contains only " - + size() - + " items"); - - return underlying.get(index++); - } - - @Override - public void remove() { - throw new UnsupportedOperationException("OBasicLegacyResultSet.iterator.remove()"); - } - }; - } - - @Override - public Object[] toArray() { - return underlying.toArray(); - } - - @Override - public T1[] toArray(final T1[] a) { - return underlying.toArray(a); - } - - public boolean add(final T t) { - if (limit > -1 && underlying.size() >= limit) return false; - - final boolean result = underlying.add(t); - return result; - } - - @Override - public boolean remove(final Object o) { - throw new UnsupportedOperationException("remove"); - } - - @Override - public boolean containsAll(final Collection c) { - throw new UnsupportedOperationException("remove"); - } - - public boolean addAll(final Collection c) { - return underlying.addAll(c); - } - - public boolean addAll(final int index, final Collection c) { - return underlying.addAll(index, c); - } - - @Override - public boolean removeAll(final Collection c) { - throw new UnsupportedOperationException("remove"); - } - - @Override - public boolean retainAll(final Collection c) { - throw new UnsupportedOperationException("remove"); - } - - @Override - public void clear() { - underlying.clear(); - } - - @Override - public boolean equals(final Object o) { - return underlying.equals(o); - } - - @Override - public int hashCode() { - return underlying.hashCode(); - } - - @Override - public T get(final int index) { - return underlying.get(index); - } - - public void add(final int index, T element) { - underlying.add(index, element); - } - - @Override - public T remove(final int index) { - throw new UnsupportedOperationException("remove"); - } - - @Override - public int indexOf(Object o) { - throw new UnsupportedOperationException("indexOf"); - } - - @Override - public int lastIndexOf(Object o) { - throw new UnsupportedOperationException("lastIndexOf"); - } - - @Override - public ListIterator listIterator() { - return underlying.listIterator(); - } - - @Override - public ListIterator listIterator(int index) { - return underlying.listIterator(index); - } - - @Override - public List subList(int fromIndex, int toIndex) { - return underlying.subList(fromIndex, toIndex); - } - - public int getLimit() { - return limit; - } - - public OLegacyResultSet setLimit(final int limit) { - this.limit = limit; - return this; - } - - @Override - public void writeExternal(final ObjectOutput out) throws IOException { - out.writeObject(underlying); - } - - @Override - public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { - underlying = (List) in.readObject(); - } - - public OBasicLegacyResultSet copy() { - final OBasicLegacyResultSet newValue = new OBasicLegacyResultSet(); - newValue.underlying.addAll(underlying); - return newValue; - } - - @Override - public boolean isEmptyNoWait() { - return underlying.isEmpty(); - } - - public void setTemporaryRecordCache(List temporaryRecordCache) { - this.temporaryRecordCache = temporaryRecordCache; - } -} diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OConcurrentLegacyResultSet.java b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OConcurrentLegacyResultSet.java deleted file mode 100755 index 7a8105ae531..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OConcurrentLegacyResultSet.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * - * * Copyright 2010-2016 OrientDB LTD (http://orientdb.com) - * * - * * Licensed 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. - * * - * * For more information: http://orientdb.com - * - */ -package com.orientechnologies.orient.core.sql.query; - -import com.orientechnologies.common.log.OLogManager; -import com.orientechnologies.common.log.OLogger; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -/** - * ResultSet implementation that allows concurrent population. - * - * @author Luca Garulli (l.garulli--(at)--orientdb.com) - * @param - */ -public class OConcurrentLegacyResultSet implements OLegacyResultSet { - private static final OLogger logger = - OLogManager.instance().logger(OConcurrentLegacyResultSet.class); - protected final transient Object waitForNextItem = new Object(); - protected final transient Object waitForCompletion = new Object(); - protected final transient OBasicLegacyResultSet wrapped; - protected transient volatile boolean completed = false; - - public OConcurrentLegacyResultSet() { - this.wrapped = new OBasicLegacyResultSet(); - } - - public OConcurrentLegacyResultSet(final OBasicLegacyResultSet wrapped) { - this.wrapped = wrapped; - } - - public OConcurrentLegacyResultSet setCompleted() { - completed = true; - synchronized (waitForNextItem) { - waitForNextItem.notifyAll(); - } - synchronized (waitForCompletion) { - waitForCompletion.notifyAll(); - } - return this; - } - - @Override - public int getLimit() { - return wrapped.getLimit(); - } - - @Override - public OLegacyResultSet setLimit(final int limit) { - return wrapped.setLimit(limit); - } - - @Override - public OLegacyResultSet copy() { - synchronized (wrapped) { - final OConcurrentLegacyResultSet copy = new OConcurrentLegacyResultSet(wrapped.copy()); - copy.completed = true; - return copy; - } - } - - @Override - public boolean isEmptyNoWait() { - synchronized (wrapped) { - return wrapped.isEmpty(); - } - } - - public T set(final int index, final T element) { - synchronized (wrapped) { - return wrapped.set(index, element); - } - } - - @Override - public void add(int index, T element) { - synchronized (wrapped) { - wrapped.add(index, element); - } - notifyNewItem(); - } - - @Override - public T remove(int index) { - throw new UnsupportedOperationException(); - } - - @Override - public int indexOf(Object o) { - throw new UnsupportedOperationException(); - } - - @Override - public int lastIndexOf(Object o) { - return 0; - } - - @Override - public ListIterator listIterator() { - synchronized (wrapped) { - return wrapped.listIterator(); - } - } - - @Override - public ListIterator listIterator(int index) { - synchronized (wrapped) { - return wrapped.listIterator(index); - } - } - - @Override - public List subList(int fromIndex, int toIndex) { - synchronized (wrapped) { - return wrapped.subList(fromIndex, toIndex); - } - } - - @Override - public int size() { - waitForCompletion(); - synchronized (wrapped) { - return wrapped.size(); - } - } - - @Override - public int currentSize() { - synchronized (wrapped) { - return wrapped.size(); - } - } - - @Override - public boolean isEmpty() { - boolean empty; - synchronized (wrapped) { - empty = wrapped.isEmpty(); - } - - if (empty) { - waitForNewItemOrCompleted(); - synchronized (wrapped) { - empty = wrapped.isEmpty(); - } - } - return empty; - } - - @Override - public boolean contains(final Object o) { - waitForCompletion(); - synchronized (wrapped) { - return wrapped.contains(o); - } - } - - @Override - public Iterator iterator() { - return new Iterator() { - private int index = 0; - - @Override - public boolean hasNext() { - int size; - synchronized (wrapped) { - size = wrapped.size(); - } - while (!completed) { - if (index < size) return true; - - waitForNewItemOrCompleted(); - - synchronized (wrapped) { - size = wrapped.size(); - } - } - - return index < wrapped.size(); - } - - @Override - public T next() { - int size; - synchronized (wrapped) { - size = wrapped.size(); - } - - while (!completed) { - if (index < size) break; - - waitForNewItemOrCompleted(); - - synchronized (wrapped) { - size = wrapped.size(); - } - } - - if (index > size || size == 0) - throw new NoSuchElementException( - "Error on browsing at element " - + index - + " while the resultset contains only " - + size - + " items"); - - synchronized (wrapped) { - return wrapped.get(index++); - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException("OLegacyResultSet.iterator.remove()"); - } - }; - } - - @Override - public Object[] toArray() { - waitForCompletion(); - synchronized (wrapped) { - return wrapped.toArray(); - } - } - - @Override - public T1[] toArray(T1[] a) { - waitForCompletion(); - synchronized (wrapped) { - return wrapped.toArray(a); - } - } - - public boolean add(final T t) { - final boolean result; - - synchronized (wrapped) { - result = wrapped.add(t); - } - - notifyNewItem(); - return result; - } - - @Override - public boolean remove(Object o) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean containsAll(Collection c) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean addAll(Collection c) { - boolean result; - synchronized (wrapped) { - result = wrapped.addAll(c); - } - notifyNewItem(); - return result; - } - - @Override - public boolean addAll(int index, Collection c) { - boolean result; - synchronized (wrapped) { - result = wrapped.addAll(index, c); - } - notifyNewItem(); - return result; - } - - @Override - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException(); - } - - @Override - public void clear() { - synchronized (wrapped) { - wrapped.clear(); - } - } - - @Override - public T get(int index) { - synchronized (wrapped) { - return wrapped.get(index); - } - } - - @Override - public void writeExternal(final ObjectOutput out) throws IOException { - synchronized (wrapped) { - wrapped.writeExternal(out); - } - } - - @Override - public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { - synchronized (wrapped) { - wrapped.readExternal(in); - } - completed = true; - } - - @Override - public int hashCode() { - synchronized (wrapped) { - return wrapped.hashCode(); - } - } - - @Override - public boolean equals(final Object obj) { - synchronized (wrapped) { - return wrapped.equals(obj); - } - } - - @Override - public String toString() { - return "size=" + wrapped.size(); - } - - protected void waitForCompletion() { - synchronized (waitForCompletion) { - if (!completed) - try { - waitForCompletion.wait(); - } catch (InterruptedException e) { - logger.error("Thread was interrupted", e); - } - } - } - - protected void waitForNewItemOrCompleted() { - synchronized (waitForNextItem) { - if (!completed) - try { - waitForNextItem.wait(); - } catch (InterruptedException e) { - logger.error("Thread was interrupted", e); - } - } - } - - protected void notifyNewItem() { - synchronized (waitForNextItem) { - waitForNextItem.notifyAll(); - } - } -} diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OLegacyResultSet.java b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OLegacyResultSet.java deleted file mode 100755 index ce2d0ecd954..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OLegacyResultSet.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * * Copyright 2010-2016 OrientDB LTD (http://orientdb.com) - * * - * * Licensed 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. - * * - * * For more information: http://orientdb.com - * - */ -package com.orientechnologies.orient.core.sql.query; - -import java.io.Externalizable; -import java.util.List; - -/** - * ResultSet interface that extends List interface for retro compatibility. - * - * @author Luca Garulli (l.garulli--(at)--orientdb.com) - * @param - */ -public interface OLegacyResultSet extends List, Externalizable { - - OLegacyResultSet setCompleted(); - - int getLimit(); - - OLegacyResultSet setLimit(int limit); - - OLegacyResultSet copy(); - - boolean isEmptyNoWait(); - - /** - * Returns the current size. If the resultset is not yet ready, returns te current size. - * - * @return - */ - int currentSize(); -} diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OLiveResultListener.java b/core/src/main/java/com/orientechnologies/orient/core/sql/query/OLiveResultListener.java deleted file mode 100644 index 803974b0a57..00000000000 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/query/OLiveResultListener.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * * Copyright 2015 OrientDB LTD (info(at)orientdb.com) - * * - * * Licensed 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. - * * - * * For more information: http://www.orientdb.com - * - */ -package com.orientechnologies.orient.core.sql.query; - -import com.orientechnologies.common.exception.OException; -import com.orientechnologies.orient.core.db.record.ORecordOperation; - -/** - * Listener for OLiveQuery. - * - * @see: OLiveQuery - * @author Luigi Dell'Aquila (l.dellaquila-(at)-orientdb.com) - */ -public interface OLiveResultListener { - - void onLiveResult(int iLiveToken, ORecordOperation iOp) throws OException; - - void onError(int iLiveToken); - - void onUnsubscribe(int iLiveToken); -} diff --git a/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java b/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java index 09adf46d492..dba1f7841b5 100755 --- a/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java +++ b/core/src/test/java/com/orientechnologies/orient/core/sql/OLiveQueryTest.java @@ -34,7 +34,6 @@ import com.orientechnologies.orient.core.metadata.schema.OSchema; import com.orientechnologies.orient.core.sql.executor.OResult; import com.orientechnologies.orient.core.sql.executor.OResultSet; -import com.orientechnologies.orient.core.sql.query.OLiveResultListener; import com.orientechnologies.orient.core.storage.OStorage; import java.util.ArrayList; import java.util.List; @@ -73,7 +72,7 @@ public void after() { odb.close(); } - class MyLiveQueryListener implements OLiveResultListener, OLiveQueryResultListener { + class MyLiveQueryListener implements OLiveQueryResultListener { public CountDownLatch latch; @@ -84,18 +83,6 @@ public MyLiveQueryListener(CountDownLatch latch) { public List ops = new ArrayList(); public List created = new ArrayList(); - @Override - public void onLiveResult(int iLiveToken, ORecordOperation iOp) throws OException { - ops.add(iOp); - latch.countDown(); - } - - @Override - public void onError(int iLiveToken) {} - - @Override - public void onUnsubscribe(int iLiveToken) {} - @Override public void onCreate(ODatabaseDocument database, OResult data) { created.add(data);