jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kazim_ssuet@yahoo.com" <kazim_ss...@yahoo.com>
Subject Extend OraclePersistenceManager
Date Fri, 19 Nov 2010 15:38:00 GMT

Hi,
I need to store node properties seperately (out of bundle) in order to be
able to do reporting on CM data directly from oracle (without going through
API).
Our application uses API but we need to be able to generate reports using
oracle sql and reporting tools.

Is there a hook in Oracle persistance manager where I can write my custom
code while persisting nodes?

I tried extending
"org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager" and
"org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager" as
follows:

public class CsiOraclePersistenceManager extends OraclePersistenceManager
{
	// override storeBundle(...) method from super class
	protected synchronized void storeBundle(NodePropBundle bundle) throws
ItemStateException 
	{
		// Calling super class storeBundle for regular operation
		super.storeBundle(bundle);
                         
		// custom code goes here - post process to persist property/value in
seperate tables
		Iterator iter = bundle.getPropertyEntries().iterator();
		while(iter.hasNext())
		{
			PropertyEntry propertyEntry = (PropertyEntry) iter.next();
			Name propertyEntryName = propertyEntry.getName();
			InternalValue[] values = propertyEntry.getValues();
			for (int i = 0; i < values.length; i++) 
			{
				InternalValue val = values[i];	        
			}
		}

		// write oracle insert/update statement to persist property name/value
	}
}

I am getting following exception:

Exception in thread "main" javax.jcr.RepositoryException: Unable to update
item: node /
	at
org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:145)
	at
org.apache.jackrabbit.rmi.server.ServerSession.save(ServerSession.java:265)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:618)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:309)
	at sun.rmi.transport.Transport$1.run(Transport.java:168)
	at java.security.AccessController.doPrivileged(AccessController.java:279)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:164)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:506)
	at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.handleRequest(TCPTransport.java:838)
	at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:912)
	at java.lang.Thread.run(Thread.java:810)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
	at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at org.apache.jackrabbit.rmi.server.ServerXASession_Stub.save(Unknown
Source)
	at
org.apache.jackrabbit.rmi.client.ClientSession.save(ClientSession.java:272)
	at JackrabbitTest.addContent(JackrabbitTest.java:979)
	at JackrabbitTest.addContent(JackrabbitTest.java:780)
	at JackrabbitTest.main(JackrabbitTest.java:188)

Am I doing things the right way? 
Any ideas how to extend persistance functionality to add my custom code?

Thanks,
KS
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Extend-OraclePersistenceManager-tp3050526p3050526.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Mime
View raw message