Removing content

View: New views
5 Messages — Rating Filter:   Alert me  

Removing content

by ehsavoie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I have a nt:file node with its jcr:content child. When I remove my node
(node.remove()) it is correctly removed but the content is still on my
filesystem :( in the repository/datastore/....
How do I delete the content ?
Emmanuel

AW: Removing content

by KÖLL Claus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi if you are using the datastore
you must start the garbage collector

@see http://wiki.apache.org/jackrabbit/DataStore

BR,
claus

-----Ursprüngliche Nachricht-----
Von: Emmanuel Hugonnet [mailto:ehsavoie73@...]
Gesendet: Dienstag, 13. Mai 2008 15:33
An: users@...
Betreff: Removing content


Hi,
I have a nt:file node with its jcr:content child. When I remove my node
(node.remove()) it is correctly removed but the content is still on my
filesystem :( in the repository/datastore/....
How do I delete the content ?
Emmanuel

Re: AW: Removing content

by ehsavoie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It doesn't seem to work :((
Here is my code


session = repository.login(new SimpleCredentials(
          attachment.getWorkerId(), new char[0]));
      Node rootNode = session.getRootNode();
      Node fileNode = rootNode.getNode(attachment.getJcrPath(language));
      Node contentNode = fileNode.getNode(JcrConstants.JCR_CONTENT);
      contentNode.remove();
      fileNode.remove();
      session.save();
      GarbageCollector gc = ((org.apache.jackrabbit.core.SessionImpl) session)
          .createDataStoreGarbageCollector();
      if (gc != null && gc.getDataStore() != null) {
        gc.scan();
        gc.stopScan();
        gc.deleteUnused();
      }

What am I missing ?

(the test on the gc is done because I am using a MemoryDatastore for my JUnit tests)
KÖLL Claus wrote:
hi if you are using the datastore
you must start the garbage collector

@see http://wiki.apache.org/jackrabbit/DataStore

BR,
claus

-----Ursprüngliche Nachricht-----
Von: Emmanuel Hugonnet [mailto:ehsavoie73@gmail.com]
Gesendet: Dienstag, 13. Mai 2008 15:33
An: users@jackrabbit.apache.org
Betreff: Removing content


Hi,
I have a nt:file node with its jcr:content child. When I remove my node
(node.remove()) it is correctly removed but the content is still on my
filesystem :( in the repository/datastore/....
How do I delete the content ?
Emmanuel

Re: AW: Removing content

by Thomas Müller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have updated the wiki page, maybe this is the problem:

"Objects in the data store are only removed when they are not
reachable (that means, objects referenced in the cache or in memory
are not collected)"

To clean the cache, you probably have to close the repository (logout
all sessions) and then log in again. To un-reference objects in memory
you can try calling System.gc() (but this will not always work).

Why do you need to delete the files quickly?

>  I am using a MemoryDatastore

Sounds interesting... Did you write it? Did you consider donating it
to Jackrabbit? You don't have to, but probably it would be interesting
for others as well.

Regards,
Thomas





On Tue, May 13, 2008 at 4:39 PM, ehsavoie <ehsavoie73@...> wrote:

>
>  It doesn't seem to work :((
>  Here is my code
>
>
>  session = repository.login(new SimpleCredentials(
>           attachment.getWorkerId(), new char[0]));
>       Node rootNode = session.getRootNode();
>       Node fileNode = rootNode.getNode(attachment.getJcrPath(language));
>       Node contentNode = fileNode.getNode(JcrConstants.JCR_CONTENT);
>       contentNode.remove();
>       fileNode.remove();
>       session.save();
>       GarbageCollector gc = ((org.apache.jackrabbit.core.SessionImpl)
>  session)
>           .createDataStoreGarbageCollector();
>       if (gc != null && gc.getDataStore() != null) {
>         gc.scan();
>         gc.stopScan();
>         gc.deleteUnused();
>       }
>
>  What am I missing ?
>
>  (the test on the gc is done because I am using a MemoryDatastore for my
>  JUnit tests)
>
>
>
>  KÖLL Claus wrote:
>  >
>  > hi if you are using the datastore
>  > you must start the garbage collector
>  >
>  > @see http://wiki.apache.org/jackrabbit/DataStore
>  >
>  > BR,
>  > claus
>  >
>  > -----Ursprüngliche Nachricht-----
>  > Von: Emmanuel Hugonnet [mailto:ehsavoie73@...]
>  > Gesendet: Dienstag, 13. Mai 2008 15:33
>  > An: users@...
>  > Betreff: Removing content
>  >
>  >
>  > Hi,
>  > I have a nt:file node with its jcr:content child. When I remove my node
>  > (node.remove()) it is correctly removed but the content is still on my
>  > filesystem :( in the repository/datastore/....
>  > How do I delete the content ?
>  > Emmanuel
>  >
>  >
>
>  --
>  View this message in context: http://www.nabble.com/Removing-content-tp17208567p17210140.html
>  Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Re: AW: Removing content

by ehsavoie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Müller a écrit :

> Hi,
>
> I have updated the wiki page, maybe this is the problem:
>
> "Objects in the data store are only removed when they are not
> reachable (that means, objects referenced in the cache or in memory
> are not collected)"
>
> To clean the cache, you probably have to close the repository (logout
> all sessions) and then log in again. To un-reference objects in memory
> you can try calling System.gc() (but this will not always work).
>
> Why do you need to delete the files quickly?
>
>  
>>  I am using a MemoryDatastore
>>    
>
> Sounds interesting... Did you write it? Did you consider donating it
> to Jackrabbit? You don't have to, but probably it would be interesting
> for others as well.
>
> Regards,
> Thomas
>
>
>
>
>
> On Tue, May 13, 2008 at 4:39 PM, ehsavoie <ehsavoie73@...> wrote:
>  
>>  It doesn't seem to work :((
>>  Here is my code
>>
>>
>>  session = repository.login(new SimpleCredentials(
>>           attachment.getWorkerId(), new char[0]));
>>       Node rootNode = session.getRootNode();
>>       Node fileNode = rootNode.getNode(attachment.getJcrPath(language));
>>       Node contentNode = fileNode.getNode(JcrConstants.JCR_CONTENT);
>>       contentNode.remove();
>>       fileNode.remove();
>>       session.save();
>>       GarbageCollector gc = ((org.apache.jackrabbit.core.SessionImpl)
>>  session)
>>           .createDataStoreGarbageCollector();
>>       if (gc != null && gc.getDataStore() != null) {
>>         gc.scan();
>>         gc.stopScan();
>>         gc.deleteUnused();
>>       }
>>
>>  What am I missing ?
>>
>>  (the test on the gc is done because I am using a MemoryDatastore for my
>>  JUnit tests)
>>
>>
>>
>>  KÖLL Claus wrote:
>>  >
>>  > hi if you are using the datastore
>>  > you must start the garbage collector
>>  >
>>  > @see http://wiki.apache.org/jackrabbit/DataStore
>>  >
>>  > BR,
>>  > claus
>>  >
>>  > -----Ursprüngliche Nachricht-----
>>  > Von: Emmanuel Hugonnet [mailto:ehsavoie73@...]
>>  > Gesendet: Dienstag, 13. Mai 2008 15:33
>>  > An: users@...
>>  > Betreff: Removing content
>>  >
>>  >
>>  > Hi,
>>  > I have a nt:file node with its jcr:content child. When I remove my node
>>  > (node.remove()) it is correctly removed but the content is still on my
>>  > filesystem :( in the repository/datastore/....
>>  > How do I delete the content ?
>>  > Emmanuel
>>  >
>>  >
>>
>>  --
>>  View this message in context: http://www.nabble.com/Removing-content-tp17208567p17210140.html
>>  Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>    

I want to have online edition of OpenOffice document using Webdav.
I have two version of the same document : the in progress visible to the
edting user, and the stable version which can be seen by the others.
Currently the file is stored on the filesystem, so when a user wants to
use it, I move it to jakrabbit and provide a webdav link to the file.
When the user wants to share his modifications, I overwrite the file on
the filesystem and delete my node.
I think I will have the same duplication issue when I move completly to
Jackrabbit since I will have my working document and my shared document
even when no work is in progress.
Emmanuel