adding missing files
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1930 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactory.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactory.java
new file mode 100644
index 0000000..d4ec01f
--- /dev/null
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactory.java
@@ -0,0 +1,29 @@
+/*
+ * 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.concurrent.atomic.AtomicLong;
+
+public class ResourceIdFactory {
+ private AtomicLong id = null;
+
+ public ResourceIdFactory(long initialValue) {
+ id = new AtomicLong(initialValue);
+ }
+
+ public long createId() {
+ return id.getAndIncrement();
+ }
+}
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
new file mode 100644
index 0000000..296dea6
--- /dev/null
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/file/ResourceIdFactoryFactory.java
@@ -0,0 +1,24 @@
+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);
+ }
+}