From e9f6c7d5bceb28906b1f75ea370e731a0025c6aa Mon Sep 17 00:00:00 2001
From: Alexandru Popescu
Date: Sat, 4 Feb 2006 09:39:11 +0000
Subject: [PATCH 001/386] - renamed methods for better reporting - added
failure in case of no user transaction
git-svn-id: https://svn.apache.org/repos/asf/incubator/graffito/trunk/jcr/jcr-mapping@374845 13f79535-47bb-0310-9956-ffa450edef68
---
.../graffito/jcr/repository/RepositoryUtilTest.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java b/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java
index 2a3a8d82..51daabb2 100644
--- a/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java
+++ b/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java
@@ -79,7 +79,7 @@ public static Test suite()
* Test for getRepository() and login
*
*/
- public void testgetRegistryAndLogin()
+ public void testRegistryAndLogin()
{
try
{
@@ -102,7 +102,7 @@ public void testgetRegistryAndLogin()
* Simple unit test to check if custome node types are well defined
*
*/
- public void testgetCustomNodeType()
+ public void testCustomNodeType()
{
try
{
@@ -128,7 +128,7 @@ public void testgetCustomNodeType()
* Test for getParentPath()
*
*/
- public void testgetParentPath()
+ public void testGetParentPath()
{
try
{
@@ -152,7 +152,7 @@ public void testgetParentPath()
* Test for getNodeName()
*
*/
- public void testgetNodeName()
+ public void testGetNodeName()
{
try
{
@@ -225,7 +225,8 @@ public void testUserTransaction()
}
catch (Exception e)
{
-
+ e.printStackTrace();
+ fail("Unable to run user transaction : " + e);
}
}
From eac3c129aaf1996e2b1ec531de5008703f43684c Mon Sep 17 00:00:00 2001
From: Alexandru Popescu
Date: Sat, 4 Feb 2006 09:45:01 +0000
Subject: [PATCH 002/386] - getParentName, getNodeName are throwing
JcrMappingException (not PersistenceException) - added comment to clarify
that this utility class is mainly working only with Jackrabbit - formattings
git-svn-id: https://svn.apache.org/repos/asf/incubator/graffito/trunk/jcr/jcr-mapping@374847 13f79535-47bb-0310-9956-ffa450edef68
---
.../jcr/repository/RepositoryUtil.java | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java b/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
index 895c60a6..1dab28ab 100644
--- a/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
+++ b/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
@@ -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.
+* Note: most of the utility methods in this class can be used only with Jackrabbit.
*
* @author Lombart Christophe
* @version $Id: Exp $
@@ -69,8 +71,7 @@ public static void registerRepository(String repositoryName, String configFile,
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 @@ public static void unRegisterRepository(String repositoryName) throws Repository
{
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 @@ public static Session login(Repository repository, String user, String password)
setupSession(session);
return session;
-
}
catch (Exception e)
{
@@ -195,7 +192,7 @@ public static String getParentPath(String path) throws PersistenceException
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 @@ public static String getNodeName(String path) throws PersistenceException
if (! isValidPath(path))
{
- throw new PersistenceException("Invalid path : " + path);
+ throw new JcrMappingException("Invalid path : " + path);
}
return pathElements[pathElements.length-1];
}
@@ -293,8 +290,5 @@ public static String encodePath(String path)
pathElements[i] = ISO9075.encode(pathElements[i]);
}
return "/" + Text.implode(pathElements, "/");
-
}
-
-
}
From 5824ab90b56f319ba5fdbb44ea7c819205ef59bf Mon Sep 17 00:00:00 2001
From: Christophe Lombart
Date: Sun, 5 Feb 2006 22:38:38 +0000
Subject: [PATCH 003/386] Still working on the documentation
git-svn-id: https://svn.apache.org/repos/asf/incubator/graffito/trunk/jcr/jcr-mapping@375122 13f79535-47bb-0310-9956-ffa450edef68
---
xdocs/atomic-strategy.xml | 71 ++++++++++++++++++++++++++-----
xdocs/bean-strategy.xml | 41 +++++++++++++++++-
xdocs/engine-introduction.xml | 9 ++--
xdocs/index.xml | 6 +--
xdocs/introduction-strategies.xml | 23 +++++-----
xdocs/navigation.xml | 2 +-
6 files changed, 121 insertions(+), 31 deletions(-)
diff --git a/xdocs/atomic-strategy.xml b/xdocs/atomic-strategy.xml
index 92ff024c..0f593319 100644
--- a/xdocs/atomic-strategy.xml
+++ b/xdocs/atomic-strategy.xml
@@ -24,21 +24,72 @@ limitations under the License.
-
The field-descriptor maps a bean attribute into one JCR property. it can map any kind of atomic types (java primitive data types and their wrapper classes)
-
Based on our model defined here, the following field-descriptor is used to map the bean field "title" into the JCR property "graffito:title".
-
+
The field-descriptor maps a bean attribute into one JCR property. it can map any kind of atomic types (java primitive data types and their wrapper classes).
+
Based on our model defined here, the following field-descriptor can be used in the class 'PageInfo' to map the bean field "title" (String type) into the JCR property "graffito:title".
+
+
+ .... other descriptors ....
+
]]>
+
It is not necessary to specify the type in the field-descriptor. The Persistence Manager uses the java introspection to get information on the each atomic field.
+
+
+
+
Java Type
+
Jcr Type
+
+
+
String
+
STRING
+
+
+
Boolean, boolean
+
BOOLEAN
+
+
+
Double, double
+
DOUBLE
+
+
+
Integer, int
+
DOUBLE
+
+
+
Long, long
+
LONG
+
+
+
byte[]
+
BINARY
+
+
+
+
java.io.InputStream
+
BINALRY
+
+
+
+
java.util.Calendar
+
LONG (corresponding to Calendar.getTimeInMillis()
+
+
+
+
java.sql.Timestamp
+
LONG (corresponding to Timestamp.getTime()
+
+
+
java.util.Date
+
LONG (corresponding to java.util.Date.getTime()
+
+
+
- [TO DO]
-
-
-
-
- [TO DO]
+ Due to some issues with Jackrabbit, Calendar, Timestamp and date are converted into JCR LONG.
+ We plan to add other converters for those types in the next release. We plan also to support other java types (char, ...)
diff --git a/xdocs/bean-strategy.xml b/xdocs/bean-strategy.xml
index 3a07844e..cd9dfb78 100644
--- a/xdocs/bean-strategy.xml
+++ b/xdocs/bean-strategy.xml
@@ -23,8 +23,47 @@ limitations under the License.
- TODO
+
+
The bean-descriptor maps a bean attribute into one JCR node. Generally, this bean attribute is a also a bean.
+
Based on our model defined here, the following bean-descriptor is used to map the bean field "pageInfo" (PageInfo class) into the JCR node called "pageInfo".
+
+
+
+
+
+
+
+
+
+
+
+
+ ]]>
+
+
In this example, the PageInfo class has a corresponding class-descriptor in the mapping file.
+ By this way, the Persistence Manager can map each PageInfo attributes.
+ It is not necessary to specify the type in the bean-descriptor. The Persistence Manager uses the java introspection to get information on the each bean fields.
+
+
+
+
+
+ Following our example, the resulting JCR structure can be :
+
+
+
+
+
Creating a subnode like this example (mysite/page1/pageInfo) is the default behaviour. See the section Reviewing the bean-descriptor to get other bean-field mapping strategies.
+
+
diff --git a/xdocs/engine-introduction.xml b/xdocs/engine-introduction.xml
index e57fd1dc..4c248a62 100644
--- a/xdocs/engine-introduction.xml
+++ b/xdocs/engine-introduction.xml
@@ -22,10 +22,7 @@ limitations under the License.
-
The main component in our framework is the Persistence manager. It converts an object graph into JCR nodes and properties and vice versa.
-
-
ADD API overview here
-
+
The main component in our framework is the Persistence manager. It converts an object graph into JCR nodes and properties and vice versa.
@@ -49,6 +46,10 @@ limitations under the License.
Of course, all those "mapping types" imply different mapping algorithms.See the "Mapping Strategies" section to get more information on the descriptor file.
+
+
+
[TO DO]
+
diff --git a/xdocs/index.xml b/xdocs/index.xml
index 54733307..059fedac 100644
--- a/xdocs/index.xml
+++ b/xdocs/index.xml
@@ -25,7 +25,7 @@ limitations under the License.
This Graffito subproject is an object/JCR persistence and query service. This tools lets you to persist java objects into a JCR compliant repository - including association, inheritance, polymorphism, composition, and the Java collections framework. Furthermore, this jcr-mapping allows you to express queries in Java-based Criteria, as well as in JCR query language.
-
In order to easily support the JCR specification, any content application managing an high level object model can use this framework. For example, a classic Forum application contains objets like "Forum", "Topic" and "Post". Now these data objects (pojo) can be managed by our JCR mapping tools in order to persist them into a JCR compliant repository.
+
In order to easily support the JCR specification, any content application managing an high level object model can use this framework. For example, a classic Forum application contains objets like "Forum", "Topic" and "Post". Now, the data objects (pojo) can be managed by our JCR mapping tools in order to persist them into a JCR compliant repository.
@@ -37,12 +37,12 @@ limitations under the License.
- Before using this JCR framework, you should review the JCR specication and implementation like JackRabbit.
+ Before using this JCR framework, you should review the JCR specication and implementations like JackRabbit.
-
There are no releases yet. See the menu 'Build a new application" for instructions on how to download and build the Graffito JCR mapping sources.
+
There are no releases yet. See the menu "Getting Started" for instructions on how to download and build the Graffito JCR mapping sources.
- When you have create a new Persistence Manager in you application, you can use this component to insert, update, delete and retrieve objects. The class 'Folder' used in the following sections should be associated to a class-descriptor defined in the mapping descriptor.
+ When you have create a new Persistence Manager in your application, you can use this component to insert, update, delete and retrieve objects. The class 'Folder' used in the following sections should be associated to a class-descriptor defined in the mapping descriptor.
This page describes only the main Persistence Manager methods. You can see the javadoc to get more information on the API.
@@ -76,4 +76,4 @@ persistenceManager.remove("/test");