jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim <vadim.ro...@ardas.dp.ua>
Subject Re: How to find file by name?
Date Mon, 23 Nov 2009 14:51:55 GMT
Alexander Klimetschek ?????:
> On Fri, Nov 20, 2009 at 11:39, Vadim <vadim.rozov@ardas.dp.ua> wrote:
>   
>> Hello,
>> I try to find file by name with Query, how can I do this?
>> I try "SELECT * FROM nt:file where name LIKE '%brochure.pdf%'" and
>> "SELECT * FROM nt:file where jcr:path LIKE '%brochure.pdf%'", but it
>> doesn't work.
>>     
>
> See http://markmail.org/message/2ppoe5fxldd7abaw
>
> With it you can only match on exact node names. AFAIK fn:name() has no
> equivalent in SQL, it's not part of the spec and it's a
> Jackrabbit-extension anyway.
>
> Alternatively you can also use jcr:contains / CONTAINS, however this
> will also include full-text matches from within file content:
>
> //element(*, nt:file)[jcr:contains(., '.pdf')
>
> SELECT * FROM nt:file WHERE CONTAINS(., '.pdf')
>
> Regards,
> Alex
>
>   
Thank you for helping ,
sorry for my Nooby questions, but I didn't know exact node name on find 
step and fn:name() can't help me.
I tried to use CONTAINS(., '.pdf'), but that didn't work for me. May be 
I must put name in node property before using contains?
For this reason I created observation listener that write filename as a 
property, but get exception:

Client Event Poller 15:57:26,619 INFO [WebappClassLoader] Illegal 
access: this web application instance has been stopped already. Could 
not load org.apache.jackrabbit.rmi.server.ServerEventCollection_Stub. 
The eventual following stack trace is caused by an error thrown for 
debugging purposes as well as to attempt to terminate the thread which 
caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1244)
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:355)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at 
org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at 
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1544)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:139)
at 
org.apache.jackrabbit.rmi.server.ServerObservationManager_Stub.getNextEvent(Unknown 
Source)
at 
org.apache.jackrabbit.rmi.observation.ClientEventPoll.run(ClientEventPoll.java:199)

My project dependency are:

<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-rmi</artifactId>
<version>1.5.0</version>
</dependency>

<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>1.6.0</version>
</dependency>

<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
<version>1.6.0</version>
</dependency>


Code for registration listener:

if (repository.getDescriptor(
Repository.OPTION_OBSERVATION_SUPPORTED).equals("true")){
NodeAddEventListener nodeEventListener = new NodeAddEventListener();
ObservationManager observationManager = 
session.getWorkspace().getObservationManager();
observationManager.addEventListener(nodeEventListener, 
Event.NODE_ADDED,"/",true,null,null,true);
}

Code of listener:

public class NodeAddEventListener implements EventListener {
private static final Log log = 
LogFactory.getLog(NodeAddEventListener.class);
public void onEvent(EventIterator eventIterator)
{
log.debug("New onEvent !!!!");
}
}
What I can do wrong?

Mime
View raw message