continuing implementing the local resource repository
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1929 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 b37368e..94537bf 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
@@ -33,6 +33,8 @@
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.TransientFileMapManager;
public class RuntimeContext {
@@ -40,6 +42,7 @@
private IFileMapManager fileMapManager;
private ILocalResourceRepository localResourceRepository;
private IIndexLifecycleManager lcManager;
+ private ResourceIdFactory resourceIdFactory;
public RuntimeContext(INCApplicationContext appCtx) throws HyracksDataException {
fileMapManager = new TransientFileMapManager();
@@ -49,6 +52,7 @@
50, 100);
ILocalResourceRepositoryFactory indexLocalResourceRepositoryFactory = new IndexLocalResourceRepositoryFactory(appCtx.getRootContext().getIOManager());
localResourceRepository = indexLocalResourceRepositoryFactory.createRepository();
+ resourceIdFactory = (new ResourceIdFactoryFactory(localResourceRepository)).createResourceIdFactory();
lcManager = new IndexLifecycleManager();
}
@@ -72,6 +76,10 @@
return localResourceRepository;
}
+ public ResourceIdFactory getResourceIdFactory() {
+ return resourceIdFactory;
+ }
+
public IIndexLifecycleManager getIndexLifecycleManager() {
return lcManager;
}
diff --git a/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/StorageManagerInterface.java b/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/StorageManagerInterface.java
index 953f7c1..e19847e 100644
--- a/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/StorageManagerInterface.java
+++ b/hyracks-examples/btree-example/btreehelper/src/main/java/edu/uci/ics/hyracks/examples/btree/helper/StorageManagerInterface.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 StorageManagerInterface implements IStorageManagerInterface {
private static final long serialVersionUID = 1L;
@@ -38,9 +39,14 @@
public IFileMapProvider getFileMapProvider(IHyracksTaskContext ctx) {
return RuntimeContext.get(ctx).getFileMapManager();
}
-
+
@Override
public ILocalResourceRepository getLocalResourceRepository(IHyracksTaskContext ctx) {
return RuntimeContext.get(ctx).getLocalResourceRepository();
}
+
+ @Override
+ public ResourceIdFactory getResourceIdFactory(IHyracksTaskContext ctx) {
+ return RuntimeContext.get(ctx).getResourceIdFactory();
+ }
}
\ No newline at end of file
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 3cdba2f..1cc6179 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
@@ -25,7 +25,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
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.LSMBTreeLocalResourceClass;
+import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
public abstract class IndexDataflowHelper implements IIndexDataflowHelper {
@@ -33,6 +33,7 @@
protected final IHyracksTaskContext ctx;
protected final IIndexLifecycleManager lcManager;
protected final ILocalResourceRepository localResourceRepository;
+ protected final ResourceIdFactory resourceIdFactory;
protected final FileReference file;
protected IIndex index;
@@ -42,6 +43,7 @@
this.ctx = ctx;
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();
}
@@ -69,8 +71,9 @@
}
index.create();
try {
- //TODO Create ResourceIdFactory and LocalResourceFactory
- localResourceRepository.insert(new IndexLocalResource(resourceID, file.getFile().getPath(), object, resourceClass));
+ //TODO Create LocalResource through LocalResourceFactory interface
+ resourceID = resourceIdFactory.createId();
+ localResourceRepository.insert(new IndexLocalResource(resourceID, file.getFile().getPath(), null, null));
} catch (IOException e) {
throw new HyracksDataException(e);
}
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/IStorageManagerInterface.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/IStorageManagerInterface.java
index 9e3616a..5759218 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/IStorageManagerInterface.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/IStorageManagerInterface.java
@@ -19,13 +19,15 @@
import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
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.IIndexArtifactMap;
import edu.uci.ics.hyracks.storage.common.file.ILocalResourceRepository;
+import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
public interface IStorageManagerInterface extends Serializable {
- public IBufferCache getBufferCache(IHyracksTaskContext ctx);
+ public IBufferCache getBufferCache(IHyracksTaskContext ctx);
- public IFileMapProvider getFileMapProvider(IHyracksTaskContext ctx);
+ public IFileMapProvider getFileMapProvider(IHyracksTaskContext ctx);
- public ILocalResourceRepository getLocalResourceRepository(IHyracksTaskContext ctx);
+ public ILocalResourceRepository getLocalResourceRepository(IHyracksTaskContext ctx);
+
+ public ResourceIdFactory getResourceIdFactory(IHyracksTaskContext ctx);
}
\ No newline at end of file