Edgar Merino | 1 May 2009 02:32
Picon
Gravatar

OCM: Adding nodes externally (directly using the session)

Hello,

    This is the scenario: I've got an OCM entity (wrapping a node, path 
"/myNode"), I'm adding some resources (images) to the node using the jcr 
Session directly (code below), however when I try to persist changes 
(either using Session#save() or ObjectContentManager#save()) I get: 
javax.jcr.RepositoryException: /: unable to update item.: failed to 
write bundle: 9d42543e-87df-4b0e-82cf-a580e9922fa8. I need to add a list 
of images (nt:file nodes) to myNode, I cannot use OCM's default mapping 
of InputStream as a field in the mapped node, because I need all the 
properties to be Serializable (and InputStream is not Serializable).

    Are you able to see what am I doing wrong? thanks in advance,

Edgar Merino

<!-- CODE THAT GENERATES THE EXCEPTION -->

ObjectContentManager manager = ...; //retrieve manager
OCMNode myOCMNode = new OCMNode();
// ... fill properties ...
manager.insert(myOCMNode);

//obtain the session from the ObjectContentManager

Session session = manager.getSession();
Node entryNode = session.getRootNode().getNode("myNode");
Node fileNode = entryNode.addNode(fileName, "nt:file");
Node imageNode = fileNode.addNode("jcr:content", "nt:resource");
imageNode.setProperty("jcr:mimeType", mimeType);
(Continue reading)

chokdee | 1 May 2009 10:31
Picon

Migrate a versionable node to a hierachie node


Hello 

did someone changed a mix:versionable node to a 'normal' node?

I did not find a solution other than creating a new one and move alle
children to the new node.

Thanks
Juergen

--

-- 
View this message in context: http://www.nabble.com/Migrate-a-versionable-node-to-a-hierachie-node-tp23329901p23329901.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Alfie Kirkpatrick | 1 May 2009 12:25

Observation before node delete

Hi, am wondering if it's possible to hook into change events <before>
they get persisted? In particular we want to access information about a
node before it is deleted, for example its node type or property values.
In some scenarios we may even want to prevent a delete operation if
certain criteria about the node are met/not met, for example by throwing
an exception in the event handler.

The observation API only gives a path and, in Jackrabbit's
implementation, even using a SynchronousEventListener the node is gone
by the time the delete event gets fired. Are there any other hooks
available/feasible? 

An alternative solution might be to somehow get access to the session's
change list before calling save, and then access the deleted node in
another session. But there is no obvious place to get this information
outside the observation framework.

Is anyone else interested in this problem?

Many thanks!

Alfie.

viz06 | 1 May 2009 13:33
Picon
Favicon

Application waiting for database connection


Hi,

I have come across issues whereby jackrabbit calls are waiting for database
connections, this is usually during moderate to high application usage. Only
option left for me would be to restart the application in order to release
the connections. This though even after a long period of inactivity, so it
seems the connections are not been released. I am using JAckrabbit 1.4 with
Websphere 6.1.

Here is the part of thread dump 

"WebContainer : 588" daemon prio=10 tid=0x000000010085bd50 nid=0x5e2 in
Object.wait() [0xfffffffe95cf4000..0xfffffffe95cff7a8]
	at java.lang.Object.wait(Native Method)
	- waiting on <0xfffffffef9a173d0> (a java.lang.Object)
	at java.lang.Object.wait(Object.java:474)
	at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.take(Unknown Source)
	- locked <0xfffffffef9a173d0> (a java.lang.Object)
	at org.apache.jackrabbit.core.data.db.Pool.get(Pool.java:64)
	at
org.apache.jackrabbit.core.data.db.DbDataStore.getConnection(DbDataStore.java:784)
	at
org.apache.jackrabbit.core.data.db.DbDataStore.getRecord(DbDataStore.java:453)
	at
org.apache.jackrabbit.core.value.BLOBInDataStore.getDataRecord(BLOBInDataStore.java:136)
	at
org.apache.jackrabbit.core.value.BLOBInDataStore.getLength(BLOBInDataStore.java:92)
	at org.apache.jackrabbit.core.PropertyImpl.getLength(PropertyImpl.java:192)
	at org.apache.jackrabbit.core.PropertyImpl.getLength(PropertyImpl.java:689)
(Continue reading)

Alessandro Bologna | 1 May 2009 14:24
Picon

Re: Observation before node delete

We had a similar use case, and we decided to simply flag the node with  
a "remove" property, and let the listener remove it. In this way you  
can of course access the node...

Alessandro

On May 1, 2009, at 6:25 AM, "Alfie Kirkpatrick" <Alfie.Kirkpatrick <at> ioko.com 
 > wrote:

> Hi, am wondering if it's possible to hook into change events <before>
> they get persisted? In particular we want to access information  
> about a
> node before it is deleted, for example its node type or property  
> values.
> In some scenarios we may even want to prevent a delete operation if
> certain criteria about the node are met/not met, for example by  
> throwing
> an exception in the event handler.
>
>
>
> The observation API only gives a path and, in Jackrabbit's
> implementation, even using a SynchronousEventListener the node is gone
> by the time the delete event gets fired. Are there any other hooks
> available/feasible?
>
>
>
> An alternative solution might be to somehow get access to the  
> session's
(Continue reading)

Tobias Bocanegra | 1 May 2009 16:19
Favicon

Re: Migrate a versionable node to a hierachie node

what about Node.removeMixin("mix:versionable") ?

regards, toby

On Fri, May 1, 2009 at 10:31 AM, chokdee <bowlingbiker <at> gmail.com> wrote:
>
> Hello
>
> did someone changed a mix:versionable node to a 'normal' node?
>
> I did not find a solution other than creating a new one and move alle
> children to the new node.
>
> Thanks
> Juergen
>
>
>
> --
> View this message in context: http://www.nabble.com/Migrate-a-versionable-node-to-a-hierachie-node-tp23329901p23329901.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

chokdee | 1 May 2009 18:08
Picon

Re: Migrate a versionable node to a hierachie node


Tobias Bocanegra-3 wrote:
> 
> what about Node.removeMixin("mix:versionable") ?
> 
> 

It doesn't work the mixin is defined as a supertypes of  the type I want to
migrate.
removeMixin throws an exception

--

-- 
View this message in context: http://www.nabble.com/Migrate-a-versionable-node-to-a-hierachie-node-tp23329901p23335561.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Tobias Bocanegra | 2 May 2009 21:52
Favicon

Re: Migrate a versionable node to a hierachie node

On Fri, May 1, 2009 at 6:08 PM, chokdee <bowlingbiker <at> gmail.com> wrote:
>
>
>
> Tobias Bocanegra-3 wrote:
>>
>> what about Node.removeMixin("mix:versionable") ?
>>
>>
>
> It doesn't work the mixin is defined as a supertypes of  the type I want to
> migrate.
> removeMixin throws an exception
well, if you want to be able to remove the "versionable" state of a
node, you should make it versionable by adding the resp. mixin in the
first place.
other than that, there is not other solution than creating a node
node, copy all properties and moving the child nodes.

regards, toby

SalmasCM | 3 May 2009 05:36

modified externally: node / when deleting node


I have been trying for weeks to get things working in my application and am
not making any progress.
I don't believe my use case is very unusual and I am hoping that you will be
able to help me.

1. I have a lot of legacy data that I load in using the XML import feature.
Each section is loaded under it's own top level node. The top level nodes
live directly under root.
2. I have 2 workspaces , preview and default. Changes and data loads happen
in preview and are cloned/merged into default.

Everything works if I bulk load the data with the XML import once but falls
apart if I load a all the sections into preview and then clone to default
and then later wish to reload a node with the XML import.

I am unable to reload since it thinks it's a new node so if I reload for
example employees then it creates employees[1] which is not what I want.

I have then 2 options. 
1. to force it to recognize the top node as the same node as previously
loaded, to do this I would have to indicate the UUID for the top node.
However, I have no idea how to make the UUID in the XML data file the same
as it would create when reloading?
2. So I tried to delete the node from both preview and default workspaces
before loading. I ran into many issues and finally succeeded in reloading
the data. However, I ran into issues when I modify any data in preview.

I get 

(Continue reading)

chokdee | 3 May 2009 11:50
Picon

Re: Migrate a versionable node to a hierachie node


Tobias Bocanegra-3 wrote:
> 
> well, if you want to be able to remove the "versionable" state of a
> node, you should make it versionable by adding the resp. mixin in the
> first place.
> other than that, there is not other solution than creating a node
> node, copy all properties and moving the child nodes.
> 

i took a look at the code. It works well, if I do addMixin and removeMixin.

But if I do the same with NodeTypeManager.registerNodeTypes it fails with 

javax.jcr.RepositoryException: The following nodetype change contains
non-trivial changes

I've tried to do the same like removeMixin, but it fails to.

--

-- 
View this message in context: http://www.nabble.com/Migrate-a-versionable-node-to-a-hierachie-node-tp23329901p23354223.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Gmane