diff --git a/community/consistency-check-legacy/src/main/java/org/neo4j/legacy/consistency/checking/full/PropertyReader.java b/community/consistency-check-legacy/src/main/java/org/neo4j/legacy/consistency/checking/full/PropertyReader.java index 45473916ab948..ce04165c92fec 100644 --- a/community/consistency-check-legacy/src/main/java/org/neo4j/legacy/consistency/checking/full/PropertyReader.java +++ b/community/consistency-check-legacy/src/main/java/org/neo4j/legacy/consistency/checking/full/PropertyReader.java @@ -24,9 +24,9 @@ import java.util.List; import org.neo4j.function.Suppliers; +import org.neo4j.kernel.api.index.PropertyAccessor; import org.neo4j.kernel.api.properties.DefinedProperty; import org.neo4j.kernel.api.properties.Property; -import org.neo4j.kernel.impl.api.PropertyLookup; import org.neo4j.kernel.impl.store.InvalidRecordException; import org.neo4j.kernel.impl.store.NodeStore; import org.neo4j.kernel.impl.store.PropertyStore; @@ -34,7 +34,7 @@ import org.neo4j.kernel.impl.store.record.PropertyBlock; import org.neo4j.kernel.impl.store.record.PropertyRecord; -public class PropertyReader implements PropertyLookup +public class PropertyReader implements PropertyAccessor { private final PropertyStore propertyStore; private final NodeStore nodeStore; @@ -65,7 +65,7 @@ public DefinedProperty propertyValue( PropertyBlock block ) } @Override - public Property nodeProperty( long nodeId, int propertyKeyId ) + public Property getProperty( long nodeId, int propertyKeyId ) { try { diff --git a/community/consistency-check/src/main/java/org/neo4j/consistency/checking/full/PropertyReader.java b/community/consistency-check/src/main/java/org/neo4j/consistency/checking/full/PropertyReader.java index 43c55146a464c..84b3ad06e6fda 100644 --- a/community/consistency-check/src/main/java/org/neo4j/consistency/checking/full/PropertyReader.java +++ b/community/consistency-check/src/main/java/org/neo4j/consistency/checking/full/PropertyReader.java @@ -25,10 +25,9 @@ import java.util.List; import org.neo4j.function.Suppliers; +import org.neo4j.kernel.api.index.PropertyAccessor; import org.neo4j.kernel.api.properties.DefinedProperty; import org.neo4j.kernel.api.properties.Property; -import org.neo4j.kernel.impl.api.PropertyLookup; -import org.neo4j.kernel.impl.store.NodeStore; import org.neo4j.kernel.impl.store.PropertyStore; import org.neo4j.kernel.impl.store.StoreAccess; import org.neo4j.kernel.impl.store.record.NodeRecord; @@ -36,17 +35,15 @@ import org.neo4j.kernel.impl.store.record.PropertyRecord; import org.neo4j.kernel.impl.store.record.Record; -public class PropertyReader implements PropertyLookup +public class PropertyReader implements PropertyAccessor { private final PropertyStore propertyStore; - private final NodeStore nodeStore; private final StoreAccess storeAccess; public PropertyReader( StoreAccess storeAccess ) { this.storeAccess = storeAccess; propertyStore = storeAccess.getRawNeoStores().getPropertyStore(); - nodeStore = storeAccess.getRawNeoStores().getNodeStore(); } public Collection getPropertyRecordChain( NodeRecord nodeRecord ) @@ -100,7 +97,7 @@ public DefinedProperty propertyValue( PropertyBlock block ) } @Override - public Property nodeProperty( long nodeId, int propertyKeyId ) + public Property getProperty( long nodeId, int propertyKeyId ) { NodeRecord nodeRecord = storeAccess.getNodeStore().forceGetRecord( nodeId ); if ( nodeRecord != null ) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/api/index/PropertyAccessor.java b/community/kernel/src/main/java/org/neo4j/kernel/api/index/PropertyAccessor.java index d9179cd53ad92..1370cb7def2a6 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/api/index/PropertyAccessor.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/api/index/PropertyAccessor.java @@ -20,7 +20,6 @@ package org.neo4j.kernel.api.index; import org.neo4j.kernel.api.exceptions.EntityNotFoundException; -import org.neo4j.kernel.api.exceptions.PropertyNotFoundException; import org.neo4j.kernel.api.properties.Property; /** @@ -28,5 +27,5 @@ */ public interface PropertyAccessor { - Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException, PropertyNotFoundException; + Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException; } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/LookupFilter.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/LookupFilter.java index 3f602028d8a9a..034df06718e27 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/LookupFilter.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/LookupFilter.java @@ -25,6 +25,7 @@ import org.neo4j.collection.primitive.PrimitiveLongIterator; import org.neo4j.cursor.Cursor; import org.neo4j.kernel.api.exceptions.EntityNotFoundException; +import org.neo4j.kernel.api.index.PropertyAccessor; import org.neo4j.kernel.api.properties.Property; import org.neo4j.kernel.impl.api.operations.EntityOperations; import org.neo4j.kernel.impl.api.operations.EntityReadOperations; @@ -44,13 +45,13 @@ public class LookupFilter /** * used by the consistency checker */ - public static PrimitiveLongIterator exactIndexMatches( PropertyLookup lookup, PrimitiveLongIterator indexedNodeIds, - int propertyKeyId, Object value ) + public static PrimitiveLongIterator exactIndexMatches( PropertyAccessor accessor, + PrimitiveLongIterator indexedNodeIds, int propertyKeyId, Object value ) { if ( isNumberOrArray( value ) ) { return PrimitiveLongCollections.filter( indexedNodeIds, - new LookupBasedExactMatchPredicate( lookup, propertyKeyId, + new LookupBasedExactMatchPredicate( accessor, propertyKeyId, value ) ); } return indexedNodeIds; @@ -150,18 +151,18 @@ Property nodeProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundExc */ private static class LookupBasedExactMatchPredicate extends BaseExactMatchPredicate { - final PropertyLookup lookup; + final PropertyAccessor accessor; - LookupBasedExactMatchPredicate( PropertyLookup lookup, int propertyKeyId, Object value ) + LookupBasedExactMatchPredicate( PropertyAccessor accessor, int propertyKeyId, Object value ) { super( propertyKeyId, value ); - this.lookup = lookup; + this.accessor = accessor; } @Override Property nodeProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException { - return lookup.nodeProperty( nodeId, propertyKeyId ); + return accessor.getProperty( nodeId, propertyKeyId ); } } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/PropertyLookup.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/PropertyLookup.java deleted file mode 100644 index b1e97fab80d56..0000000000000 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/PropertyLookup.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2002-2016 "Neo Technology," - * Network Engine for Objects in Lund AB [http://neotechnology.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.kernel.impl.api; - -import org.neo4j.kernel.api.exceptions.EntityNotFoundException; -import org.neo4j.kernel.api.properties.Property; - -public interface PropertyLookup -{ - Property nodeProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException; -} diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexStoreView.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexStoreView.java index cb458f926c36b..eb86268285b79 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexStoreView.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/IndexStoreView.java @@ -24,7 +24,6 @@ import org.neo4j.helpers.collection.Visitor; import org.neo4j.kernel.api.exceptions.EntityNotFoundException; -import org.neo4j.kernel.api.exceptions.PropertyNotFoundException; import org.neo4j.kernel.api.index.IndexDescriptor; import org.neo4j.kernel.api.index.NodePropertyUpdate; import org.neo4j.kernel.api.index.PropertyAccessor; @@ -87,8 +86,7 @@ public PopulationProgress getProgress() IndexStoreView EMPTY = new IndexStoreView() { @Override - public Property getProperty( long nodeId, int propertyKeyId ) - throws EntityNotFoundException, PropertyNotFoundException + public Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException { return Property.noNodeProperty( nodeId, propertyKeyId ); } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/NeoStoreIndexStoreView.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/NeoStoreIndexStoreView.java index 8f2b6fafee88b..ff61282680419 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/NeoStoreIndexStoreView.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/NeoStoreIndexStoreView.java @@ -28,7 +28,6 @@ import org.neo4j.helpers.collection.PrefetchingIterator; import org.neo4j.helpers.collection.Visitor; import org.neo4j.kernel.api.exceptions.EntityNotFoundException; -import org.neo4j.kernel.api.exceptions.PropertyNotFoundException; import org.neo4j.kernel.api.index.IndexDescriptor; import org.neo4j.kernel.api.index.NodePropertyUpdate; import org.neo4j.kernel.api.labelscan.NodeLabelUpdate; @@ -50,6 +49,7 @@ import org.neo4j.register.Register.DoubleLongRegister; import org.neo4j.storageengine.api.EntityType; import org.neo4j.storageengine.api.schema.PopulationProgress; + import static org.neo4j.collection.primitive.PrimitiveLongCollections.EMPTY_LONG_ARRAY; import static org.neo4j.kernel.api.index.NodePropertyUpdate.add; import static org.neo4j.kernel.api.labelscan.NodeLabelUpdate.labelChanges; @@ -178,7 +178,7 @@ public void nodeAsUpdates( long nodeId, Collection target ) } @Override - public Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException, PropertyNotFoundException + public Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException { NodeRecord node = nodeStore.forceGetRecord( nodeId ); if ( !node.inUse() ) @@ -188,7 +188,7 @@ public Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFo long firstPropertyId = node.getNextProp(); if ( firstPropertyId == Record.NO_NEXT_PROPERTY.intValue() ) { - throw new PropertyNotFoundException( propertyKeyId, EntityType.NODE, nodeId ); + return Property.noNodeProperty( nodeId, propertyKeyId ); } for ( PropertyRecord propertyRecord : propertyStore.getPropertyRecordChain( firstPropertyId ) ) { @@ -198,7 +198,7 @@ public Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFo return propertyBlock.newPropertyData( propertyStore ); } } - throw new PropertyNotFoundException( propertyKeyId, EntityType.NODE, nodeId ); + return Property.noNodeProperty( nodeId, propertyKeyId ); } private Object valueOf( PropertyBlock property ) diff --git a/community/kernel/src/test/java/org/neo4j/kernel/api/index/NonUniqueIndexPopulatorCompatibility.java b/community/kernel/src/test/java/org/neo4j/kernel/api/index/NonUniqueIndexPopulatorCompatibility.java index d8acd7f2be35f..af8c03553eb86 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/api/index/NonUniqueIndexPopulatorCompatibility.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/api/index/NonUniqueIndexPopulatorCompatibility.java @@ -25,7 +25,6 @@ import org.neo4j.collection.primitive.PrimitiveLongCollections; import org.neo4j.collection.primitive.PrimitiveLongIterator; import org.neo4j.kernel.api.exceptions.EntityNotFoundException; -import org.neo4j.kernel.api.exceptions.PropertyNotFoundException; import org.neo4j.kernel.api.properties.Property; import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; @@ -133,7 +132,7 @@ public void shouldApplyUpdatesIdempotently() throws Exception PropertyAccessor propertyAccessor = new PropertyAccessor() { @Override - public Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException, PropertyNotFoundException + public Property getProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException { return Property.stringProperty( propertyKeyId, propertyValue ); }