Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2009-04-07 12:51:58 -0400
committerEike Stepper2009-04-07 12:51:58 -0400
commit97e2d634631fd05d91a17c599427797aaa8207cf (patch)
treee428e51306b4a1c19f537ba34839ee0eb34c562b /plugins/org.eclipse.emf.cdo
parentc4077c1d6d249fffff6dc5836eeb648222fd6986 (diff)
downloadcdo-97e2d634631fd05d91a17c599427797aaa8207cf.tar.gz
cdo-97e2d634631fd05d91a17c599427797aaa8207cf.tar.xz
cdo-97e2d634631fd05d91a17c599427797aaa8207cf.zip
[271480] Add getResourceNode(String path) to CDOView
https://bugs.eclipse.org/bugs/show_bug.cgi?id=271480
Diffstat (limited to 'plugins/org.eclipse.emf.cdo')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java37
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java2
5 files changed, 40 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java
index 8f97dbbeff..31fabe26cc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java
@@ -280,7 +280,7 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe
{
try
{
- cdoView().getResourceID(newPath);
+ cdoView().getResourceNodeID(newPath);
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java
index 8bc1d2a51a..f43e9f4bf3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java
@@ -178,14 +178,21 @@ public interface CDOView extends CDOCommonView, INotifier, IOptionsContainer
/**
* @see ResourceSet#getResource(URI, boolean)
*/
- public CDOResource getResource(String path, boolean loadInDemand);
+ public CDOResource getResource(String path, boolean loadOnDemand);
/**
+ * Same as {@link #getResource(String, boolean) getResource(String, true)}.
+ *
* @see ResourceSet#getResource(URI, boolean)
*/
public CDOResource getResource(String path);
/**
+ * Returns the resource node with the given path, or <code>null</code> if no such resource node exists.
+ */
+ public CDOResourceNode getResourceNode(String path);
+
+ /**
* Returns the root resource of the repository.
* <p>
* The root resource is a special resource with only {@link CDOResourceNode CDOResourceNodes} in its contents list.
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index b30eaeef71..0a6ba100f6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -319,7 +319,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
try
{
- CDOID id = getResourceID(path);
+ CDOID id = getResourceNodeID(path);
if (!CDOIDUtil.isNull(id))
{
return (CDOResource)getObject(id);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
index 1e6500c56b..8dd5764dc2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
@@ -360,7 +360,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
try
{
- getResourceID(path);
+ getResourceNodeID(path);
return true;
}
catch (Exception ex)
@@ -379,10 +379,30 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
}
/**
+ * @since 2.0
+ */
+ public CDOResourceNode getResourceNode(String path)
+ {
+ CDOID id = getResourceNodeID(path);
+ if (id == null)
+ {
+ return null;
+ }
+
+ InternalCDOObject object = getObject(id);
+ if (object instanceof CDOResourceNode)
+ {
+ return (CDOResourceNode)object;
+ }
+
+ return null;
+ }
+
+ /**
* @return never <code>null</code>
* @since 2.0
*/
- public CDOID getResourceID(String path)
+ public CDOID getResourceNodeID(String path)
{
if (StringUtil.isEmpty(path))
{
@@ -392,14 +412,14 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
CDOID folderID = null;
if (CDOURIUtil.SEGMENT_SEPARATOR.equals(path))
{
- folderID = getResourceID(null, null);
+ folderID = getResourceNodeIDChecked(null, null);
}
else
{
List<String> names = CDOURIUtil.analyzePath(path);
for (String name : names)
{
- folderID = getResourceID(folderID, name);
+ folderID = getResourceNodeIDChecked(folderID, name);
}
}
@@ -407,9 +427,9 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
}
/**
- * @retrn never <code>null</code>
+ * @return never <code>null</code>
*/
- private CDOID getResourceID(CDOID folderID, String name)
+ private CDOID getResourceNodeIDChecked(CDOID folderID, String name)
{
folderID = getResourceNodeID(folderID, name);
if (folderID == null)
@@ -450,7 +470,8 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
{
return getRootOrTopLevelResourceNodeID(name);
}
- else if (name == null)
+
+ if (name == null)
{
throw new IllegalArgumentException("name");
}
@@ -987,7 +1008,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
try
{
- CDOID id = getResourceID(path);
+ CDOID id = getResourceNodeID(path);
resource.cdoInternalSetID(id);
registerObject(resource);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
index c7be2b5b70..483246cb4f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
@@ -70,7 +70,7 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle.Intr
public void remapObject(CDOID oldID);
- public CDOID getResourceID(String path);
+ public CDOID getResourceNodeID(String path);
public void registerProxyResource(CDOResourceImpl resource);

Back to the top