Re: Get sources from CVS

2005-09-30 Thread Davide Savazzi
On 9/29/05, V K [EMAIL PROTECTED] wrote:
 Using eclipse when I try to get sources from CVS repository, I get a time out 
 error.

Slide sources are in a subversion repository now:
http://svn.apache.org/repos/asf/jakarta/slide/trunk/

--
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: use of COMPRESS flag not detected on get...

2004-11-24 Thread Davide Savazzi
On Wednesday 24 November 2004 15:51, Nick Longinow wrote:

 I notice that if you use COMPRESS=true in the store (Oracle, in my case),
 and then later change it to false, any files putMethod'd into the store
 while COMPRESS was true will not be able to getMethod'd.  ie, slide will
 attempt to do a getMethod assuming the files are stored in the *current*
 format specified in the domain.xml for the store.  ie, it will attempt to
 pull them down in compressed (zip format), which will not work.

 Is this the case ? 

Yes :(

 If so, is there a way to tell Slide to pull the document 
 out in the currently stored format, not just what the domain.xml says ?

Not now, I have made a small patch for Oracle, I'll commit it this friday in 
HEAD...

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



oracle fix

2004-11-13 Thread Davide Savazzi

I've applied the patch of Richard Emberson to the Oracle store.
If you want to try a compiled version I've uploaded a build here:
http://www.corefandango.net/slide/

...
So don't using Oracle jdbc extensions was _not_ a good idea :(

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: I also have trouble doing versionControl in Oracle... Memory issue ? Compress fixes it.

2004-11-10 Thread Davide Savazzi
On Wednesday 10 November 2004 22:22, Oliver Zeigermann wrote:

 Maybe we will have to go back to the old 
 version using the Oracle jars?
 Davide, does it work for you with larger files as well?

Using the new adapter the bug appears with auto-version-control = true.
With auto-version-control = false I've just tested it, uploading and 
downloading big files (150MB) and it works...

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SOLUTION - I also have trouble doing versionControl in Oracle...

2004-11-10 Thread Davide Savazzi
On Thursday 11 November 2004 00:03, Richard Emberson wrote:
 This may not be the long term solution, but it works for both small
 and large files.
 My environment is: I am running Slide from a war file within an
 ear file in JBoss.

Thanks for the patch! Tomorrow I'll test it in my environment and then commit 
it :)

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Anyone able to use Slide 2.1B2 with Oracle store ?

2004-11-09 Thread Davide Savazzi
On Tuesday 09 November 2004 14:37, Nick Longinow wrote:

 I just found out my db is actually 8i yaaa!

Aha! So a Oracle8RDBMSAdapter is needed...

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to configure the slide with oracle ..

2004-11-09 Thread Davide Savazzi
On Tuesday 09 November 2004 19:03, mahesh kumar wrote:

 - ER ROR - Loading and registering driver 'oracle.jdbc.driver.OracleDriver'
 failed (o racle.jdbc.driver.OracleDriver)

 Its giving some error on loading oracle driver .. Can u pleaas look into it
 and let me know urgently ..

You have to copy your Oracle jdbc driver (classes12.jar) in the slide webapp 
classpath. This can be in $TOMCAT_HOME/shared/lib/

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



If You Can't Get An Answer

2004-11-09 Thread Davide Savazzi

I hope to not sound too rude but... I think someone should (re-)read the 
mailing list guidelines...

Section If You Can't Get An Answer.
http://www.catb.org/~esr/faqs/smart-questions.html#id3002966

:)

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to configure the slide with oracle ..

2004-11-09 Thread Davide Savazzi
On Tuesday 09 November 2004 20:53, mahesh kumar wrote:
 Thanks Davide...

 Now that I am getting another error like

 org.apache.slide.store.impl.rdbms.StandardRDBMSAdapter - ERROR - SQL error
 942 on /: ORA-00942: table or view does not exist

You have to create the Slide tables in the database. The scripts are in 
slide/db-schema inside the binary distribution. Look for a file called 
OracleSchema.sql.

Ciao,
-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Anyone able to use Slide 2.1B2 with Oracle store ?

2004-11-08 Thread Davide Savazzi
On Monday 08 November 2004 17:17, Nick Longinow wrote:
 I have tried using various thin drivers without success for anything but
 very small files.  It seems that Oracle has some problem writing large
 BLOBS or CLOBS with the thin drivers, and recommends using the OCI driver
 (bad for me, don't want users to have to install OCI client).

 Is anyone able to putMethod large files into an Oracle store ?  If so, what
 driver and version of Oracle db are you using ?

Oracle 10i + classes12.jar

What version of Oracle are you using?

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how to configure the slide with oracle ..

2004-11-08 Thread Davide Savazzi
On Monday 08 November 2004 21:55, mahesh kumar wrote:

 I would like to know to configure the slide with oracle data store. I came
 to know that we need to modify domain.xml file.. I have modified the said
 file .. as as follows ..

[...]

 Please let me know where I am going wrong..

It seems correct. What's the problem?

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Oracle Store Out of Memory on putMethod ??

2004-11-08 Thread Davide Savazzi
On Monday 08 November 2004 23:08, Oliver Zeigermann wrote:
 Hi Nick,

 the resource is zipped in memory first, so with the default size of
 your JVM of 64 MB this might get a bit too big. A short term solution
 would be to give it more memory.

 However, as I understood Davide said he would put back the old Oracle
 adapter using classs from Oracle's JDBC driver if necessary. This
 would be the long term solution then...

The problem of oom exceptions, when compression is on, is related to the class 
StoreContentZip and is common to all the jdbc stores. We could modify 
StoreContentZip to write the content to disk when it becoms too big...

The old version of the oracle adapter zipped the stream on the fly, because 
there were no need to know the size of the compressed content (but it used 
gzip compression not zip, I don't know if it is a good idea to change the 
compression algorithm...).

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Fw: Error while Configuring Oracle JDBC store for Slide 2.0

2004-11-08 Thread Davide Savazzi
On Friday 05 November 2004 16:38, Karan Tyagi wrote:
 Would appreciate any help on this ..

 I made the changes as specified below in the Domain.xml.
 But when I startup Tomcat, it just dies.

Mh... slide 2.0? The oracle adapter is present only in the binary and 
source distribution of 2.1b2 or in the source of 2.1b1 (once I've had the 
same problem and the exception was not a ClassNotFound but a NPE...). 

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Oracle RDBMS Adapter

2004-09-08 Thread Davide Savazzi
On Tuesday 07 September 2004 23:02, LOMBART Christophe wrote:
 I'm just wondering why the method storeContent has been changed in the
 OracleRDBMSAdapater. 
 Why this method has been changed  ?

You can follow the thread here:
http://www.mail-archive.com/slide-user%40jakarta.apache.org/msg07284.html

 Following the oracle doc, It is mandatory to use the 
 class oracle.sql.BLOB for writing blobs.

This was also my opinion:
http://www.mail-archive.com/slide-user%40jakarta.apache.org/msg07287.html
:)

But then I've changed idea:
http://www.mail-archive.com/slide-user%40jakarta.apache.org/msg07288.html
http://www.mail-archive.com/slide-user%40jakarta.apache.org/msg07306.html

 If standard JDBC 
 calls are made on Oracle for Blob management it is possible to have some
 SqlException.

This adapter version seems to work with 10g and 9i. Did you encounter some 
exception with it?

With the current version there's no need for a Weblogic adapter, no need to 
have the Oracle jdbc driver to compile the adapter and no need to use 
deprecated jdbc extensions...

Regards,
-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Oracle RDBMS Adapter

2004-09-08 Thread Davide Savazzi
On Wednesday 08 September 2004 10:02, LOMBART Christophe wrote:

 With 9i, I have sometime some SqlException. For the same unit test, when
 I'm using the oracle.sql.BLOB, I never received thoses SqlException. I
 seems to be depending on the document length.

I can't test the adapter with 9i... Are you using the Slide test suite? Can 
you post the exception?

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OracleRDBMSAdapter no longer supportted?

2004-08-25 Thread Davide Savazzi
On Wednesday 25 August 2004 09:05, Dharmesh Rana wrote:
 Hi Davide,

 After downloading latest build.xml from Cvs, that you have fixed to remove
 Oracle driver dependency, OracleRDBMSAdapter.java gets compiled.

I've updated also CommonRDBMSAdapter, DB2RDBMSAdapter and 
OracleRDBMSAdapter...
http://cvs.apache.org/viewcvs.cgi/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/

Regards,
-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OracleRDBMSAdapter no longer supportted?

2004-08-25 Thread Davide Savazzi
On Wednesday 25 August 2004 10:23, Davide Savazzi wrote:

 I've updated also CommonRDBMSAdapter, DB2RDBMSAdapter and
 OracleRDBMSAdapter...
 http://cvs.apache.org/viewcvs.cgi/jakarta-slide/src/stores/org/apache/slide
/store/impl/rdbms/

Very soon we should set up Nightly Builds so it will be easy to try the latest 
fixes :)

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OracleRDBMSAdapter no longer supportted?

2004-08-24 Thread Davide Savazzi
On Tuesday 24 August 2004 13:08, Dharmesh Rana wrote:

 I am using slide version 2.1 b1 with Oracle 8.1.7

 I encountered a problem, when using Oracle store.
 I read the instructions carefully, what I have to change in Domain.xml.

 But, while compiling using ant OracleRDBMSAdapter.java is not getting
 compiled.

Yes, there's an error in the Ant script: the Oracle Adapter is never compiled!
You should modify the main target:
target name=main depends=prepare description=Builds Slide's Core

I've fixed this in Cvs. I've removed the dependency to the Oracle JDBC driver 
(as Kiran suggested). You should try this version: tell me if it works with 
Oracle 8i!

Regards,
-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OracleRDBMSAdapter no longer supportted?

2004-08-20 Thread Davide Savazzi
On Friday 20 August 2004 02:14, Kiran Patchigolla wrote:
 We are able to store and retrieve data in blobs in Oracle 9i using the
 storeContent implementation in CommonRDBMSAdapter which uses JDBC API and
 does not rely on specific oracle API.

In CommonRDBMSAdapter there isn't a storeContent method...
If I remove the storeContent method in the Oracle adapter (thus using 
storeContent in StandardRDBMSAdapter) with 10g and classes12.jar or 
ojdbc14.jar I get this error:

ORA-01461: can bind a LONG value only for insert into a LONG column

I haven't 9i installed so I can't try with it.

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OracleRDBMSAdapter no longer supportted?

2004-08-20 Thread Davide Savazzi
On Friday 20 August 2004 16:11, Ritu Kedia wrote:

 So I think the storeContent implementation of DB2RDBMSAdapter should be
 moved to CommonRDBMSAdapter and used by Oracle as well. This transition
 would even remove the compile time dependency on oracle driver libs.
 Also, another important thing... there was a patch applied by Davide for
 Content-length to Oracle Adapter (storeContent method has the fix: bugId
 30317). That fix should be applied to CommonRDBMSAdapter.

Sounds good! I'll commit the changes ASAP.

Regards,
-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OracleRDBMSAdapter no longer supportted?

2004-08-19 Thread Davide Savazzi
On Thursday 19 August 2004 22:31, James Mason wrote:
 It looks like storeContent is overridden in the Oracle adapter to handle
 blobs differently. That's the only reference to an Oracle specific
 class. I don't know if it's necessary, but someone must have had a read
 for putting it there... ;).

The use of Oracle extensions to the Blob object is necessary for versions 
previous to 10g (with 10g these extensions are deprecated in favour of jdbc 
3.0 api).

  Well, I could upload the jdbc driver, but I'm pretty sure there would be
  legal complications.

Yes, Oracle Distribution license isn't compatible with Apache license...
;)

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: New Committers Davide and Ryan

2004-08-10 Thread Davide Savazzi
On Tuesday 10 August 2004 22:22, James Mason wrote:
 Welcome welcome :)

 Oliver Zeigermann wrote:
  Dear Slide community!
 
  We have two new committers, Davide and Ryan.
 
  Welcome to both of you.

Thanks! :)

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Slide Security Questions

2004-07-20 Thread Davide Savazzi
On Tuesday 20 July 2004 14:07, Ricardo Gladwell wrote:

 Thanks for your informative response. I didn't consider adding the
 WebDAV client tool to the web application and accessing the WebDAV
 functionality through this. Doesn't this involve opening a HTTP
 connection back to the same server?

 This seems a little inefficient. Wouldn't it be better to access the
 WebDAV application directly through the VM if they are both being served
 off the same JVM? Also, I believe some servlet containters, such as
 WebLogic 6.1, have problems open connections to themselves, sometimes
 causing blocking.

 Is it possible to configure the Slide WebDAV client to directly access
 the Slide engine itself rather than work over HTTP?

It will be possible with Slide 3:
http://tinyurl.com/6h4od
:)

If you want to hack a solution you could write a Connector for Tomcat and 
modify commons-httpclient to send requests to that Connector in the same vm.
But I don't know if it is worthwhile doing it...

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can I run the slide2.0 with Oracle DB as a content and metadata store

2004-07-20 Thread Davide Savazzi
On Monday 19 July 2004 05:49, Mihir Solanki wrote:

 I am using the slide 2.0 binary version. I wanted to run it by
 configuring
 the store for content as well as metadata which is Oracle DB.

 Please let me know is it possible or not with slide 2.0.

You must use version 2.1M1... 
http://www.mail-archive.com/slide-user%40jakarta.apache.org/msg06066.html

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: plx help for oracle sotre!!

2004-07-14 Thread Davide Savazzi
On Tuesday 13 July 2004 11:04,   wrote:

 org.apache.slide.store.impl.rdbms.JDBCStore - EMERGENCY - Could not create
 connection. Reason: org.apache.commons.dbcp.SQLNestedException: Connect
 failed, cause: Could not create a validated object

It seems a dbcp / connection problem... Can you post the full stack trace?

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getting the authentication out of a javax.servlet.http.HttpServletRequest?

2004-07-14 Thread Davide Savazzi
On Wednesday 14 July 2004 18:27, [EMAIL PROTECTED] wrote:

 I want to have the servlet using some http authentication. But how can I
 forward this to the
 org.apache.commons.httpclient.HttpURL
 That I need to construct the WebdavResource?

 There is a method getRemoteUser() in javax.servlet.http.HttpServletRequest
 But how can I forward the password, or the authentification?

There aren't methods for these, you have to read the request headers. With 
Basic HTTP Authentication you have a header named Authorization that should 
contains something like this: 

BASIC d2VibWFzdGVyOnRyeTJndWVTUw

The string following BASIC  is encoded with Base64 and contains 
username:password.

-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: oracle db_schema??

2004-06-14 Thread Davide Savazzi

 thx for your reply first. could you tell me the values of the properties
 oracle.lib.dir and oracle-jdbc.jar in build.properties files.  very
 appreciate it.

oracle.lib.dir should contain the path where your oracle jdbc drivers are.
oracle-jdbc.jar the name of the jar that contains the jdbc driver...

Example:
oracle.lib.dir=/oracle/app/oracle/product/10.1.0/db_2/jdbc/lib
oracle-jdbc.jar=${oracle.lib.dir}/classes12.jar

Here's a snippet of a Domain.xml:
---
definition
store name=OracleStore
  nodestore classname=org.apache.slide.store.impl.rdbms.JDBCStore
parameter 
name=adapterorg.apache.slide.store.impl.rdbms.OracleRDBMSAdapter/parameter
parameter name=driveroracle.jdbc.driver.OracleDriver/parameter
parameter name=urljdbc:oracle:thin:@localhost:1521:slide/parameter
parameter name=userslide/parameter
parameter name=passwordsecret/parameter
parameter name=dbcpPoolingtrue/parameter
parameter name=maxPooledConnections10/parameter
!-- Warning: don't use serializable isolation! --
!-- parameter name=isolationSERIALIZABLE/parameter --
parameter name=compressfalse/parameter
  /nodestore
  contentstore
reference store=nodestore /
  /contentstore
  securitystore
reference store=nodestore /
  /securitystore
  lockstore
reference store=nodestore /
  /lockstore
  revisiondescriptorsstore
reference store=nodestore /
  /revisiondescriptorsstore
  revisiondescriptorstore
reference store=nodestore /
  /revisiondescriptorstore
 /store
scope match=/ store=OracleStore/
/definition
---

Cheers,
-- 
Davide Savazzi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WVCM API- Please email to me

2004-06-09 Thread Davide Savazzi
On Wednesday 09 June 2004 07:15, Luanne Coutinho wrote:

 Apparently we have some problem with our firewall-
 can't connect to any cvs server.

You can use this script: http://cvsgrab.sourceforge.net/

-- 
Davide Savazzi



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: oracle db_schema??

2004-06-07 Thread Davide Savazzi
On Monday 07 June 2004 09:50, Slide Tao wrote:

 I want to use slide with oracle, but there is no db schema for oracle, who
 could provide the schema for me? thank you very much.

In 2.1M1 sources there is a Oracle schema and a Oracle adapter 
(org.apache.slide.store.impl.rdbms.OracleRDBMSAdapter). To include the Oracle 
adapter in the build you must edit in build.properties the properties 
oracle.lib.dir and oracle-jdbc.jar.

-- 
Davide Savazzi



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JSR 170 available for Public Review

2004-05-18 Thread Davide Savazzi

http://www.jcp.org/en/jsr/detail?id=170
It could be interesting to write a store that uses jcr or implement jcr using 
slide :)

-- 
Davide Savazzi


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



compression support [Was: Re: Oracle Store]

2004-05-17 Thread Davide Savazzi
On Monday 17 May 2004 09:36, Oliver Zeigermann wrote:

 Hmmm, I am not quite sure if this is a good solution. Compression was
 introduced to achive a speedup. I guess writing to a temporary file
 first rather slows down everything, am I wrong? 

It's obviously slower but the real bottleneck is always the db, I'll make some 
benchmark ;)
What do you think about using NIO to keep all in memory but outside the vm?

 Maybe the solution would
 be to disable compression when you want up-/download large files?

Or write to a tmp file only if ByteArrayOutputStream becomes too big?

-- 
Davide Savazzi



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using Slide with large files

2004-05-12 Thread Davide Savazzi

I've read messages of people complaining about OutOfMemoryErrors so I post my 
solution to the problem...

To upload very large files in a database store I had to make these changes:

1. Remove the Logging filter from web.xml. The Logging Filter replaces the 
Tomcat ServletInputStream with a XServletInputStreamFacade. These stream 
keeps in memory all the read data in a buffer called XByteBuffer. If I have 
understood the source correctly, after an upload you end with the file in 
memory in two places: NodeRevisionContent and XByteBuffer.

2. Use a NodeRevisionContent that writes all bytes in a temporary file (in the 
attachment).

After closing the stream returned by streamContent() this NodeRevisionContent 
can't be used anymore, because the file is deleted. Maybe this could be a 
problem with some stores...

getContentBytes() is a dangerous method, but is used only by ExtendedStore to 
cache small files.

With these changes you can start Tomcat with default memory settings and 
upload very large files without any problem. Now I'm writing a 
NodeRevisionContent that uses a fixed amount of vm memory to keep in memory 
small files.

Best regards,
-- 
Davide Savazzi
/*
 * $Header: /cvs/star/slide-oracle-store/src/java/org/apache/slide/content/NodeRevisionContent.java,v 1.4 2004/05/12 08:32:30 dsavazzi Exp $
 * $Revision: 1.4 $
 * $Date: 2004/05/12 08:32:30 $
 *
 * 
 *
 * Copyright 1999-2002 The Apache Software Foundation 
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package org.apache.slide.content;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

import org.apache.slide.common.ObjectValidationFailedException;
import org.apache.slide.util.Messages;


/**
 * Encapsultes the contents of a revision.
 *
 * @author a href=mailto:[EMAIL PROTECTED]Remy Maucherat/a
 * @author Juergen Pill
 * @version $Revision: 1.4 $
 */
public final class NodeRevisionContent implements Serializable {

// Public Methods

public InputStream streamContent() throws IOException {
return new FilterInputStream(new FileInputStream(fsBuffer)) {
public void close() throws IOException {
try {
super.close();
} finally {
freeContent();
}
}
};
}

public void setContent(InputStream in) {
try {
fsBuffer = File.createTempFile(
Slide, Long.toString(System.currentTimeMillis()));
OutputStream out = new FileOutputStream(fsBuffer);
try {
copy(in, out, STREAM_BUFFER_SIZE);
} finally {
out.close();
}
} catch (IOException ioe) {
// TODO
ioe.printStackTrace();
}
}

public void freeContent() {
if (fsBuffer != null) {
fsBuffer.delete();
}
}

/**
 * @deprecated
 */
public byte[] getContentBytes() {
if (fsBuffer == null) return null;
byte[] result = null;

ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
InputStream in = new FileInputStream(fsBuffer);
try {
copy(in, out, STREAM_BUFFER_SIZE);
result = out.toByteArray();
} finally {
in.close();
}
} catch (IOException ioe) {
// TODO
ioe.printStackTrace();
}

return result;
}

/**
 * Validate.
 */
public void validate() {
if (fsBuffer == null)
throw new ObjectValidationFailedException
(Messages.message
 (NodeRevisionContent.class.getName() + .noContent));
}

/**
 ** Read the data from the stream and return the result in a byte array.
 ** Return null in case of an error.
 **/
public static byte[] read(InputStream in) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
copy(in, out, STREAM_BUFFER_SIZE);
return out.toByteArray();
}

public static void copy(InputStream in, OutputStream out, int bufferSize) 
throws IOException 
{
int read = 0;
byte buffer[] = new byte[bufferSize];
while ((read = in.read(buffer, 0, bufferSize)) != -1) {
out.write

Re: Using Slide with large files

2004-05-12 Thread Davide Savazzi
On Wednesday 12 May 2004 11:27, Oliver Zeigermann wrote:

 I am still wondering why NodeRevisionContent should be changed as
 getContentBytes() is only called to actually load the bytes of a
 resource into memory for *caching*.  

Ops, you're right. I've only removed the Logger and it works! :)

getContentBytes() is also used by 
org.apache.slide.search.basic.ComparableResourceImpl. I've attached a patch 
for it (not tested!).

-- 
Davide

diff -r ./src/share/org/apache/slide/search/basic/ComparableResourceImpl.java ../jakarta-slide/src/share/org/apache/slide/search/basic/ComparableResourceImpl.java
26,27d25
 
 import java.io.*;
504,518c502
 boolean found = false;
 InputStream stream = revisionContent.streamContent();
 try {
 Reader reader = new InputStreamReader(stream);
 char buffer[] = new char[1024];
 int read = 0;
 while (!found  (read = reader.read(buffer))  -1) {
 String content = new String(buffer, 0, read);
 if (content.indexOf(literal)  -1) {
 found = true;
 }
 }
 } finally {
 stream.close();
 }
---
 String content = new String (revisionContent.getContentBytes());
520c504
 if (found)
---
 if (content.indexOf (literal)  -1)
525,527d508
 catch (IOException ioe) {
 // error handling ???
 }

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Oracle Store

2004-05-12 Thread Davide Savazzi

I've made an Oracle 9 adapter, I've tested it with Konqueror on Linux, 
Explorer on Windows and it seems to work... There's no support for 
compression yet. In storeContent() I use a method of the Oracle JDBC driver, 
someone knows if it could be implemented without it?

Is there a test suite for Stores???

-- 
Davide Savazzi


ALTER SESSION SET SQL_TRACE = TRUE;

DROP TRIGGER URI-URI_ID-TRG;
DROP TRIGGER BRANCH-BRANCH_ID-TRG;
DROP TRIGGER LABEL-LABEL_ID-TRG;
DROP TRIGGER VERSION_HISTORY-VERSION_ID-TRG;

DROP SEQUENCE URI-URI_ID-SEQ;
DROP SEQUENCE BRANCH-BRANCH_ID-SEQ;
DROP SEQUENCE LABEL-LABEL_ID-SEQ;
DROP SEQUENCE VERSION_HISTORY-VERSION_ID-SEQ;

DROP TABLE URI CASCADE CONSTRAINTS;
DROP TABLE OBJECT CASCADE CONSTRAINTS;
DROP TABLE BINDING CASCADE CONSTRAINTS;
DROP TABLE PARENT_BINDING CASCADE CONSTRAINTS;
DROP TABLE LINKS CASCADE CONSTRAINTS;
DROP TABLE LOCKS CASCADE CONSTRAINTS;
DROP TABLE BRANCH CASCADE CONSTRAINTS;
DROP TABLE LABEL CASCADE CONSTRAINTS;
DROP TABLE VERSION CASCADE CONSTRAINTS;
DROP TABLE VERSION_HISTORY CASCADE CONSTRAINTS;
DROP TABLE VERSION_PREDS CASCADE CONSTRAINTS;
DROP TABLE VERSION_LABELS CASCADE CONSTRAINTS;
DROP TABLE VERSION_CONTENT CASCADE CONSTRAINTS;
DROP TABLE PROPERTIES CASCADE CONSTRAINTS;
DROP TABLE PERMISSIONS CASCADE CONSTRAINTS;


// path max length: 2500

CREATE TABLE URI (
URI_ID NUMBER(10) NOT NULL,
URI_STRING VARCHAR2(2500) NOT NULL,
PRIMARY KEY(URI_ID),
UNIQUE(URI_STRING)
) CACHE NOLOGGING;

CREATE TABLE OBJECT (
URI_ID NUMBER(10),
CLASS_NAME VARCHAR2(255) NOT NULL,
PRIMARY KEY(URI_ID),
FOREIGN KEY(URI_ID) REFERENCES URI(URI_ID)
) CACHE NOLOGGING;

// node name max length: 512

CREATE TABLE BINDING (
URI_ID NUMBER(10) NOT NULL,
NAME VARCHAR2(512) NOT NULL,
CHILD_UURI_ID NUMBER(10) NOT NULL,
PRIMARY KEY(URI_ID, NAME, CHILD_UURI_ID),
FOREIGN KEY(URI_ID) REFERENCES URI(URI_ID),
FOREIGN KEY(CHILD_UURI_ID) REFERENCES URI(URI_ID)
) CACHE NOLOGGING;

CREATE TABLE PARENT_BINDING (
URI_ID NUMBER(10) NOT NULL,
NAME VARCHAR2(512) NOT NULL,
PARENT_UURI_ID NUMBER(10) NOT NULL,
PRIMARY KEY(URI_ID, NAME, PARENT_UURI_ID),
FOREIGN KEY(URI_ID) REFERENCES URI(URI_ID),
FOREIGN KEY(PARENT_UURI_ID) REFERENCES URI(URI_ID)
) CACHE NOLOGGING;

CREATE TABLE LINKS (
URI_ID NUMBER(10) NOT NULL,
LINK_TO_ID NUMBER(10) NOT NULL,
PRIMARY KEY(URI_ID, LINK_TO_ID),
FOREIGN KEY(URI_ID) REFERENCES URI(URI_ID),
FOREIGN KEY(LINK_TO_ID) REFERENCES URI(URI_ID)
) CACHE NOLOGGING;

CREATE TABLE LOCKS (
LOCK_ID NUMBER(10) NOT NULL, 
OBJECT_ID NUMBER(10) NOT NULL, 
SUBJECT_ID NUMBER(10) NOT NULL, 
TYPE_ID NUMBER(10) NOT NULL, 
EXPIRATION_DATE NUMBER(14) NOT NULL,
IS_INHERITABLE NUMBER(1) NOT NULL, 
IS_EXCLUSIVE NUMBER(1) NOT NULL, 
OWNER VARCHAR2(512), 
PRIMARY KEY(LOCK_ID), 
FOREIGN KEY(LOCK_ID) REFERENCES URI(URI_ID),
FOREIGN KEY(OBJECT_ID) REFERENCES URI(URI_ID),
FOREIGN KEY(SUBJECT_ID) REFERENCES URI(URI_ID),
FOREIGN KEY(TYPE_ID) REFERENCES URI(URI_ID)
) CACHE NOLOGGING;

CREATE TABLE BRANCH (
BRANCH_ID NUMBER(10) NOT NULL, 
BRANCH_STRING VARCHAR2(512) NOT NULL, 
PRIMARY KEY(BRANCH_ID), 
UNIQUE(BRANCH_STRING)
) CACHE NOLOGGING;

CREATE TABLE LABEL (
LABEL_ID NUMBER(10) NOT NULL, 
LABEL_STRING VARCHAR2(512) NOT NULL, 
PRIMARY KEY(LABEL_ID)
) CACHE NOLOGGING;

CREATE TABLE VERSION (
URI_ID NUMBER(10) NOT NULL, 
IS_VERSIONED NUMBER(1) NOT NULL, 
PRIMARY KEY(URI_ID), 
FOREIGN KEY(URI_ID) REFERENCES URI(URI_ID)
) CACHE NOLOGGING;

CREATE TABLE VERSION_HISTORY (
VERSION_ID NUMBER(10) NOT NULL, 
URI_ID NUMBER(10) NOT NULL, 
BRANCH_ID NUMBER(10) NOT NULL, 
REVISION_NO VARCHAR2(20) NOT NULL, 
PRIMARY KEY(VERSION_ID), 
UNIQUE(URI_ID, BRANCH_ID, REVISION_NO), 
FOREIGN KEY(URI_ID) REFERENCES URI(URI_ID), 
FOREIGN KEY(BRANCH_ID) REFERENCES BRANCH(BRANCH_ID)
) CACHE NOLOGGING;

CREATE TABLE VERSION_PREDS (
VERSION_ID NUMBER(10) NOT NULL, 
PREDECESSOR_ID NUMBER(10) NOT NULL, 
FOREIGN KEY(VERSION_ID) REFERENCES VERSION_HISTORY(VERSION_ID), 
FOREIGN KEY(PREDECESSOR_ID) REFERENCES VERSION_HISTORY(VERSION_ID), 
UNIQUE(VERSION_ID, PREDECESSOR_ID)
) CACHE NOLOGGING;

CREATE TABLE VERSION_LABELS (
VERSION_ID NUMBER(10) NOT NULL, 
LABEL_ID NUMBER(10) NOT NULL, 
UNIQUE(VERSION_ID, LABEL_ID), 
FOREIGN KEY(VERSION_ID) REFERENCES VERSION_HISTORY(VERSION_ID), 
FOREIGN KEY(LABEL_ID) REFERENCES LABEL(LABEL_ID)
) CACHE NOLOGGING;

CREATE TABLE VERSION_CONTENT (
VERSION_ID NUMBER(10) NOT NULL, 
CONTENT BLOB, 
PRIMARY KEY(VERSION_ID), 
FOREIGN KEY(VERSION_ID) REFERENCES