You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by ap...@apache.org on 2006/02/04 09:45:04 UTC
svn commit: r374847 -
/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
Author: apopescu
Date: Sat Feb 4 01:45:01 2006
New Revision: 374847
URL: http://svn.apache.org/viewcvs?rev=374847&view=rev
Log:
- getParentName, getNodeName are throwing JcrMappingException (not PersistenceException)
- added comment to clarify that this utility class is mainly working only with Jackrabbit
- formattings
Modified:
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java?rev=374847&r1=374846&r2=374847&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java Sat Feb 4 01:45:01 2006
@@ -28,11 +28,13 @@
import org.apache.jackrabbit.core.jndi.RegistryHelper;
import org.apache.jackrabbit.util.ISO9075;
import org.apache.jackrabbit.util.Text;
+import org.apache.portals.graffito.jcr.exception.JcrMappingException;
import org.apache.portals.graffito.jcr.exception.PersistenceException;
import org.apache.portals.graffito.jcr.exception.RepositoryException;
/**
* Utility class for managing JCR repositories.
+* <b>Note</b>: most of the utility methods in this class can be used only with Jackrabbit.
*
* @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
* @version $Id: Exp $
@@ -69,8 +71,7 @@
env.put(Context.PROVIDER_URL, "localhost");
InitialContext ctx = new InitialContext(env);
- RegistryHelper.registerRepository(ctx, repositoryName, configFile, homeDir, true);
-
+ RegistryHelper.registerRepository(ctx, repositoryName, configFile, homeDir, true);
}
catch (Exception e)
{
@@ -92,15 +93,12 @@
{
try
{
-
-
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
InitialContext ctx = new InitialContext(env);
- RegistryHelper.unregisterRepository(ctx, repositoryName);
-
+ RegistryHelper.unregisterRepository(ctx, repositoryName);
}
catch (Exception e)
{
@@ -155,7 +153,6 @@
setupSession(session);
return session;
-
}
catch (Exception e)
{
@@ -195,7 +192,7 @@
if (!isValidPath(path))
{
- throw new PersistenceException("Invalid path : " + path);
+ throw new JcrMappingException("Invalid path : " + path);
}
String[] pathElements = path.split(PATH_SEPARATOR);
@@ -232,7 +229,7 @@
if (! isValidPath(path))
{
- throw new PersistenceException("Invalid path : " + path);
+ throw new JcrMappingException("Invalid path : " + path);
}
return pathElements[pathElements.length-1];
}
@@ -293,8 +290,5 @@
pathElements[i] = ISO9075.encode(pathElements[i]);
}
return "/" + Text.implode(pathElements, "/");
-
}
-
-
}