[exo-jcr-commits] exo-jcr SVN: r2659 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: db and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jun 18 05:27:00 EDT 2010


Author: tolusha
Date: 2010-06-18 05:26:59 -0400 (Fri, 18 Jun 2010)
New Revision: 2659

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java
Log:
EXOJCR-756: replace operations on privileged operations for HSQLDB

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2010-06-18 09:04:49 UTC (rev 2658)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java	2010-06-18 09:26:59 UTC (rev 2659)
@@ -122,7 +122,7 @@
 
    protected final WriteValueHelper writeValueHelper = new WriteValueHelper();
 
-   // All statements should be closed in cloaseStatements() method.
+   // All statements should be closed in closeStatements() method.
 
    protected PreparedStatement findItemById;
 

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java	2010-06-18 09:04:49 UTC (rev 2658)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java	2010-06-18 09:26:59 UTC (rev 2659)
@@ -16,10 +16,16 @@
  */
 package org.exoplatform.services.jcr.impl.storage.jdbc.db;
 
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.impl.util.SecurityHelper;
 import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
 import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -102,7 +108,15 @@
       findItemByName.setString(2, containerName);
       findItemByName.setString(3, name);
       findItemByName.setInt(4, index);
-      return findItemByName.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findItemByName.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
 
    /**
@@ -119,7 +133,15 @@
       findPropertyByName.setString(1, parentCid);
       findPropertyByName.setString(2, containerName);
       findPropertyByName.setString(3, name);
-      return findPropertyByName.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findPropertyByName.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
 
    /**
@@ -135,9 +157,17 @@
 
       findNodesByParentId.setString(1, parentCid);
       findNodesByParentId.setString(2, containerName);
-      return findNodesByParentId.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findNodesByParentId.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
-   
+
    /**
     * {@inheritDoc}
     */
@@ -151,7 +181,15 @@
 
       findNodesCountByParentId.setString(1, parentCid);
       findNodesCountByParentId.setString(2, containerName);
-      return findNodesCountByParentId.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findNodesCountByParentId.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
 
    /**
@@ -167,6 +205,258 @@
 
       findPropertiesByParentId.setString(1, parentCid);
       findPropertiesByParentId.setString(2, containerName);
-      return findPropertiesByParentId.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findPropertiesByParentId.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addNodeRecord(final NodeData data) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addNodeRecord(data);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addPropertyRecord(final PropertyData prop) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addPropertyRecord(prop);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findItemByIdentifier(final String identifier) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findItemByIdentifier(identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addReference(final PropertyData data) throws SQLException, IOException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addReference(data);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int renameNode(final NodeData data) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.renameNode(data);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int deleteReference(final String propertyIdentifier) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.deleteReference(propertyIdentifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findReferences(final String nodeIdentifier) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findReferences(nodeIdentifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int deleteItemByIdentifier(final String identifier) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.deleteItemByIdentifier(identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int updateNodeByIdentifier(final int version, final int index, final int orderNumb, final String identifier)
+      throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.updateNodeByIdentifier(version, index, orderNumb, identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int updatePropertyByIdentifier(final int version, final int type, final String identifier)
+      throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.updatePropertyByIdentifier(version, type, identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   // -------- values processing ------------
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addValueData(final String cid, final int orderNumber, final InputStream stream,
+      final int streamLength, final String storageId) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addValueData(cid, orderNumber, stream, streamLength, storageId);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int deleteValueData(final String cid) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.deleteValueData(cid);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findValuesByPropertyId(final String cid) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findValuesByPropertyId(cid);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findValuesStorageDescriptorsByPropertyId(final String cid) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findValuesStorageDescriptorsByPropertyId(cid);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findValueByPropertyIdOrderNumber(final String cid, final int orderNumb) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findValueByPropertyIdOrderNumber(cid, orderNumb);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
 }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java	2010-06-18 09:04:49 UTC (rev 2658)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java	2010-06-18 09:26:59 UTC (rev 2659)
@@ -17,11 +17,17 @@
 package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
 
 import org.exoplatform.services.jcr.datamodel.IllegalNameException;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
 import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.impl.util.SecurityHelper;
 import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
 import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.PrivilegedExceptionAction;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -98,7 +104,7 @@
       FIND_PROPERTIES_BY_PARENTID_CQ =
          "select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_CLASS, I.I_INDEX, I.N_ORDER_NUM, I.P_TYPE, I.P_MULTIVALUED, V.ORDER_NUM,"
             + " V.DATA, V.STORAGE_DESC from JCR_SITEM I LEFT OUTER JOIN JCR_SVALUE V ON (V.PROPERTY_ID=I.ID)"
-            + " where I.PARENT_ID=? and I.I_CLASS=2 and I.CONTAINER_NAME=? order by I.NAME"; 
+            + " where I.PARENT_ID=? and I.I_CLASS=2 and I.CONTAINER_NAME=? order by I.NAME";
    }
 
    /**
@@ -108,8 +114,8 @@
    protected QPath traverseQPath(String cpid) throws SQLException, InvalidItemStateException, IllegalNameException
    {
       return traverseQPathSQ(cpid);
-   }  
-   
+   }
+
    /**
     * {@inheritDoc}
     */
@@ -125,7 +131,15 @@
       findItemByName.setString(2, containerName);
       findItemByName.setString(3, name);
       findItemByName.setInt(4, index);
-      return findItemByName.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findItemByName.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
 
    /**
@@ -142,7 +156,15 @@
       findPropertyByName.setString(1, parentCid);
       findPropertyByName.setString(2, containerName);
       findPropertyByName.setString(3, name);
-      return findPropertyByName.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findPropertyByName.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
 
    /**
@@ -158,9 +180,17 @@
 
       findNodesByParentId.setString(1, parentCid);
       findNodesByParentId.setString(2, containerName);
-      return findNodesByParentId.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findNodesByParentId.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
-   
+
    /**
     * {@inheritDoc}
     */
@@ -174,7 +204,15 @@
 
       findNodesCountByParentId.setString(1, parentCid);
       findNodesCountByParentId.setString(2, containerName);
-      return findNodesCountByParentId.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findNodesCountByParentId.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
 
    /**
@@ -190,9 +228,16 @@
 
       findPropertiesByParentId.setString(1, parentCid);
       findPropertiesByParentId.setString(2, containerName);
-      return findPropertiesByParentId.executeQuery();
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findPropertiesByParentId.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
    }
-   
 
    /**
     * {@inheritDoc}
@@ -208,9 +253,17 @@
       findNodesByParentIdCQ.setString(1, parentIdentifier);
       findNodesByParentIdCQ.setString(2, containerName);
       findNodesByParentIdCQ.setString(3, containerName);
-      return findNodesByParentIdCQ.executeQuery();
-   }   
-   
+
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findNodesByParentIdCQ.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
    /**
     * {@inheritDoc}
     */
@@ -224,7 +277,290 @@
 
       findPropertiesByParentIdCQ.setString(1, parentIdentifier);
       findPropertiesByParentIdCQ.setString(2, containerName);
-      return findPropertiesByParentIdCQ.executeQuery();
 
-   }   
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return findPropertiesByParentIdCQ.executeQuery();
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addNodeRecord(final NodeData data) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addNodeRecord(data);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addPropertyRecord(final PropertyData prop) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addPropertyRecord(prop);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findItemByIdentifier(final String identifier) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findItemByIdentifier(identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addReference(final PropertyData data) throws SQLException, IOException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addReference(data);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int renameNode(final NodeData data) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.renameNode(data);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int deleteReference(final String propertyIdentifier) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.deleteReference(propertyIdentifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findReferences(final String nodeIdentifier) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findReferences(nodeIdentifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int deleteItemByIdentifier(final String identifier) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.deleteItemByIdentifier(identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int updateNodeByIdentifier(final int version, final int index, final int orderNumb, final String identifier)
+      throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.updateNodeByIdentifier(version, index, orderNumb, identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int updatePropertyByIdentifier(final int version, final int type, final String identifier)
+      throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.updatePropertyByIdentifier(version, type, identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   // -------- values processing ------------
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int addValueData(final String cid, final int orderNumber, final InputStream stream,
+      final int streamLength, final String storageId) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.addValueData(cid, orderNumber, stream, streamLength, storageId);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected int deleteValueData(final String cid) throws SQLException
+   {
+      PrivilegedExceptionAction<Integer> action = new PrivilegedExceptionAction<Integer>()
+      {
+         public Integer run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.deleteValueData(cid);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findValuesByPropertyId(final String cid) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findValuesByPropertyId(cid);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findValuesStorageDescriptorsByPropertyId(final String cid) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findValuesStorageDescriptorsByPropertyId(cid);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findValueByPropertyIdOrderNumber(final String cid, final int orderNumb) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findValueByPropertyIdOrderNumber(cid, orderNumb);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findItemQPathByIdentifierCQ(final String identifier) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findItemQPathByIdentifierCQ(identifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected ResultSet findNodeMainPropertiesByParentIdentifierCQ(final String parentIdentifier) throws SQLException
+   {
+      PrivilegedExceptionAction<ResultSet> action = new PrivilegedExceptionAction<ResultSet>()
+      {
+         public ResultSet run() throws Exception
+         {
+            return HSQLDBSingleDbJDBCConnection.super.findNodeMainPropertiesByParentIdentifierCQ(parentIdentifier);
+         }
+      };
+      return SecurityHelper.doPriviledgedSQLExceptionAction(action);
+   }
 }



More information about the exo-jcr-commits mailing list