Stefan Guggisberg | 1 Oct 2006 16:10
Picon

Re: Concurrent writing to a JCR repository

hi behrang,

On 10/1/06, Behrang Saeedzadeh <behrangsa <at> gmail.com> wrote:
> Hi Again,
>
> I changed a code a bit and surprisingly I'm getting a new exception:
>
> javax.jcr.InvalidItemStateException:
> 6aa4218b-93a6-4a34-b078-42e843baa5b2: the item cannot be saved because
> it has been modified externally.

this exception indicates that you have 2 or more separate sessions
that try to modify
the *same* item (in your case adding nodes to the /positions node).

you can avoid such situations if you lock the node before
you start modifiying it.

cheers
stefan

>         at org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:387)
>         at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1054)
>         at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:805)
>         at org.behrang.practice.jsr170.UserThread.run(Main.java:66)
>         at java.lang.Thread.run(Thread.java:595)
>
> Here's the changed code:
>
> --- --- --- ---
(Continue reading)

Stefan Guggisberg | 1 Oct 2006 16:14
Picon

Re: Concurrent writing to a JCR repository

hi behrang,

On 9/30/06, Behrang Saeedzadeh <behrangsa <at> gmail.com> wrote:
> Hi,
>
> I have written a very simple performance test for Jackrabbit that
> creates 10 threads each saving 1000 simple one-property nodes to the
> repository.
>
> When I run the test, an exception is thrown:
>
> javax.jcr.ItemNotFoundException:

strange, you should be getting an InvalidItemStateException instead
(see my other
reply in this thread).

please open a jira  bug if you're able to reproduce this issue.

> 0cada011-dc27-4531-bfcc-e8dde67532d9/{http://www.jcp.org/jcr/1.0}primaryType
>         at org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:464)
>         at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:320)
>         at org.apache.jackrabbit.core.ItemImpl.restoreTransientItems(ItemImpl.java:708)
>         at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1208)
>         at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:805)
>
>
>
> When I reduce the thread count to 1, the program completes with no
> problem so the problem should be that I am using the JCR API
(Continue reading)

Magnus Grimsell | 1 Oct 2006 17:43
Picon
Favicon

how does authorization works in jackrabbit?

I would like to learn more how JackRabbit handles authorization to the repository content. Especially
when it comes to searching.
I've seen that there is a plugable AccessManager but I'm not sure how this is used to filter the search result.
Can somebody point me to some documentation or where in the code to look?

Michael Neale | 1 Oct 2006 18:59
Picon
Gravatar

Re: how does authorization works in jackrabbit?

Hi Magnus.
Firstly, I think by authorisation in this context you mean access control?
(authorisation is via JAAS I believe).

I worked out a little by plugging in a dummy AccessManager and looked at the
callbacks. I did not try it with searching though, but I gather it will use
it to honour the access rules with returning results - thus your acess list
lookups better be really fast and in memory !

Anyone else with real experience, please do share !

On 10/1/06, Magnus Grimsell <magnus.grimsell <at> idainfront.se> wrote:
>
> I would like to learn more how JackRabbit handles authorization to the
> repository content. Especially when it comes to searching.
> I've seen that there is a plugable AccessManager but I'm not sure how this
> is used to filter the search result.
> Can somebody point me to some documentation or where in the code to look?
>
Michael Neale | 1 Oct 2006 19:00
Yeah Jukka said he was going to update it !

He will, he will... patience !

But it is released ;)

On 9/29/06, Behrang Saeedzadeh <behrangsa <at> gmail.com> wrote:
>
> This is an excerpt from the getting started page:
>
> "Since Jackrabbit is not yet released, in order to get your hands on a
> running Jackrabbit instance you have to download and build it
> yourself. Directions for doing so can be found in the Building
> Jackrabbit section. Once Jackrabbit is up and running, you can take
> your first hops."
>
> I guess it needs to be updated :-)
>
> Regards,
> --
> "We can only see a short distance ahead,
> but we can see plenty there
> that needs to be done." - Alan Turing
>
> "Science is a differential equation. Religion
> is a boundary condition" - Alan Turing
>
> Behrang Saeedzadeh
> http://www.jroller.com/page/behrangsa
> http://my.opera.com/behrangsa
(Continue reading)

Magnus Grimsell | 1 Oct 2006 21:47
Picon
Favicon

SV: how does authorization works in jackrabbit?

Hi Michael,

Yes, I do mean access control.

After looking through the code it seems like the AccessManager will get invoked for every hit in the result list.
I would like to implement a simple access control scheme based on node type. From a performance point of view 
it would be good to avoid a check for every hit. On the other hand its simple to implement a custom
QueryManager that
narrows the search to only include the node types that the subject has access rights to, right? 
Is there a suitable place to do the access control check that does not get called when performing searches?

/Magnus

-----Ursprungligt meddelande-----
Från: Michael Neale [mailto:michael.neale <at> gmail.com]
Skickat: den 1 oktober 2006 19:00
Till: users <at> jackrabbit.apache.org
Ämne: Re: how does authorization works in jackrabbit?

Hi Magnus.
Firstly, I think by authorisation in this context you mean access control?
(authorisation is via JAAS I believe).

I worked out a little by plugging in a dummy AccessManager and looked at the
callbacks. I did not try it with searching though, but I gather it will use
it to honour the access rules with returning results - thus your acess list
lookups better be really fast and in memory !

Anyone else with real experience, please do share !

(Continue reading)

behrangsa | 2 Oct 2006 00:54
Picon
Gravatar

Comparing an RDBMS to JCR


Hi,

The concurrent update capability of JCR is a little bit confusing to me.

In an RDBMS, when I execute the following code sinppet simultaneously by a
few threads, no problem rises:

  tx.being();
  executeUpdate("insert into positions(id, name, parentId) values (?, ?,
1)");
  tx.commit();

In JCR, the equivalent to this seems to be:

  tx.begin();
  Node positions = session.getRootNode().getNode("positions");
  Node pos = positions.addNode("position");
  pos.setProperty("name", "some name");
  tx.commit();

But apparantly this throws an InvalidItemStateException (am I right?) when
multiple sessions concurrently execute this snippet of code. If this is
true, then how can one handle the aforementioned SQL operation in JCR?

Regards,
Behi (via Nabble :-)
--

-- 
View this message in context: http://www.nabble.com/Comparing-an-RDBMS-to-JCR-tf2366850.html#a6593713
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
(Continue reading)

Doug Douglass | 2 Oct 2006 01:09
Picon

Re: Comparing an RDBMS to JCR

Behi,

I think the only thing you're missing is locking. Many (most) RDBMS have
some level of built-in/implicit locking of the table or, better yet the row,
for write operations. This is not true of JCR,  you must explicitly
lock/unlock your nodes to prevent concurrent update attempts.

HTH,
Doug

On 10/1/06, behrangsa <behrangsa <at> gmail.com> wrote:
>
>
> Hi,
>
> The concurrent update capability of JCR is a little bit confusing to me.
>
> In an RDBMS, when I execute the following code sinppet simultaneously by a
> few threads, no problem rises:
>
>   tx.being();
>   executeUpdate("insert into positions(id, name, parentId) values (?, ?,
> 1)");
>   tx.commit();
>
> In JCR, the equivalent to this seems to be:
>
>   tx.begin();
>   Node positions = session.getRootNode().getNode("positions");
>   Node pos = positions.addNode("position");
(Continue reading)

behrangsa | 2 Oct 2006 01:39
Picon
Gravatar

Re: Comparing an RDBMS to JCR


Doug,

Thanks for the reply. Does it imply that using JCR has a __serious__
performance penalty compared to direct access to the database via JDBC, and
even using ORM tools such as EJB3?

BTW - There's a good comparison of JCR to File Systems and DBs available at
http://www.day.com/site/en/index/products/content-centric_infrastructure/content_repository/crx_faq.html

But I am still confused as to when one should consider using JCR* as a
fundamental component of an enterprise project? For what kind of projects
does it make sense to use JCR? Once we consider using JCR, should we
store/retrieve everything via JCR? Or only a portion of the project should
be so?

*JCR or any other CMS (?) API

Regards,
Behi

Doug Douglass-2 wrote:
> 
> Behi,
> 
> I think the only thing you're missing is locking. Many (most) RDBMS have
> some level of built-in/implicit locking of the table or, better yet the
> row,
> for write operations. This is not true of JCR,  you must explicitly
> lock/unlock your nodes to prevent concurrent update attempts.
(Continue reading)

Magnus Grimsell | 2 Oct 2006 11:02
Picon
Favicon

jta transaction without using jca

I would like to configure jackrabbit with db based file system and persistence manager that participates
in the ongoing jta transaction.
I tried out the JNDIDatabasePersistenceManager but since it does explicit commits i ran into trouble.

Caused by: java.sql.SQLException: The method 'commit' cant be called when a global transaction is active.
	at oracle.oc4j.sql.spi.ConnectionHandle.oc4j_throwSQLExceptionIfGlobalTxActive(ConnectionHandle.java:407)
	at oracle.oc4j.sql.spi.ConnectionHandle.commit(ConnectionHandle.java:122)
	at org.apache.jackrabbit.core.state.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:339)

I've read that you are supposed to use JCA to enable jackrabbit to participate in JTA transactions.
However, since our product must
work on a bunch of different application servers I'm a little hesitant to introduce this new requirement.

Has anybody used JTA and jackrabbit without using JCA?

Magnus Grimsell
magnus.grimsell <at> idainfront.se


Gmane