Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-10-15 13:32:53 -0400
committerEike Stepper2008-10-15 13:32:53 -0400
commit07b478539f5325a3693c546cdfeef0eedcf83d5e (patch)
tree3462092c72310ad71ac59b1e51be433bdecabfda
parent97a688384659fba5aa0d52f3e74ae0c59744aaf7 (diff)
downloadcdo-07b478539f5325a3693c546cdfeef0eedcf83d5e.tar.gz
cdo-07b478539f5325a3693c546cdfeef0eedcf83d5e.tar.xz
cdo-07b478539f5325a3693c546cdfeef0eedcf83d5e.zip
[249847] Store resources in a hierarchical structure
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249847
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java108
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java8
3 files changed, 35 insertions, 86 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
index e6b45fb4ac..9b07af70e8 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
@@ -11,13 +11,11 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.hibernate;
-import org.eclipse.emf.cdo.common.CDOProtocolView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.model.CDOPackage;
import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
import org.eclipse.emf.cdo.common.query.CDOQueryInfo;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.IQueryContext;
@@ -25,19 +23,12 @@ import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.hibernate.IHibernateStoreReader;
-import org.eclipse.emf.cdo.server.hibernate.id.CDOIDHibernate;
import org.eclipse.emf.cdo.server.internal.hibernate.bundle.OM;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.hibernate.Criteria;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.criterion.Expression;
-
import java.util.Collection;
-import java.util.List;
/**
* @author Eike Stepper
@@ -91,76 +82,39 @@ public class HibernateStoreReader extends HibernateStoreAccessor implements IHib
return getStore().getPackageHandler().getCDOPackageInfos();
}
- public CDOID readResourceID(String path, long timeStamp)
+ public CDOID readResourceID(CDOID folderID, String name, long timeStamp)
{
- if (timeStamp != CDOProtocolView.UNSPECIFIED_DATE)
- {
- throw new UnsupportedOperationException();
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace("Finding resourceid using path " + path);
- }
-
- Session session = getHibernateSession();
- Criteria criteria = session.createCriteria(CDOResourceClass.NAME);
- criteria.add(Expression.eq("path", path));
- List<?> result = criteria.list();
- if (result.size() == 0)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Resource not found");
- }
-
- // TODO: throw exception?
- return null;
- }
-
- // TODO: throw exception if list.size() > 1?
- CDORevision cdoRevision = (CDORevision)result.get(0);
- return cdoRevision.getID();
- }
-
- /**
- * TODO Remove me
- */
- @Deprecated
- public String readResourcePath(CDOID id)
- {
- if (id == null)
- {
- throw new IllegalArgumentException("ID must be not null");
- }
-
- if (!(id instanceof CDOIDHibernate))
- {
- throw new IllegalArgumentException("ID type " + id.getClass().getName() + " not supported by hibernate reader");
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace("Finding resource using id " + id);
- }
-
- Session session = getHibernateSession();
- Query qry = session.createQuery("select path from " + CDOResourceClass.NAME + " where id=:id");
- CDOIDHibernate idHibernate = (CDOIDHibernate)id;
- qry.setParameter("id", idHibernate.getId());
- final List<?> result = qry.list();
- if (result.size() == 0)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Resource not found");
- }
-
- // TODO: throw exception?
- return null;
- }
+ // TODO: implement HibernateStoreReader.readResourceID(folderID, name, timeStamp)
+ throw new UnsupportedOperationException();
- return (String)result.get(0);
+ // if (timeStamp != CDOProtocolView.UNSPECIFIED_DATE)
+ // {
+ // throw new UnsupportedOperationException();
+ // }
+ //
+ // if (TRACER.isEnabled())
+ // {
+ // TRACER.trace("Finding resourceid using path " + path);
+ // }
+ //
+ // Session session = getHibernateSession();
+ // Criteria criteria = session.createCriteria(CDOResourceClass.NAME);
+ // criteria.add(Expression.eq("path", path));
+ // List<?> result = criteria.list();
+ // if (result.size() == 0)
+ // {
+ // if (TRACER.isEnabled())
+ // {
+ // TRACER.trace("Resource not found");
+ // }
+ //
+ // // TODO: throw exception?
+ // return null;
+ // }
+ //
+ // // TODO: throw exception if list.size() > 1?
+ // CDORevision cdoRevision = (CDORevision)result.get(0);
+ // return cdoRevision.getID();
}
public CDORevision readRevision(CDOID id, int referenceChunk)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
index 1b10f83f72..c571a7666c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
@@ -196,11 +196,6 @@ public class MEMStore extends LongIDStore implements IMEMStore
return getRepository().getPackageManager().getCDOResourcePackage().getCDOResourceNodeClass();
}
- private CDOFeature getResourceFolderFeature()
- {
- return getResourceNodeClass().getCDOFolderFeature();
- }
-
private CDOFeature getResourceNameFeature()
{
return getResourceNodeClass().getCDONameFeature();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java
index d935ae2947..e3eb09923e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java
@@ -64,9 +64,9 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
}
/**
- * <!-- begin-user-doc --> TODO Simon: Can you remember why this is generated NOT? <!-- end-user-doc -->
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated NOT
+ * @generated
*/
@Override
public EObject create(EClass eClass)
@@ -142,7 +142,7 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated NOT
+ * @generated
*/
public URI createURIFromString(EDataType eDataType, String initialValue)
{
@@ -152,7 +152,7 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated NOT
+ * @generated
*/
public String convertURIToString(EDataType eDataType, Object instanceValue)
{

Back to the top