replaced the IIndexArtifactMap interface with the ILocalResourceRepository interface
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1942 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/RuntimeContext.java b/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/RuntimeContext.java
index 94537bf..8cce523 100644
--- a/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/RuntimeContext.java
+++ b/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/RuntimeContext.java
@@ -20,7 +20,6 @@
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
import edu.uci.ics.hyracks.storage.am.common.dataflow.IndexLifecycleManager;
-import edu.uci.ics.hyracks.storage.common.TransientIndexArtifactMap;
import edu.uci.ics.hyracks.storage.common.buffercache.BufferCache;
import edu.uci.ics.hyracks.storage.common.buffercache.ClockPageReplacementStrategy;
import edu.uci.ics.hyracks.storage.common.buffercache.HeapBufferAllocator;
@@ -29,13 +28,12 @@
import edu.uci.ics.hyracks.storage.common.buffercache.IPageReplacementStrategy;
import edu.uci.ics.hyracks.storage.common.file.IFileMapManager;
import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
-import edu.uci.ics.hyracks.storage.common.file.IIndexArtifactMap;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepositoryFactory;
-import edu.uci.ics.hyracks.storage.common.file.IndexLocalResourceRepositoryFactory;
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
-import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactoryFactory;
+import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactoryProvider;
import edu.uci.ics.hyracks.storage.common.file.TransientFileMapManager;
+import edu.uci.ics.hyracks.storage.common.file.TransientLocalResourceRepositoryFactory;
public class RuntimeContext {
private IBufferCache bufferCache;
@@ -50,10 +48,10 @@
IPageReplacementStrategy prs = new ClockPageReplacementStrategy();
bufferCache = new BufferCache(appCtx.getRootContext().getIOManager(), allocator, prs, fileMapManager, 32768,
50, 100);
- ILocalResourceRepositoryFactory indexLocalResourceRepositoryFactory = new IndexLocalResourceRepositoryFactory(appCtx.getRootContext().getIOManager());
- localResourceRepository = indexLocalResourceRepositoryFactory.createRepository();
- resourceIdFactory = (new ResourceIdFactoryFactory(localResourceRepository)).createResourceIdFactory();
lcManager = new IndexLifecycleManager();
+ ILocalResourceRepositoryFactory localResourceRepositoryFactory = new TransientLocalResourceRepositoryFactory();
+ localResourceRepository = localResourceRepositoryFactory.createRepository();
+ resourceIdFactory = (new ResourceIdFactoryProvider(localResourceRepository)).createResourceIdFactory();
}
public void close() {
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/btree/AbstractBTreeOperatorTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/btree/AbstractBTreeOperatorTest.java
index 95fc9d6..f161260 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/btree/AbstractBTreeOperatorTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/btree/AbstractBTreeOperatorTest.java
@@ -54,6 +54,7 @@
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.TransientLocalResourceFactoryProvider;
import edu.uci.ics.hyracks.test.support.TestIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
import edu.uci.ics.hyracks.test.support.TestStorageManagerInterface;
@@ -133,9 +134,10 @@
public void createPrimaryIndex() throws Exception {
JobSpecification spec = new JobSpecification();
+ TransientLocalResourceFactoryProvider localResourceFactoryProvider = new TransientLocalResourceFactoryProvider();
TreeIndexCreateOperatorDescriptor primaryCreateOp = new TreeIndexCreateOperatorDescriptor(spec, storageManager,
lcManagerProvider, primarySplitProvider, primaryTypeTraits, primaryComparatorFactories,
- dataflowHelperFactory);
+ dataflowHelperFactory, localResourceFactoryProvider);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, primaryCreateOp, NC1_ID);
spec.addRoot(primaryCreateOp);
runTest(spec);
@@ -183,9 +185,10 @@
public void createSecondaryIndex() throws Exception {
JobSpecification spec = new JobSpecification();
+ TransientLocalResourceFactoryProvider localResourceFactoryProvider = new TransientLocalResourceFactoryProvider();
TreeIndexCreateOperatorDescriptor secondaryCreateOp = new TreeIndexCreateOperatorDescriptor(spec,
storageManager, lcManagerProvider, secondarySplitProvider, secondaryTypeTraits,
- secondaryComparatorFactories, dataflowHelperFactory);
+ secondaryComparatorFactories, dataflowHelperFactory, localResourceFactoryProvider);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, secondaryCreateOp, NC1_ID);
spec.addRoot(secondaryCreateOp);
runTest(spec);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/invertedindex/WordInvertedIndexTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/invertedindex/WordInvertedIndexTest.java
index 2c22289..6bc13da 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/invertedindex/WordInvertedIndexTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/invertedindex/WordInvertedIndexTest.java
@@ -73,6 +73,8 @@
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.tokenizers.ITokenFactory;
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.tokenizers.UTF8WordTokenFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactoryProvider;
+import edu.uci.ics.hyracks.storage.common.file.TransientLocalResourceFactoryProvider;
import edu.uci.ics.hyracks.test.support.TestIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
import edu.uci.ics.hyracks.test.support.TestStorageManagerInterface;
@@ -85,13 +87,13 @@
}
private static final int MERGE_THRESHOLD = 3;
-
+
private IStorageManagerInterface storageManager = new TestStorageManagerInterface();
private IIndexLifecycleManagerProvider lcManagerProvider = new TestIndexLifecycleManagerProvider();
private IIndexDataflowHelperFactory btreeDataflowHelperFactory = new BTreeDataflowHelperFactory();
- private IIndexDataflowHelperFactory invertedIndexDataflowHelperFactory = new LSMInvertedIndexDataflowHelperFactory(new FlushControllerProvider(), new ConstantMergePolicyProvider(
- ImmediateSchedulerProvider.INSTANCE, MERGE_THRESHOLD), new RefCountingOperationTrackerProvider(),
- ImmediateSchedulerProvider.INSTANCE);
+ private IIndexDataflowHelperFactory invertedIndexDataflowHelperFactory = new LSMInvertedIndexDataflowHelperFactory(
+ new FlushControllerProvider(), new ConstantMergePolicyProvider(ImmediateSchedulerProvider.INSTANCE,
+ MERGE_THRESHOLD), new RefCountingOperationTrackerProvider(), ImmediateSchedulerProvider.INSTANCE);
private final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("ddMMyy-hhmmssSS");
private final static String sep = System.getProperty("file.separator");
@@ -154,9 +156,10 @@
public void createPrimaryIndex() throws Exception {
JobSpecification spec = new JobSpecification();
+ TransientLocalResourceFactoryProvider localResourceFactoryProvider = new TransientLocalResourceFactoryProvider();
TreeIndexCreateOperatorDescriptor primaryCreateOp = new TreeIndexCreateOperatorDescriptor(spec, storageManager,
lcManagerProvider, primaryFileSplitProvider, primaryTypeTraits, primaryComparatorFactories,
- btreeDataflowHelperFactory);
+ btreeDataflowHelperFactory, localResourceFactoryProvider);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, primaryCreateOp, NC1_ID);
spec.addRoot(primaryCreateOp);
runTest(spec);
@@ -164,10 +167,11 @@
public void createInvertedIndex() throws Exception {
JobSpecification spec = new JobSpecification();
+ ILocalResourceFactoryProvider localResourceFactoryProvider = new TransientLocalResourceFactoryProvider();
LSMInvertedIndexCreateOperatorDescriptor invIndexCreateOp = new LSMInvertedIndexCreateOperatorDescriptor(spec,
- storageManager, btreeFileSplitProvider, lcManagerProvider, tokenTypeTraits,
- tokenComparatorFactories, invListsTypeTraits, invListsComparatorFactories, tokenizerFactory,
- invertedIndexDataflowHelperFactory, NoOpOperationCallbackProvider.INSTANCE);
+ storageManager, btreeFileSplitProvider, lcManagerProvider, tokenTypeTraits, tokenComparatorFactories,
+ invListsTypeTraits, invListsComparatorFactories, tokenizerFactory, invertedIndexDataflowHelperFactory,
+ NoOpOperationCallbackProvider.INSTANCE, localResourceFactoryProvider);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, invIndexCreateOp, NC1_ID);
spec.addRoot(invIndexCreateOp);
runTest(spec);
@@ -203,7 +207,7 @@
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, primaryBtreeBulkLoad, NC1_ID);
return primaryBtreeBulkLoad;
}
-
+
private IOperatorDescriptor createScanKeyProviderOp(JobSpecification spec) throws HyracksDataException {
// build dummy tuple containing nothing
ArrayTupleBuilder tb = new ArrayTupleBuilder(primaryKeyFieldCount * 2);
@@ -317,8 +321,8 @@
private IOperatorDescriptor createInvertedIndexSearchOp(JobSpecification spec,
IInvertedIndexSearchModifierFactory searchModifierFactory) {
- LSMInvertedIndexSearchOperatorDescriptor invIndexSearchOp = new LSMInvertedIndexSearchOperatorDescriptor(spec, 0,
- storageManager, btreeFileSplitProvider, lcManagerProvider, tokenTypeTraits,
+ LSMInvertedIndexSearchOperatorDescriptor invIndexSearchOp = new LSMInvertedIndexSearchOperatorDescriptor(spec,
+ 0, storageManager, btreeFileSplitProvider, lcManagerProvider, tokenTypeTraits,
tokenComparatorFactories, invListsTypeTraits, invListsComparatorFactories,
invertedIndexDataflowHelperFactory, tokenizerFactory, searchModifierFactory, invListsRecDesc, false,
NoOpOperationCallbackProvider.INSTANCE);
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/rtree/AbstractRTreeOperatorTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/rtree/AbstractRTreeOperatorTest.java
index 0f42bb0..bce4a1d 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/rtree/AbstractRTreeOperatorTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/am/rtree/AbstractRTreeOperatorTest.java
@@ -64,6 +64,7 @@
import edu.uci.ics.hyracks.storage.am.rtree.frames.RTreePolicyType;
import edu.uci.ics.hyracks.storage.am.rtree.util.RTreeUtils;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.TransientLocalResourceFactoryProvider;
import edu.uci.ics.hyracks.test.support.TestIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.test.support.TestStorageManagerComponentHolder;
import edu.uci.ics.hyracks.test.support.TestStorageManagerInterface;
@@ -180,9 +181,10 @@
protected void createPrimaryIndex() throws Exception {
JobSpecification spec = new JobSpecification();
+ TransientLocalResourceFactoryProvider localResourceFactoryProvider = new TransientLocalResourceFactoryProvider();
TreeIndexCreateOperatorDescriptor primaryCreateOp = new TreeIndexCreateOperatorDescriptor(spec, storageManager,
lcManagerProvider, primarySplitProvider, primaryTypeTraits, primaryComparatorFactories,
- btreeDataflowHelperFactory);
+ btreeDataflowHelperFactory, localResourceFactoryProvider);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, primaryCreateOp, NC1_ID);
spec.addRoot(primaryCreateOp);
runTest(spec);
@@ -234,9 +236,10 @@
protected void createSecondaryIndex() throws Exception {
JobSpecification spec = new JobSpecification();
+ TransientLocalResourceFactoryProvider localResourceFactoryProvider = new TransientLocalResourceFactoryProvider();
TreeIndexCreateOperatorDescriptor secondaryCreateOp = new TreeIndexCreateOperatorDescriptor(spec,
storageManager, lcManagerProvider, secondarySplitProvider, secondaryTypeTraits,
- secondaryComparatorFactories, rtreeDataflowHelperFactory);
+ secondaryComparatorFactories, rtreeDataflowHelperFactory, localResourceFactoryProvider);
PartitionConstraintHelper.addAbsoluteLocationConstraint(spec, secondaryCreateOp, NC1_ID);
spec.addRoot(secondaryCreateOp);
runTest(spec);
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java
index 33aaed1..100570d 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeSearchOperatorDescriptor.java
@@ -28,6 +28,7 @@
import edu.uci.ics.hyracks.storage.am.common.dataflow.AbstractTreeIndexOperatorDescriptor;
import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class BTreeSearchOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -45,7 +46,8 @@
boolean lowKeyInclusive, boolean highKeyInclusive, IIndexDataflowHelperFactory dataflowHelperFactory,
boolean retainInput, IOperationCallbackProvider opCallbackProvider) {
super(spec, 1, 1, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits,
- comparatorFactories, dataflowHelperFactory, null, retainInput, opCallbackProvider);
+ comparatorFactories, dataflowHelperFactory, null, retainInput, opCallbackProvider,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
this.lowKeyFields = lowKeyFields;
this.highKeyFields = highKeyFields;
this.lowKeyInclusive = lowKeyInclusive;
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractIndexOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractIndexOperatorDescriptor.java
index d248ec9..3f76ec0 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractIndexOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractIndexOperatorDescriptor.java
@@ -23,8 +23,10 @@
import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilterFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactoryProvider;
-public abstract class AbstractIndexOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor implements IIndexOperatorDescriptor {
+public abstract class AbstractIndexOperatorDescriptor extends AbstractSingleActivityOperatorDescriptor implements
+ IIndexOperatorDescriptor {
private static final long serialVersionUID = 1L;
@@ -35,12 +37,14 @@
protected final ITupleFilterFactory tupleFilterFactory;
protected final boolean retainInput;
protected final IOperationCallbackProvider opCallbackProvider;
+ protected final ILocalResourceFactoryProvider localResourceFactoryProvider;
public AbstractIndexOperatorDescriptor(IOperatorDescriptorRegistry spec, int inputArity, int outputArity,
RecordDescriptor recDesc, IStorageManagerInterface storageManager,
IIndexLifecycleManagerProvider lifecycleManagerProvider, IFileSplitProvider fileSplitProvider,
IIndexDataflowHelperFactory dataflowHelperFactory, ITupleFilterFactory tupleFilterFactory,
- boolean retainInput, IOperationCallbackProvider opCallbackProvider) {
+ boolean retainInput, IOperationCallbackProvider opCallbackProvider,
+ ILocalResourceFactoryProvider localResourceFactoryProvider) {
super(spec, inputArity, outputArity);
this.fileSplitProvider = fileSplitProvider;
this.storageManager = storageManager;
@@ -49,12 +53,12 @@
this.retainInput = retainInput;
this.tupleFilterFactory = tupleFilterFactory;
this.opCallbackProvider = opCallbackProvider;
+ this.localResourceFactoryProvider = localResourceFactoryProvider;
if (outputArity > 0) {
recordDescriptors[0] = recDesc;
}
}
-
-
+
@Override
public IFileSplitProvider getFileSplitProvider() {
return fileSplitProvider;
@@ -94,4 +98,9 @@
public ITupleFilterFactory getTupleFilterFactory() {
return tupleFilterFactory;
}
+
+ @Override
+ public ILocalResourceFactoryProvider getLocalResourceFactoryProvider() {
+ return localResourceFactoryProvider;
+ }
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java
index aed3cc9..1609c66 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/AbstractTreeIndexOperatorDescriptor.java
@@ -24,6 +24,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilterFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactoryProvider;
public abstract class AbstractTreeIndexOperatorDescriptor extends AbstractIndexOperatorDescriptor {
@@ -37,9 +38,11 @@
IIndexLifecycleManagerProvider lifecycleManagerProvider, IFileSplitProvider fileSplitProvider,
ITypeTraits[] typeTraits, IBinaryComparatorFactory[] comparatorFactories,
IIndexDataflowHelperFactory dataflowHelperFactory, ITupleFilterFactory tupleFilterFactory,
- boolean retainInput, IOperationCallbackProvider opCallbackProvider) {
+ boolean retainInput, IOperationCallbackProvider opCallbackProvider,
+ ILocalResourceFactoryProvider localResourceFactoryProvider) {
super(spec, inputArity, outputArity, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider,
- dataflowHelperFactory, tupleFilterFactory, retainInput, opCallbackProvider);
+ dataflowHelperFactory, tupleFilterFactory, retainInput, opCallbackProvider,
+ localResourceFactoryProvider);
this.typeTraits = typeTraits;
this.comparatorFactories = comparatorFactories;
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexOperatorDescriptor.java
index 375e047..7b15ea6 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IIndexOperatorDescriptor.java
@@ -22,6 +22,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilterFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactoryProvider;
public interface IIndexOperatorDescriptor extends IActivity {
public IFileSplitProvider getFileSplitProvider();
@@ -39,4 +40,6 @@
public IOperationCallbackProvider getOpCallbackProvider();
public ITupleFilterFactory getTupleFilterFactory();
+
+ public ILocalResourceFactoryProvider getLocalResourceFactoryProvider();
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
index 1cc6179..bafa3d9 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
@@ -23,8 +23,9 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexDataflowHelper;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactory;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
-import edu.uci.ics.hyracks.storage.common.file.IndexLocalResource;
+import edu.uci.ics.hyracks.storage.common.file.LocalResource;
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
public abstract class IndexDataflowHelper implements IIndexDataflowHelper {
@@ -44,6 +45,7 @@
this.lcManager = opDesc.getLifecycleManagerProvider().getLifecycleManager(ctx);
this.localResourceRepository = opDesc.getStorageManager().getLocalResourceRepository(ctx);
this.resourceIdFactory = opDesc.getStorageManager().getResourceIdFactory(ctx);
+
this.file = opDesc.getFileSplitProvider().getFileSplits()[partition].getLocalFile();
}
@@ -64,7 +66,7 @@
}
// The previous resource ID needs to be removed since calling IIndex.create() may possibly destroy
- // any physical artifact that the IIndexArtifactMap is managing (e.g. a file containing the resource ID).
+ // any physical artifact that the LocalResourceRepository is managing (e.g. a file containing the resource ID).
// Once the index has been created, a new resource ID can be generated.
if (resourceID != -1) {
localResourceRepository.deleteResourceByName(file.getFile().getPath());
@@ -73,7 +75,9 @@
try {
//TODO Create LocalResource through LocalResourceFactory interface
resourceID = resourceIdFactory.createId();
- localResourceRepository.insert(new IndexLocalResource(resourceID, file.getFile().getPath(), null, null));
+ ILocalResourceFactory localResourceFactory = opDesc.getLocalResourceFactoryProvider()
+ .getLocalResourceFactory();
+ localResourceRepository.insert(localResourceFactory.createLocalResource(resourceID, file.getFile().getPath()));
} catch (IOException e) {
throw new HyracksDataException(e);
}
@@ -126,9 +130,14 @@
}
public long getResourceID() throws HyracksDataException {
- return localResourceRepository.getResourceByName(file.getFile().getPath()).getResourceId();
+ LocalResource localResource = localResourceRepository.getResourceByName(file.getFile().getPath());
+ if (localResource == null) {
+ return -1;
+ } else {
+ return localResource.getResourceId();
+ }
}
-
+
public IHyracksTaskContext getTaskContext() {
return ctx;
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDropOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDropOperatorDescriptor.java
index 946dd52..8a0f729 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDropOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDropOperatorDescriptor.java
@@ -26,6 +26,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class IndexDropOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -40,7 +41,8 @@
// This should eventually not be *hacked*, but I don't know the proper fix yet. -zheilbron
super(spec, 0, 0, null, storageManager, lifecycleManagerProvider, fileSplitProvider, new ITypeTraits[] {
IntegerPointable.TYPE_TRAITS, IntegerPointable.TYPE_TRAITS }, new IBinaryComparatorFactory[] { null },
- dataflowHelperFactory, null, false, NoOpOperationCallbackProvider.INSTANCE);
+ dataflowHelperFactory, null, false, NoOpOperationCallbackProvider.INSTANCE,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
}
@Override
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
index f78bdb4..02f2ec6 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorDescriptor.java
@@ -25,6 +25,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class TreeIndexBulkLoadOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -41,7 +42,8 @@
boolean verifyInput, IIndexDataflowHelperFactory dataflowHelperFactory,
IOperationCallbackProvider opCallbackProvider) {
super(spec, 1, 0, null, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits,
- comparatorFactories, dataflowHelperFactory, null, false, opCallbackProvider);
+ comparatorFactories, dataflowHelperFactory, null, false, opCallbackProvider,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
this.fieldPermutation = fieldPermutation;
this.fillFactor = fillFactor;
this.verifyInput = verifyInput;
@@ -50,7 +52,7 @@
@Override
public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
- return new IndexBulkLoadOperatorNodePushable(this, ctx, partition, fieldPermutation, fillFactor,
- verifyInput, recordDescProvider);
+ return new IndexBulkLoadOperatorNodePushable(this, ctx, partition, fieldPermutation, fillFactor, verifyInput,
+ recordDescProvider);
}
}
\ No newline at end of file
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java
index f4b668c..8ba5fae 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexCreateOperatorDescriptor.java
@@ -25,6 +25,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactoryProvider;
public class TreeIndexCreateOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -33,9 +34,11 @@
public TreeIndexCreateOperatorDescriptor(IOperatorDescriptorRegistry spec, IStorageManagerInterface storageManager,
IIndexLifecycleManagerProvider lifecycleManagerProvider, IFileSplitProvider fileSplitProvider,
ITypeTraits[] typeTraits, IBinaryComparatorFactory[] comparatorFactories,
- IIndexDataflowHelperFactory dataflowHelperFactory) {
+ IIndexDataflowHelperFactory dataflowHelperFactory,
+ ILocalResourceFactoryProvider localResourceFactoryProvider) {
super(spec, 0, 0, null, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits,
- comparatorFactories, dataflowHelperFactory, null, false, NoOpOperationCallbackProvider.INSTANCE);
+ comparatorFactories, dataflowHelperFactory, null, false, NoOpOperationCallbackProvider.INSTANCE,
+ localResourceFactoryProvider);
}
@Override
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
index 6a5afea..7e16d62 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorDescriptor.java
@@ -25,6 +25,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class TreeIndexDiskOrderScanOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -35,7 +36,7 @@
IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits,
IIndexDataflowHelperFactory dataflowHelperFactory, IOperationCallbackProvider opCallbackProvider) {
super(spec, 0, 1, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits, null,
- dataflowHelperFactory, null, false, opCallbackProvider);
+ dataflowHelperFactory, null, false, opCallbackProvider, NoOpLocalResourceFactoryProvider.INSTANCE);
}
@Override
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
index ef176b8..5a49c62 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorDescriptor.java
@@ -28,6 +28,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilterFactory;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class TreeIndexInsertUpdateDeleteOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -43,7 +44,8 @@
IIndexDataflowHelperFactory dataflowHelperFactory, ITupleFilterFactory tupleFilterFactory,
IOperationCallbackProvider opCallbackProvider) {
super(spec, 1, 1, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits,
- comparatorFactories, dataflowHelperFactory, tupleFilterFactory, false, opCallbackProvider);
+ comparatorFactories, dataflowHelperFactory, tupleFilterFactory, false, opCallbackProvider,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
this.fieldPermutation = fieldPermutation;
this.op = op;
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
index 4bba2d8..39a2118 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorDescriptor.java
@@ -27,6 +27,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class TreeIndexStatsOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -39,7 +40,8 @@
ITypeTraits[] typeTraits, IBinaryComparatorFactory[] comparatorFactories,
IIndexDataflowHelperFactory dataflowHelperFactory, IOperationCallbackProvider opCallbackProvider) {
super(spec, 0, 1, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits,
- comparatorFactories, dataflowHelperFactory, null, false, opCallbackProvider);
+ comparatorFactories, dataflowHelperFactory, null, false, opCallbackProvider,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
}
@Override
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/AbstractLSMInvertedIndexOperatorDescriptor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/AbstractLSMInvertedIndexOperatorDescriptor.java
index a8bf801..2611c51 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/AbstractLSMInvertedIndexOperatorDescriptor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/AbstractLSMInvertedIndexOperatorDescriptor.java
@@ -28,9 +28,10 @@
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexOperatorDescriptor;
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactoryProvider;
-public abstract class AbstractLSMInvertedIndexOperatorDescriptor extends AbstractIndexOperatorDescriptor
- implements IInvertedIndexOperatorDescriptor {
+public abstract class AbstractLSMInvertedIndexOperatorDescriptor extends AbstractIndexOperatorDescriptor implements
+ IInvertedIndexOperatorDescriptor {
private static final long serialVersionUID = 1L;
@@ -39,17 +40,18 @@
protected final ITypeTraits[] tokenTypeTraits;
protected final IBinaryComparatorFactory[] tokenComparatorFactories;
protected final IBinaryTokenizerFactory tokenizerFactory;
-
- public AbstractLSMInvertedIndexOperatorDescriptor(IOperatorDescriptorRegistry spec, int inputArity, int outputArity,
- RecordDescriptor recDesc, IStorageManagerInterface storageManager,
- IFileSplitProvider fileSplitProvider,
- IIndexLifecycleManagerProvider lifecycleManagerProvider, ITypeTraits[] tokenTypeTraits,
- IBinaryComparatorFactory[] tokenComparatorFactories, ITypeTraits[] invListsTypeTraits,
- IBinaryComparatorFactory[] invListComparatorFactories, IBinaryTokenizerFactory tokenizerFactory,
- IIndexDataflowHelperFactory dataflowHelperFactory, ITupleFilterFactory tupleFilterFactory, boolean retainInput,
- IOperationCallbackProvider opCallbackProvider) {
+
+ public AbstractLSMInvertedIndexOperatorDescriptor(IOperatorDescriptorRegistry spec, int inputArity,
+ int outputArity, RecordDescriptor recDesc, IStorageManagerInterface storageManager,
+ IFileSplitProvider fileSplitProvider, IIndexLifecycleManagerProvider lifecycleManagerProvider,
+ ITypeTraits[] tokenTypeTraits, IBinaryComparatorFactory[] tokenComparatorFactories,
+ ITypeTraits[] invListsTypeTraits, IBinaryComparatorFactory[] invListComparatorFactories,
+ IBinaryTokenizerFactory tokenizerFactory, IIndexDataflowHelperFactory dataflowHelperFactory,
+ ITupleFilterFactory tupleFilterFactory, boolean retainInput, IOperationCallbackProvider opCallbackProvider,
+ ILocalResourceFactoryProvider localResourceFactoryProvider) {
super(spec, inputArity, outputArity, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider,
- dataflowHelperFactory, tupleFilterFactory, retainInput, opCallbackProvider);
+ dataflowHelperFactory, tupleFilterFactory, retainInput, opCallbackProvider,
+ localResourceFactoryProvider);
this.invListsTypeTraits = invListsTypeTraits;
this.invListComparatorFactories = invListComparatorFactories;
this.tokenTypeTraits = tokenTypeTraits;
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexBulkLoadOperatorDescriptor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexBulkLoadOperatorDescriptor.java
index 31965e8..ede9b42 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexBulkLoadOperatorDescriptor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexBulkLoadOperatorDescriptor.java
@@ -28,6 +28,7 @@
import edu.uci.ics.hyracks.storage.am.common.dataflow.IndexBulkLoadOperatorNodePushable;
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class LSMInvertedIndexBulkLoadOperatorDescriptor extends AbstractLSMInvertedIndexOperatorDescriptor {
@@ -45,7 +46,8 @@
IOperationCallbackProvider opCallbackProvider) {
super(spec, 1, 0, null, storageManager, fileSplitProvider, lifecycleManagerProvider, tokenTypeTraits,
tokenComparatorFactories, invListsTypeTraits, invListComparatorFactories, tokenizerFactory,
- invertedIndexDataflowHelperFactory, null, false, opCallbackProvider);
+ invertedIndexDataflowHelperFactory, null, false, opCallbackProvider,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
this.fieldPermutation = fieldPermutation;
this.verifyInput = verifyInput;
}
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexCreateOperatorDescriptor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexCreateOperatorDescriptor.java
index 3b9b27e..8a0c997 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexCreateOperatorDescriptor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexCreateOperatorDescriptor.java
@@ -28,6 +28,7 @@
import edu.uci.ics.hyracks.storage.am.common.dataflow.IndexCreateOperatorNodePushable;
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.ILocalResourceFactoryProvider;
public class LSMInvertedIndexCreateOperatorDescriptor extends AbstractLSMInvertedIndexOperatorDescriptor {
@@ -38,10 +39,11 @@
IIndexLifecycleManagerProvider lifecycleManagerProvider, ITypeTraits[] tokenTypeTraits,
IBinaryComparatorFactory[] tokenComparatorFactories, ITypeTraits[] invListsTypeTraits,
IBinaryComparatorFactory[] invListComparatorFactories, IBinaryTokenizerFactory tokenizerFactory,
- IIndexDataflowHelperFactory btreeDataflowHelperFactory, IOperationCallbackProvider opCallbackProvider) {
+ IIndexDataflowHelperFactory btreeDataflowHelperFactory, IOperationCallbackProvider opCallbackProvider,
+ ILocalResourceFactoryProvider localResourceFactoryProvider) {
super(spec, 0, 0, null, storageManager, fileSplitProvider, lifecycleManagerProvider, tokenTypeTraits,
tokenComparatorFactories, invListsTypeTraits, invListComparatorFactories, tokenizerFactory,
- btreeDataflowHelperFactory, null, false, opCallbackProvider);
+ btreeDataflowHelperFactory, null, false, opCallbackProvider, localResourceFactoryProvider);
}
@Override
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexInsertUpdateDeleteOperator.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexInsertUpdateDeleteOperator.java
index a77768c..5696f67 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexInsertUpdateDeleteOperator.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexInsertUpdateDeleteOperator.java
@@ -29,6 +29,7 @@
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class LSMInvertedIndexInsertUpdateDeleteOperator extends AbstractLSMInvertedIndexOperatorDescriptor {
@@ -46,7 +47,7 @@
IOperationCallbackProvider opCallbackProvider) {
super(spec, 0, 0, null, storageManager, fileSplitProvider, lifecycleManagerProvider, tokenTypeTraits,
tokenComparatorFactories, invListsTypeTraits, invListComparatorFactories, tokenizerFactory,
- dataflowHelperFactory, null, false, opCallbackProvider);
+ dataflowHelperFactory, null, false, opCallbackProvider, NoOpLocalResourceFactoryProvider.INSTANCE);
this.fieldPermutation = fieldPermutation;
this.op = op;
}
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexSearchOperatorDescriptor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexSearchOperatorDescriptor.java
index a997575..c9c7786 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexSearchOperatorDescriptor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexSearchOperatorDescriptor.java
@@ -31,6 +31,7 @@
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndexSearchModifierFactory;
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class LSMInvertedIndexSearchOperatorDescriptor extends AbstractLSMInvertedIndexOperatorDescriptor {
private static final long serialVersionUID = 1L;
@@ -48,7 +49,8 @@
IOperationCallbackProvider opCallbackProvider) {
super(spec, 1, 1, recDesc, storageManager, fileSplitProvider, lifecycleManagerProvider, tokenTypeTraits,
tokenComparatorFactories, invListsTypeTraits, invListComparatorFactories, queryTokenizerFactory,
- btreeDataflowHelperFactory, null, retainInput, opCallbackProvider);
+ btreeDataflowHelperFactory, null, retainInput, opCallbackProvider,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
this.queryField = queryField;
this.searchModifierFactory = searchModifierFactory;
}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java
index e85d2da..94ad898 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/dataflow/RTreeSearchOperatorDescriptor.java
@@ -28,6 +28,7 @@
import edu.uci.ics.hyracks.storage.am.common.dataflow.AbstractTreeIndexOperatorDescriptor;
import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexDataflowHelperFactory;
import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+import edu.uci.ics.hyracks.storage.common.file.NoOpLocalResourceFactoryProvider;
public class RTreeSearchOperatorDescriptor extends AbstractTreeIndexOperatorDescriptor {
@@ -42,7 +43,8 @@
IIndexDataflowHelperFactory dataflowHelperFactory, boolean retainInput,
IOperationCallbackProvider opCallbackProvider) {
super(spec, 1, 1, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits,
- comparatorFactories, dataflowHelperFactory, null, false, opCallbackProvider);
+ comparatorFactories, dataflowHelperFactory, null, false, opCallbackProvider,
+ NoOpLocalResourceFactoryProvider.INSTANCE);
this.keyFields = keyFields;
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/TransientIndexArtifactMap.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/TransientIndexArtifactMap.java
deleted file mode 100644
index 2c0fb29..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/TransientIndexArtifactMap.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.common;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.api.io.IODeviceHandle;
-import edu.uci.ics.hyracks.storage.common.file.IIndexArtifactMap;
-
-public class TransientIndexArtifactMap implements IIndexArtifactMap {
- private long counter = 0;
- private Map<String, Long> name2IdMap = new HashMap<String, Long>();
-
- @Override
- public long create(String baseDir, List<IODeviceHandle> IODeviceHandles) throws IOException {
- long resourceId = counter++;
- synchronized (name2IdMap) {
- if (name2IdMap.containsKey(baseDir)) {
- throw new HyracksDataException("Failed to create artifact for " + baseDir
- + ". Artifact already exists.");
- }
- name2IdMap.put(baseDir, resourceId);
- }
- return resourceId;
- }
-
- /**
- * Search and return the resourceId indicated by fullDir from in-memory hashMap, name2IdMap.
- * When there is no corresponding id in name2IdMap, return -1;
- */
- @Override
- public long get(String baseDir) {
- Long resourceId = -1L;
-
- synchronized (name2IdMap) {
- resourceId = name2IdMap.get(baseDir);
- }
-
- if (resourceId == null) {
- return -1;
- } else {
- return resourceId;
- }
- }
-
- @Override
- public void delete(String baseDir, List<IODeviceHandle> IODeviceHandles) {
- synchronized (name2IdMap) {
- name2IdMap.remove(baseDir);
- }
- }
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/AbstractIndexLocalResourceClass.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/AbstractIndexLocalResourceClass.java
deleted file mode 100644
index 1ec3548..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/AbstractIndexLocalResourceClass.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.common.file;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-
-public abstract class AbstractIndexLocalResourceClass implements ILocalResourceClass {
-
- @Override
- public byte[] serialize(ILocalResource resource) throws HyracksDataException {
- ByteArrayOutputStream baos = null;
- ObjectOutputStream oosToBaos = null;
-
- try {
- baos = new ByteArrayOutputStream();
- oosToBaos = new ObjectOutputStream(baos);
- oosToBaos.writeLong(resource.getResourceId());
- oosToBaos.writeUTF(resource.getResourceName());
- oosToBaos.writeObject(resource.getResourceObject());
- return baos.toByteArray();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- } finally {
- if (oosToBaos != null) {
- try {
- oosToBaos.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
-
- if (oosToBaos == null && baos != null) {
- try {
- baos.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
- }
- }
-
- @Override
- public ILocalResource deserialize(byte[] bytes) throws HyracksDataException {
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- ObjectInputStream oisFromBais = null;
- try {
- oisFromBais = new ObjectInputStream(bais);
- return new IndexLocalResource(oisFromBais.readLong(), oisFromBais.readUTF(), oisFromBais.readObject(), this);
- } catch (Exception e) {
- throw new HyracksDataException(e);
- } finally {
- if (oisFromBais != null) {
- try {
- oisFromBais.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
- if (oisFromBais == null && bais != null) {
- try {
- bais.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
- }
- }
-
- public abstract int getResourceClassId();
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IIndexArtifactMap.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IIndexArtifactMap.java
deleted file mode 100644
index 428d11f..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IIndexArtifactMap.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.common.file;
-
-import java.io.IOException;
-import java.util.List;
-
-import edu.uci.ics.hyracks.api.io.IODeviceHandle;
-
-/**
- * IIndexArtifactMap provides interface to create an index artifact(that is a resourceId, but can be generalized to accommodate any artifact later) and retrieve it.
- *
- * @author kisskys
- */
-public interface IIndexArtifactMap {
- /**
- * Creates an artifact(resourceId) indicated by @param baseDir and @param ioDeviceHandles and return it.
- *
- * @param baseDir
- * @param ioDeviceHandles
- * @return a created artifact if it is created successfully.
- * @throws IOException
- * if the corresponding artifact already exists
- */
- public long create(String baseDir, List<IODeviceHandle> ioDeviceHandles) throws IOException;
-
- /**
- * Retrieves the artifact(resourceId) indicated by @param fullDir
- *
- * @param fullDir
- * @return the retrieved artifact if it exists, -1 otherwise.
- */
- public long get(String fullDir);
-
- /**
- * Deletes an artifact(resourceId) indicated by @param baseDir and @param ioDeviceHandles.
- *
- * @param fullDir
- */
- public void delete(String baseDir, List<IODeviceHandle> ioDeviceHandles);
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceClass.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceClass.java
deleted file mode 100644
index 369f5b9..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceClass.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.common.file;
-
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-
-public interface ILocalResourceClass {
-
- public static final int LSMBTree = 0;
- public static final int LSMRTree = 1;
- public static final int LSMInvertedIndex = 2;
-
- public byte[] serialize(ILocalResource resource) throws HyracksDataException;
-
- public ILocalResource deserialize(byte[] bytes) throws HyracksDataException;
-
- public int getResourceClassId();
-
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceFactory.java
similarity index 73%
copy from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
copy to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceFactory.java
index 16e249e..7fed1cf 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceFactory.java
@@ -14,14 +14,6 @@
*/
package edu.uci.ics.hyracks.storage.common.file;
-import java.io.Serializable;
-
-public interface ILocalResource extends Serializable {
- public long getResourceId();
-
- public String getResourceName();
-
- public Object getResourceObject();
-
- public ILocalResourceClass getResourceClass();
+public interface ILocalResourceFactory {
+ public LocalResource createLocalResource(long resourceId, String resourceName);
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceFactoryProvider.java
similarity index 76%
rename from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
rename to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceFactoryProvider.java
index 16e249e..fb6a210 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceFactoryProvider.java
@@ -16,12 +16,6 @@
import java.io.Serializable;
-public interface ILocalResource extends Serializable {
- public long getResourceId();
-
- public String getResourceName();
-
- public Object getResourceObject();
-
- public ILocalResourceClass getResourceClass();
+public interface ILocalResourceFactoryProvider extends Serializable {
+ public ILocalResourceFactory getLocalResourceFactory();
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceRepository.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceRepository.java
index 86e4188..2dce39e 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceRepository.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResourceRepository.java
@@ -20,16 +20,15 @@
public interface ILocalResourceRepository {
- public ILocalResource getResourceById(long id) throws HyracksDataException;
+ public LocalResource getResourceById(long id) throws HyracksDataException;
- public ILocalResource getResourceByName(String name) throws HyracksDataException;
+ public LocalResource getResourceByName(String name) throws HyracksDataException;
- public void insert(ILocalResource resource) throws HyracksDataException;
+ public void insert(LocalResource resource) throws HyracksDataException;
public void deleteResourceById(long id) throws HyracksDataException;
public void deleteResourceByName(String name) throws HyracksDataException;
- public List<ILocalResource> getAllResources() throws HyracksDataException;
-
+ public List<LocalResource> getAllResources() throws HyracksDataException;
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMBTreeLocalResourceClass.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMBTreeLocalResourceClass.java
deleted file mode 100644
index 7624e40..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMBTreeLocalResourceClass.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.common.file;
-
-public class LSMBTreeLocalResourceClass extends AbstractIndexLocalResourceClass {
- private static LSMBTreeLocalResourceClass instance = new LSMBTreeLocalResourceClass();
-
- public static LSMBTreeLocalResourceClass getInstance() {
- return instance;
- }
-
- @Override
- public int getResourceClassId() {
- return ILocalResourceClass.LSMBTree;
- }
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMInvertedIndexLocalResourceClass.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMInvertedIndexLocalResourceClass.java
deleted file mode 100644
index 866cac5..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMInvertedIndexLocalResourceClass.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.common.file;
-
-public class LSMInvertedIndexLocalResourceClass extends AbstractIndexLocalResourceClass {
- private static LSMInvertedIndexLocalResourceClass instance = new LSMInvertedIndexLocalResourceClass();
-
- public static LSMInvertedIndexLocalResourceClass getInstance() {
- return instance;
- }
-
- @Override
- public int getResourceClassId() {
- return ILocalResourceClass.LSMInvertedIndex;
- }
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMRTreeLocalResourceClass.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMRTreeLocalResourceClass.java
deleted file mode 100644
index e78f087..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LSMRTreeLocalResourceClass.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.common.file;
-
-public class LSMRTreeLocalResourceClass extends AbstractIndexLocalResourceClass {
- private static LSMRTreeLocalResourceClass instance = new LSMRTreeLocalResourceClass();
-
- public static LSMRTreeLocalResourceClass getInstance() {
- return instance;
- }
-
- @Override
- public int getResourceClassId() {
- return ILocalResourceClass.LSMRTree;
- }
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResource.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LocalResource.java
similarity index 70%
rename from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResource.java
rename to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LocalResource.java
index f5dfca8..3ef3ce7 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResource.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/LocalResource.java
@@ -14,37 +14,35 @@
*/
package edu.uci.ics.hyracks.storage.common.file;
-public class IndexLocalResource implements ILocalResource {
- private static final long serialVersionUID = -8638308062094620884L;
+import java.io.Serializable;
+
+public class LocalResource implements Serializable {
+ private static final long serialVersionUID = 1L;
private final long resourceId;
private final String resourceName;
+ private final int resourceType;
private final Object object;
- private final ILocalResourceClass resourceClass;
- public IndexLocalResource(long resourceId, String resourceName, Object object, ILocalResourceClass resourceClass) {
+ public LocalResource(long resourceId, String resourceName, int resourceType, Object object) {
this.resourceId = resourceId;
this.resourceName = resourceName;
this.object = object;
- this.resourceClass = resourceClass;
+ this.resourceType = resourceType;
}
- @Override
public long getResourceId() {
return resourceId;
}
- @Override
public String getResourceName() {
return resourceName;
}
- @Override
- public Object getResourceObject() {
- return object;
+ public int getResourceType() {
+ return resourceType;
}
- @Override
- public ILocalResourceClass getResourceClass() {
- return resourceClass;
+ public Object getResourceObject() {
+ return object;
}
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/NoOpLocalResourceFactoryProvider.java
similarity index 71%
copy from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
copy to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/NoOpLocalResourceFactoryProvider.java
index 16e249e..e69f4e7 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/NoOpLocalResourceFactoryProvider.java
@@ -14,14 +14,14 @@
*/
package edu.uci.ics.hyracks.storage.common.file;
-import java.io.Serializable;
+/**
+ * Dummy operation factory provider that does nothing.
+ */
+public enum NoOpLocalResourceFactoryProvider implements ILocalResourceFactoryProvider {
+ INSTANCE;
-public interface ILocalResource extends Serializable {
- public long getResourceId();
-
- public String getResourceName();
-
- public Object getResourceObject();
-
- public ILocalResourceClass getResourceClass();
+ @Override
+ public ILocalResourceFactory getLocalResourceFactory() {
+ return null;
+ }
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResourceRepository.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/PersistentLocalResourceRepository.java
similarity index 62%
rename from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResourceRepository.java
rename to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/PersistentLocalResourceRepository.java
index 9090aad..aac34de 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResourceRepository.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/PersistentLocalResourceRepository.java
@@ -14,7 +14,6 @@
*/
package edu.uci.ics.hyracks.storage.common.file;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -29,17 +28,14 @@
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-public class IndexLocalResourceRepository implements ILocalResourceRepository {
+public class PersistentLocalResourceRepository implements ILocalResourceRepository {
- private final List<ILocalResourceClass> resourceClasses;
private final List<String> mountPoints;
private static final String METADATA_FILE_NAME = ".metadata";
- private Map<String, ILocalResource> name2ResourceMap = new HashMap<String, ILocalResource>();
- private Map<Long, ILocalResource> id2ResourceMap = new HashMap<Long, ILocalResource>();
+ private Map<String, LocalResource> name2ResourceMap = new HashMap<String, LocalResource>();
+ private Map<Long, LocalResource> id2ResourceMap = new HashMap<Long, LocalResource>();
- public IndexLocalResourceRepository(List<ILocalResourceClass> resourceClasses, List<String> mountPoints,
- String rootDir) throws HyracksDataException {
- this.resourceClasses = resourceClasses;
+ public PersistentLocalResourceRepository(List<String> mountPoints, String rootDir) throws HyracksDataException {
this.mountPoints = mountPoints;
File rootFile = new File(this.mountPoints.get(0), rootDir);
@@ -62,7 +58,7 @@
if (childFile.isDirectory()) {
File[] targetFileList = childFile.listFiles(filter);
for (File targetFile : targetFileList) {
- ILocalResource localResource = readLocalResource(targetFile);
+ LocalResource localResource = readLocalResource(targetFile);
id2ResourceMap.put(localResource.getResourceId(), localResource);
name2ResourceMap.put(localResource.getResourceName(), localResource);
}
@@ -71,17 +67,17 @@
}
@Override
- public ILocalResource getResourceById(long id) throws HyracksDataException {
+ public LocalResource getResourceById(long id) throws HyracksDataException {
return id2ResourceMap.get(id);
}
@Override
- public ILocalResource getResourceByName(String name) throws HyracksDataException {
- return id2ResourceMap.get(name);
+ public LocalResource getResourceByName(String name) throws HyracksDataException {
+ return name2ResourceMap.get(name);
}
@Override
- public synchronized void insert(ILocalResource resource) throws HyracksDataException {
+ public synchronized void insert(LocalResource resource) throws HyracksDataException {
long id = resource.getResourceId();
if (id2ResourceMap.containsKey(id)) {
@@ -95,10 +91,7 @@
try {
fos = new FileOutputStream(getFileName(mountPoints.get(0), resource.getResourceName()));
oosToFos = new ObjectOutputStream(fos);
- byte[] outputBytes = resource.getResourceClass().serialize(resource);
- oosToFos.writeInt(resource.getResourceClass().getResourceClassId());
- oosToFos.writeInt(outputBytes.length);
- oosToFos.write(outputBytes);
+ oosToFos.writeObject(resource);
oosToFos.flush();
} catch (IOException e) {
throw new HyracksDataException(e);
@@ -122,7 +115,7 @@
@Override
public synchronized void deleteResourceById(long id) throws HyracksDataException {
- ILocalResource resource = id2ResourceMap.get(id);
+ LocalResource resource = id2ResourceMap.get(id);
if (resource == null) {
throw new HyracksDataException("Resource doesn't exist");
}
@@ -134,20 +127,20 @@
@Override
public synchronized void deleteResourceByName(String name) throws HyracksDataException {
- ILocalResource resource = id2ResourceMap.get(name);
+ LocalResource resource = name2ResourceMap.get(name);
if (resource == null) {
throw new HyracksDataException("Resource doesn't exist");
}
- id2ResourceMap.remove(name);
- name2ResourceMap.remove(resource.getResourceId());
+ id2ResourceMap.remove(resource.getResourceId());
+ name2ResourceMap.remove(name);
File file = new File(getFileName(mountPoints.get(0), resource.getResourceName()));
file.delete();
}
@Override
- public List<ILocalResource> getAllResources() throws HyracksDataException {
- List<ILocalResource> resources = new ArrayList<ILocalResource>();
- for (ILocalResource resource : id2ResourceMap.values()) {
+ public List<LocalResource> getAllResources() throws HyracksDataException {
+ List<LocalResource> resources = new ArrayList<LocalResource>();
+ for (LocalResource resource : id2ResourceMap.values()) {
resources.add(resource);
}
return resources;
@@ -165,34 +158,16 @@
return fileName;
}
- private ILocalResource readLocalResource(File file) throws HyracksDataException {
+ private LocalResource readLocalResource(File file) throws HyracksDataException {
FileInputStream fis = null;
ObjectInputStream oisFromFis = null;
- ByteArrayInputStream bais = null;
- ObjectInputStream oisFromBais = null;
- ILocalResource resource = null;
try {
fis = new FileInputStream(file);
oisFromFis = new ObjectInputStream(fis);
-
- int resourceClassId = oisFromFis.readInt();
- int inputLength = oisFromFis.readInt();
- byte[] inputBytes = new byte[inputLength];
- if (inputLength != oisFromFis.read(inputBytes)) {
- throw new HyracksDataException("Corrupted file");
- }
-
- bais = new ByteArrayInputStream(inputBytes);
- oisFromBais = new ObjectInputStream(bais);
- for (ILocalResourceClass resourceClass : resourceClasses) {
- if (resourceClass.getResourceClassId() == resourceClassId) {
- resource = resourceClass.deserialize(inputBytes);
- break;
- }
- }
+ LocalResource resource = (LocalResource) oisFromFis.readObject();
return resource;
- } catch (IOException e) {
+ } catch (Exception e) {
throw new HyracksDataException(e);
} finally {
if (oisFromFis != null) {
@@ -200,8 +175,6 @@
oisFromFis.close();
} catch (IOException e) {
throw new HyracksDataException(e);
- } finally {
- closeInputStream(oisFromBais, bais);
}
}
if (oisFromFis == null && fis != null) {
@@ -209,27 +182,8 @@
fis.close();
} catch (IOException e) {
throw new HyracksDataException(e);
- } finally {
- closeInputStream(oisFromBais, bais);
}
}
}
}
-
- private void closeInputStream(ObjectInputStream oisFromBais, ByteArrayInputStream bais) throws HyracksDataException {
- if (oisFromBais != null) {
- try {
- oisFromBais.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
- if (oisFromBais == null && bais != null) {
- try {
- bais.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
- }
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResourceRepositoryFactory.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/PersistentLocalResourceRepositoryFactory.java
similarity index 70%
rename from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResourceRepositoryFactory.java
rename to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/PersistentLocalResourceRepositoryFactory.java
index 4707361..a2d0fa3 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/IndexLocalResourceRepositoryFactory.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/PersistentLocalResourceRepositoryFactory.java
@@ -21,26 +21,22 @@
import edu.uci.ics.hyracks.api.io.IIOManager;
import edu.uci.ics.hyracks.api.io.IODeviceHandle;
-public class IndexLocalResourceRepositoryFactory implements ILocalResourceRepositoryFactory {
+public class PersistentLocalResourceRepositoryFactory implements ILocalResourceRepositoryFactory {
private static final String rootDir = "";
private IIOManager ioManager;
-
- public IndexLocalResourceRepositoryFactory(IIOManager ioManager) {
+
+ public PersistentLocalResourceRepositoryFactory(IIOManager ioManager) {
this.ioManager = ioManager;
}
-
+
@Override
public ILocalResourceRepository createRepository() throws HyracksDataException {
- List<ILocalResourceClass> resourceClasses = new ArrayList<ILocalResourceClass>();
- resourceClasses.add(LSMBTreeLocalResourceClass.getInstance());
- resourceClasses.add(LSMRTreeLocalResourceClass.getInstance());
- resourceClasses.add(LSMInvertedIndexLocalResourceClass.getInstance());
-
List<String> mountPoints = new ArrayList<String>();
List<IODeviceHandle> devices = ioManager.getIODevices();
+
for (IODeviceHandle dev : devices) {
mountPoints.add(dev.getPath().getPath());
}
- return new IndexLocalResourceRepository(resourceClasses, mountPoints, rootDir);
+ return new PersistentLocalResourceRepository(mountPoints, rootDir);
}
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactoryFactory.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactoryFactory.java
deleted file mode 100644
index 296dea6..0000000
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactoryFactory.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package edu.uci.ics.hyracks.storage.common.file;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-
-public class ResourceIdFactoryFactory {
- private ILocalResourceRepository localResourceRepository;
-
- public ResourceIdFactoryFactory(ILocalResourceRepository localResourceRepository) {
- this.localResourceRepository = localResourceRepository;
- }
-
- public ResourceIdFactory createResourceIdFactory() throws HyracksDataException {
- List<ILocalResource> localResources = localResourceRepository.getAllResources();
- long largestResourceId = 0;
- for (ILocalResource localResource : localResources) {
- if (largestResourceId < localResource.getResourceId()) {
- largestResourceId = localResource.getResourceId();
- }
- }
- return new ResourceIdFactory(largestResourceId);
- }
-}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactoryProvider.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactoryProvider.java
new file mode 100644
index 0000000..62cdb36
--- /dev/null
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactoryProvider.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * 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 from
+ *
+ * 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 edu.uci.ics.hyracks.storage.common.file;
+
+import java.util.List;
+
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class ResourceIdFactoryProvider {
+ private ILocalResourceRepository localResourceRepository;
+
+ public ResourceIdFactoryProvider(ILocalResourceRepository localResourceRepository) {
+ this.localResourceRepository = localResourceRepository;
+ }
+
+ public ResourceIdFactory createResourceIdFactory() throws HyracksDataException {
+ List<LocalResource> localResources = localResourceRepository.getAllResources();
+ long largestResourceId = 0;
+ for (LocalResource localResource : localResources) {
+ if (largestResourceId < localResource.getResourceId()) {
+ largestResourceId = localResource.getResourceId();
+ }
+ }
+ return new ResourceIdFactory(largestResourceId);
+ }
+}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceFactory.java
similarity index 67%
copy from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
copy to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceFactory.java
index 16e249e..5d4bbbd 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceFactory.java
@@ -14,14 +14,12 @@
*/
package edu.uci.ics.hyracks.storage.common.file;
-import java.io.Serializable;
+public class TransientLocalResourceFactory implements ILocalResourceFactory {
-public interface ILocalResource extends Serializable {
- public long getResourceId();
-
- public String getResourceName();
-
- public Object getResourceObject();
-
- public ILocalResourceClass getResourceClass();
+ public static final int TransientResource = 0;
+
+ @Override
+ public LocalResource createLocalResource(long resourceId, String resourceName) {
+ return new LocalResource(resourceId, resourceName, TransientResource, null);
+ }
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceFactoryProvider.java
similarity index 70%
copy from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
copy to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceFactoryProvider.java
index 16e249e..d9a51a3 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceFactoryProvider.java
@@ -14,14 +14,12 @@
*/
package edu.uci.ics.hyracks.storage.common.file;
-import java.io.Serializable;
+public class TransientLocalResourceFactoryProvider implements ILocalResourceFactoryProvider {
+
+ private static final long serialVersionUID = 1L;
-public interface ILocalResource extends Serializable {
- public long getResourceId();
-
- public String getResourceName();
-
- public Object getResourceObject();
-
- public ILocalResourceClass getResourceClass();
+ @Override
+ public ILocalResourceFactory getLocalResourceFactory() {
+ return new TransientLocalResourceFactory();
+ }
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceRepository.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceRepository.java
new file mode 100644
index 0000000..55bd807
--- /dev/null
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceRepository.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * 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 from
+ *
+ * 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 edu.uci.ics.hyracks.storage.common.file;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
+public class TransientLocalResourceRepository implements ILocalResourceRepository {
+
+ private Map<String, LocalResource> name2ResourceMap = new HashMap<String, LocalResource>();
+ private Map<Long, LocalResource> id2ResourceMap = new HashMap<Long, LocalResource>();
+
+ @Override
+ public LocalResource getResourceById(long id) throws HyracksDataException {
+ return id2ResourceMap.get(id);
+ }
+
+ @Override
+ public LocalResource getResourceByName(String name) throws HyracksDataException {
+ return name2ResourceMap.get(name);
+ }
+
+ @Override
+ public synchronized void insert(LocalResource resource) throws HyracksDataException {
+ long id = resource.getResourceId();
+
+ if (id2ResourceMap.containsKey(id)) {
+ throw new HyracksDataException("Duplicate resource");
+ }
+ id2ResourceMap.put(id, resource);
+ name2ResourceMap.put(resource.getResourceName(), resource);
+ }
+
+ @Override
+ public synchronized void deleteResourceById(long id) throws HyracksDataException {
+ LocalResource resource = id2ResourceMap.get(id);
+ if (resource == null) {
+ throw new HyracksDataException("Resource doesn't exist");
+ }
+ id2ResourceMap.remove(id);
+ name2ResourceMap.remove(resource.getResourceName());
+ }
+
+ @Override
+ public synchronized void deleteResourceByName(String name) throws HyracksDataException {
+ LocalResource resource = name2ResourceMap.get(name);
+ if (resource == null) {
+ throw new HyracksDataException("Resource doesn't exist");
+ }
+ id2ResourceMap.remove(resource.getResourceId());
+ name2ResourceMap.remove(name);
+ }
+
+ @Override
+ public List<LocalResource> getAllResources() throws HyracksDataException {
+ List<LocalResource> resources = new ArrayList<LocalResource>();
+ for (LocalResource resource : id2ResourceMap.values()) {
+ resources.add(resource);
+ }
+ return resources;
+ }
+}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceRepositoryFactory.java
similarity index 68%
copy from hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
copy to hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceRepositoryFactory.java
index 16e249e..a6b00a4 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ILocalResource.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/TransientLocalResourceRepositoryFactory.java
@@ -14,14 +14,12 @@
*/
package edu.uci.ics.hyracks.storage.common.file;
-import java.io.Serializable;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-public interface ILocalResource extends Serializable {
- public long getResourceId();
+public class TransientLocalResourceRepositoryFactory implements ILocalResourceRepositoryFactory {
- public String getResourceName();
-
- public Object getResourceObject();
-
- public ILocalResourceClass getResourceClass();
+ @Override
+ public ILocalResourceRepository createRepository() throws HyracksDataException {
+ return new TransientLocalResourceRepository();
+ }
}
diff --git a/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerComponentHolder.java b/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerComponentHolder.java
index 791eb84..b704bf5 100644
--- a/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerComponentHolder.java
+++ b/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerComponentHolder.java
@@ -35,8 +35,10 @@
import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepositoryFactory;
-import edu.uci.ics.hyracks.storage.common.file.IndexLocalResourceRepositoryFactory;
+import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
+import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactoryProvider;
import edu.uci.ics.hyracks.storage.common.file.TransientFileMapManager;
+import edu.uci.ics.hyracks.storage.common.file.TransientLocalResourceRepositoryFactory;
public class TestStorageManagerComponentHolder {
private static IBufferCache bufferCache;
@@ -44,6 +46,7 @@
private static IOManager ioManager;
private static ILocalResourceRepository localResourceRepository;
private static IIndexLifecycleManager lcManager;
+ private static ResourceIdFactory resourceIdFactory;
private static int pageSize;
private static int numPages;
@@ -96,9 +99,8 @@
public synchronized static ILocalResourceRepository getLocalResourceRepository(IHyracksTaskContext ctx) {
if (localResourceRepository == null) {
try {
- ILocalResourceRepositoryFactory indexLocalResourceRepositoryFactory = new IndexLocalResourceRepositoryFactory(
- getIOManager());
- localResourceRepository = indexLocalResourceRepositoryFactory.createRepository();
+ ILocalResourceRepositoryFactory localResourceRepositoryFactory = new TransientLocalResourceRepositoryFactory();
+ localResourceRepository = localResourceRepositoryFactory.createRepository();
} catch (HyracksException e) {
//In order not to change the IStorageManagerInterface due to the test code, throw runtime exception.
throw new IllegalArgumentException();
@@ -106,4 +108,18 @@
}
return localResourceRepository;
}
+
+ public synchronized static ResourceIdFactory getResourceIdFactory(IHyracksTaskContext ctx) {
+ if (resourceIdFactory == null) {
+ try {
+ ResourceIdFactoryProvider resourceIdFactoryFactory = new ResourceIdFactoryProvider(
+ getLocalResourceRepository(ctx));
+ resourceIdFactory = resourceIdFactoryFactory.createResourceIdFactory();
+ } catch (HyracksException e) {
+ //In order not to change the IStorageManagerInterface due to the test code, throw runtime exception.
+ throw new IllegalArgumentException();
+ }
+ }
+ return resourceIdFactory;
+ }
}
\ No newline at end of file
diff --git a/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerInterface.java b/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerInterface.java
index a01ac97..26c7861 100644
--- a/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerInterface.java
+++ b/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/test/support/TestStorageManagerInterface.java
@@ -20,6 +20,7 @@
import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
+import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
public class TestStorageManagerInterface implements IStorageManagerInterface {
private static final long serialVersionUID = 1L;
@@ -38,4 +39,9 @@
public ILocalResourceRepository getLocalResourceRepository(IHyracksTaskContext ctx) {
return TestStorageManagerComponentHolder.getLocalResourceRepository(ctx);
}
+
+ @Override
+ public ResourceIdFactory getResourceIdFactory(IHyracksTaskContext ctx) {
+ return TestStorageManagerComponentHolder.getResourceIdFactory(ctx);
+ }
}
\ No newline at end of file