You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by oz...@apache.org on 2004/07/13 20:59:52 UTC

cvs commit: jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms OracleRDBMSAdapter.java

ozeigermann    2004/07/13 11:59:52

  Modified:    src/stores/org/apache/slide/store/impl/rdbms
                        OracleRDBMSAdapter.java
  Log:
  Added patch by Davide Savazzi <da...@corefandango.net>
  to support compression.
  
  Revision  Changes    Path
  1.5       +14 -20    jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/OracleRDBMSAdapter.java
  
  Index: OracleRDBMSAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/OracleRDBMSAdapter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- OracleRDBMSAdapter.java	8 Jun 2004 13:40:08 -0000	1.4
  +++ OracleRDBMSAdapter.java	13 Jul 2004 18:59:52 -0000	1.5
  @@ -35,16 +35,15 @@
   import org.apache.slide.util.logger.Logger;
   
   import java.io.*;
  -//import java.util.zip.GZIPOutputStream;
  -//import java.util.zip.GZIPInputStream;
   import java.sql.*;
   import java.util.*;
   
   
   /**
  - * @todo compression support
  + * Adapter for Oracle 10.
    *
  - * @author Davide Savazzi
  + * @author <a href="mailto:davide.savazzi@corefandango.net">Davide Savazzi</a>
  + * @version $Revision$
    */
   public class OracleRDBMSAdapter extends StandardRDBMSAdapter implements SequenceAdapter {
       
  @@ -196,7 +195,6 @@
                       connection.prepareStatement(
                           "delete from VERSION_CONTENT vc where vc.VERSION_ID in (" + 
                           "select vh.VERSION_ID from VERSION_HISTORY vh, URI u where vh.REVISION_NO = ? and vh.URI_ID=u.URI_ID AND u.URI_STRING=?)");
  -                        // "delete VERSION_CONTENT from VERSION_CONTENT vc, VERSION_HISTORY vh, URI u where vc.VERSION_ID = vh.VERSION_ID and vh.REVISION_NO = ? and vh.URI_ID=u.URI_ID AND u.URI_STRING=?");
                   statement.setString(1, revisionDescriptor.getRevisionNumber().toString());
                   statement.setString(2, uri.toString());
                   statement.executeUpdate();
  @@ -215,7 +213,6 @@
                   connection.prepareStatement(
                   "delete from VERSION_PREDS vp where vp.VERSION_ID in (" + 
                   "select vh.VERSION_ID from VERSION_HISTORY vh, URI u where vh.URI_ID = u.URI_ID and u.URI_STRING = ?)");
  -                // "delete VERSION_PREDS from VERSION_PREDS vp, VERSION_HISTORY vh, URI u where vp.VERSION_ID = vh.VERSION_ID and vh.URI_ID = u.URI_ID and u.URI_STRING = ?");
               statement.setString(1, uri.toString());
               statement.executeUpdate();
           } catch (SQLException e) {
  @@ -235,7 +232,6 @@
                       connection.prepareStatement(
                           "delete from VERSION_LABELS vl where vl.VERSION_ID in (" + 
                           "select vh.VERSION_ID from VERSION_HISTORY vh, URI u where vh.REVISION_NO = ? and vh.URI_ID = u.URI_ID AND u.URI_STRING = ?)");
  -                        // "delete VERSION_LABELS from VERSION_LABELS vl, VERSION_HISTORY vh, URI u where vl.VERSION_ID = vh.VERSION_ID and vh.REVISION_NO = ? and vh.URI_ID = u.URI_ID AND u.URI_STRING = ?");
                   statement.setString(1, revisionNumber.toString());
                   statement.setString(2, uri.toString());
                   statement.executeUpdate();
  @@ -247,7 +243,6 @@
                       connection.prepareStatement(
                           "delete from PROPERTIES p where p.VERSION_ID in (" + 
                           "select vh.VERSION_ID from VERSION_HISTORY vh, URI u where vh.REVISION_NO = ? and vh.URI_ID = u.URI_ID AND u.URI_STRING = ?)");
  -                        // "delete PROPERTIES from PROPERTIES p, VERSION_HISTORY vh, URI u where p.VERSION_ID = vh.VERSION_ID and vh.REVISION_NO = ? and vh.URI_ID = u.URI_ID AND u.URI_STRING = ?");
                   statement.setString(1, revisionNumber.toString());
                   statement.setString(2, uri.toString());
                   statement.executeUpdate();
  @@ -268,7 +263,6 @@
                   statement =
                       connection.prepareStatement(
                           "delete from LOCKS where LOCKS.LOCK_ID in (select u.URI_ID from URI u where u.URI_STRING=?)");
  -                        // "delete LOCKS from LOCKS, URI u where LOCK_ID = u.URI_ID and u.URI_STRING=?");
                   statement.setString(1, lock.getLockId());
                   statement.executeUpdate();
               } finally {
  @@ -278,7 +272,6 @@
                   statement =
                       connection.prepareStatement(
                           "delete from URI where URI.URI_ID in (select LOCK_ID from LOCKS) and URI_STRING=?");
  -                        // "delete URI from URI, LOCKS l where URI_ID = l.LOCK_ID and URI_STRING=?");
                   statement.setString(1, lock.getLockId());
                   statement.executeUpdate();
               } finally {
  @@ -298,8 +291,6 @@
                   connection.prepareStatement(
                       "delete from PERMISSIONS where PERMISSIONS.OBJECT_ID in (select ou.URI_ID from URI ou, URI su, URI au where ou.URI_STRING = ? and SUBJECT_ID = su.URI_ID and su.URI_STRING = ? and ACTION_ID = au.URI_ID and au.URI_STRING = ? and VERSION_NO"
                           + getRevisionNumberAsWhereQueryFragement(revisionNumber) + ")");
  -//                    "delete PERMISSIONS from PERMISSIONS, URI ou, URI su, URI au where OBJECT_ID = ou.URI_ID and ou.URI_STRING = ? and SUBJECT_ID = su.URI_ID and su.URI_STRING = ? and ACTION_ID = au.URI_ID and au.URI_STRING = ? and VERSION_NO"
  -//                        + getRevisionNumberAsWhereQueryFragement(revisionNumber));
               statement.setString(1, permission.getObjectUri());
               statement.setString(2, permission.getSubjectUri());
               statement.setString(3, permission.getActionUri());
  @@ -317,7 +308,6 @@
               statement =
                   connection.prepareStatement(
                       "delete from PERMISSIONS where PERMISSIONS.OBJECT_ID in (select u.URI_ID from URI u where u.URI_STRING = ?)");
  -                    // "delete PERMISSIONS from PERMISSIONS, URI u where OBJECT_ID = u.URI_ID and u.URI_STRING = ?");
               statement.setString(1, uri.toString());
               statement.executeUpdate();
           } catch (SQLException e) {
  @@ -352,9 +342,14 @@
                   res.next();
                   Blob blob = res.getBlob(1);
                   InputStream in = revisionContent.streamContent();
  -//                OutputStream out = new GZIPOutputStream(
  -//                    ((oracle.sql.BLOB) blob).getBinaryOutputStream());
                   OutputStream out = ((oracle.sql.BLOB) blob).getBinaryOutputStream();
  +
  +                if (bcompress) {
  +                    getLogger().log("Compressing the data", LOG_CHANNEL, 6);
  +                    StoreContentZip ziputil = new StoreContentZip();
  +                    ziputil.Zip(in);
  +                    in = ziputil.getInputStream();
  +                }
                   
                   try {
                       copy(in, out, ((oracle.sql.BLOB) blob).getBufferSize());
  @@ -378,7 +373,6 @@
               statement =
                   connection.prepareStatement(
                       "delete from BINDING where BINDING.URI_ID in (select URI_ID from URI where URI.URI_STRING = ?)");
  -                    // "delete BINDING from BINDING c, URI u where c.URI_ID = u.URI_ID and u.URI_STRING = ?");
               statement.setString(1, uri.toString());
               statement.executeUpdate();
           } finally {
  @@ -389,7 +383,6 @@
               statement =
                   connection.prepareStatement(
                       "delete from PARENT_BINDING where PARENT_BINDING.URI_ID in (select URI_ID from URI where URI.URI_STRING = ?)");
  -                    // "delete PARENT_BINDING from PARENT_BINDING c, URI u where c.URI_ID = u.URI_ID and u.URI_STRING = ?");
               statement.setString(1, uri.toString());
               statement.executeUpdate();
           } finally {
  @@ -476,4 +469,5 @@
       }
   
   }
  +
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org