[exo-jcr-commits] exo-jcr SVN: r558 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 11 06:30:51 EST 2009


Author: areshetnyak
Date: 2009-11-11 06:30:51 -0500 (Wed, 11 Nov 2009)
New Revision: 558

Added:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderException.java
Modified:
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ExoJCRCacheLoaderException.java
   jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-201 : The JDBCCacheLoader was changed.

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ExoJCRCacheLoaderException.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ExoJCRCacheLoaderException.java	2009-11-11 09:34:47 UTC (rev 557)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ExoJCRCacheLoaderException.java	2009-11-11 11:30:51 UTC (rev 558)
@@ -61,7 +61,7 @@
    }
 
    /**
-    * RepositoryConfigurationException  constructor.
+    * ExoJCRCacheLoaderException constructor.
     *
     * @param cause
     *         Throwable, the base exception.

Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java	2009-11-11 09:34:47 UTC (rev 557)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java	2009-11-11 11:30:51 UTC (rev 558)
@@ -309,8 +309,88 @@
    {
 
       Map<Object, Object> attrs = new LinkedHashMap<Object, Object>();
+      
       if (name.size() > 1)
       {
+         if (name.get(0).equals(JBossCacheStorage.NODES))
+         {
+            // /$NODES/<NODE_ID>
+            if (name.size() == 2)
+            {
+               // return NodeData [ITEM_DATA : NodeData]
+               WorkspaceStorageConnection conn = dataContainer.openConnection();
+
+               try
+               {
+                  NodeData nodeData = (NodeData) conn.getItemData(name.getLastElementAsString());
+                  
+                  if (nodeData != null)
+                  {
+                     attrs.put(JBossCacheStorage.ITEM_DATA, nodeData);
+
+                     // put [PROPERTY_NAME : propertyData_ID]
+                     for (PropertyData prop : conn.getChildPropertiesData(nodeData))
+                     {
+                        attrs.put(prop.getQPath().getName().getAsString(), prop.getIdentifier());
+                     }
+                  }
+               }
+               finally
+               {
+                  conn.close();
+               }
+            }
+            // /$NODES/<NODE_ID>/<SUB_NODE_NAME>
+            else if (name.size() == 3)
+            {
+               QPathEntry nodeName = QPathEntry.parse(name.getLastElementAsString());
+               
+               // return [ITEM_Id : nodeData_ID]
+               WorkspaceStorageConnection conn = dataContainer.openConnection();
+
+               try
+               {
+                  NodeData parentNodeData = (NodeData) conn.getItemData((String)name.get(2));
+                  
+                  if (parentNodeData == null)
+                    throw new JDBCCacheLoaderException("The parent node with ID = " + (String)name.get(2) + " not exis, FQN = '" + name + "'.");
+                  
+                  NodeData nodeData = (NodeData) conn.getItemData(parentNodeData, nodeName);
+                  if (nodeData != null)
+                    attrs.put(JBossCacheStorage.ITEM_ID, nodeData.getIdentifier());
+               }
+               finally
+               {
+                  conn.close();
+               }
+            }
+         }
+         // /$PROPS/<PROPERTY_ID>
+         else if (name.get(0).equals(JBossCacheStorage.PROPS))
+         {
+            if (name.size() == 2)
+            {
+               // return PropertyData [ITEM_DATA : PropertyData]
+               WorkspaceStorageConnection conn = dataContainer.openConnection();
+
+               try
+               {
+                  PropertyData propertyData = (PropertyData) conn.getItemData(name.getLastElementAsString());
+                  
+                  if (propertyData != null)
+                    attrs.put(JBossCacheStorage.ITEM_DATA, propertyData);
+               }
+               finally
+               {
+                  conn.close();
+               }
+            } 
+         }
+      }
+      
+      return attrs;
+      /*if (name.size() > 1)
+      {
          if (name.get(1).equals(JBossCacheStorage.NODES))
          {
             // return Node
@@ -369,8 +449,7 @@
                }
             }
          }
-      }
-      return attrs;
+      }*/
    }
 
    /**

Added: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderException.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderException.java	                        (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderException.java	2009-11-11 11:30:51 UTC (rev 558)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2003-2009 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.storage.jbosscache;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak at exoplatform.com.ua">Alex Reshetnyak</a> 
+ * @version $Id$
+ */
+public class JDBCCacheLoaderException
+   extends Exception
+{
+   /**
+    * Constructs an Exception without a message.
+    */
+   public JDBCCacheLoaderException()
+   {
+      super();
+   }
+
+   /**
+    * Constructs an Exception with a detailed message.
+    * 
+    * @param Message
+    *          The message associated with the exception.
+    */
+   public JDBCCacheLoaderException(String message)
+   {
+      super(message);
+   }
+
+   /**
+   * Constructs an Exception with a detailed message and base exception.
+   * 
+   * @param Message
+   *          The message associated with the exception.
+   * @param cause
+   *          Throwable, the base exception.
+   */
+   public JDBCCacheLoaderException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   /**
+    * JDBCCacheLoaderException  constructor.
+    *
+    * @param cause
+    *         Throwable, the base exception.
+    */
+   public JDBCCacheLoaderException(Throwable cause)
+   {
+      super(cause);
+   }
+}


Property changes on: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoaderException.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the exo-jcr-commits mailing list