11 Replies Latest reply on Jul 14, 2011 2:58 PM by riboriori

    Querying a repository

    riboriori

      Hi all, i have a filesystem based repository with modeshape and i'm using it into a seam 3 ear packaged application, integrating modeshape with

      seam-jcr module.

      In order to get repository and session objects as stated in the official documentation of seam-jcr, in a class of the service layer i use:

       

      public class RepositoryManager{

       

       

      @Inject

      @JcrConfiguration(name="org.modeshape.jcr.URL",value="vfs:/C:/jboss-6.0.0.Final/server/default/deploy/modeshape-services.jar/modeshape-config.xml?repositoryName=fileSystemRepository")

      private transient Repository repository;

       

      @Inject

      @JcrConfiguration(name="org.modeshape.jcr.URL",value="vfs:/C:/jboss-6.0.0.Final/server/default/deploy/modeshape-services.jar/modeshape-config.xml?repositoryName=fileSystemRepository")

      private transient Session session;

       

       

      //various methods

      }

       

      In a method i want to list all nodes of my repository (i have under root node folders and files), with this code:

      String jcrQueryStatement = " SELECT file.* FROM [nt:file] AS file ";

       

      QueryResult queryResult = getQueryManager().createQuery(jcrQueryStatement, Query.JCR_SQL2).execute();

      NodeIterator nodeIterator = queryResult.getNodes();

       

       

      But nodeIterator variable is empty. Can anyone help me? i'm new to jcr...

      Best regards

        • 1. Re: Querying a repository
          rhauch

          Your query should work and your code looks to be correct, though I haven't actually verified that with code and a compiler.

           

          One quirk of ModeShape is that, upon the first startup, index the entire repository content so that searching and queries will work. If there is already content (e.g., existing files on the file system used by your file system connector), then this may take a while, depending upon the size of the content. If you are submitting your queries before this indexing finishes (or even before the first batch of indexing completes), there will be nothing in the indexes and thus nothing in the results.

           

          I would suggest a couple of things.

           

          First, try this query, which should return all nodes in the workspace: "SELECT * FROM [nt:base]". If that returns nothing, have your app find some nodes using the JCR API to make sure that your workspace does indeed have some content and that it matches what you think should be there. If there's no content or it doesn't match what's on the file system, then your workspace might indeed be empty and you might not be correctly configuring the file system and its workspaces.

           

          Second, make sure that when ModeShape starts, it will not allow any clients to create sessions until it finishes indexing the content. This probably isn't something you want to do in your production app, but it's something that will make your prototyping a lot easier. The "QUERY_INDEXES_REBUILT_SYNCHRONOUSLY" repository option controls this, so just make sure that you're not changing this to 'false'.

           

          If you try both of these things and it's still not working, please share your configuration file so we can help diagnose what's going wrong. Also, please let us know what version of ModeShape you're using.

          • 2. Re: Querying a repository
            riboriori

            My modeshape version is 2.5 final.

            Nodes already exists on filesystem (more precisely, that part of filesystem  pointed by my repository configration).

            By using "SELECT * FROM [nt:base]" i can see only root node; in fact, by typing so:

             

            String jcrQueryStatement = "SELECT * FROM [nt:base] ";

            Query query = getQueryManager().createQuery(jcrQueryStatement, Query.JCR_SQL2);

            NodeIterator nodeIterator = query.execute().getNodes();

             

            while (nodeIterator.hasNext()) {

                  node = (Node)nodeIterator.next();

                  System.out.println("NODE : " + node.getPath());

            }

             

            I can read on console: "NODE : /"

             

            But if i use this code:

             

            NodeIterator it =session.getRootNode().getNodes();

            while(it.hasNext()){

            Node node = (Node)it.next();

            System.out.println(node.getPath());

            }

             

            i can see all child nodes of root node.

             

            Any idea?

             

            • 3. Re: Querying a repository
              rhauch

              Can you please post your ModeShape configuration?

              • 4. Re: Querying a repository
                riboriori

                Hi randall, below my modeshape-config.xml:

                 

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <!-- 
                  ~ ModeShape (http://www.modeshape.org)
                  ~
                  ~ See the COPYRIGHT.txt file distributed with this work for information
                  ~ regarding copyright ownership.  Some portions may be licensed
                  ~ to Red Hat, Inc. under one or more contributor license agreements.
                  ~ See the AUTHORS.txt file in the distribution for a full listing of 
                  ~ individual contributors.
                  ~
                  ~ ModeShape is free software. Unless otherwise indicated, all code in ModeShape
                  ~ is licensed to you under the terms of the GNU Lesser General Public License as
                  ~ published by the Free Software Foundation; either version 2.1 of
                  ~ the License, or (at your option) any later version.
                  ~
                  ~ ModeShape is distributed in the hope that it will be useful,
                  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                  ~ or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
                  ~ for more details.
                  ~
                  ~ You should have received a copy of the GNU Lesser General Public License
                  ~ along with this distribution; if not, write to:
                  ~ Free Software Foundation, Inc.
                  ~ 51 Franklin Street, Fifth Floor
                  ~ Boston, MA  02110-1301  USA
                  -->
                <configuration xmlns:mode="http://www.modeshape.org/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
                
                    <!-- Define the JCR repositories -->
                    <mode:repositories>
                        <!-- Specify the source that should be used for the repository -->
                        <mode:repository jcr:name="jpaRepository">
                            <mode:source>jpastore</mode:source>
                            <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names-->
                            <mode:options jcr:primaryType="options">
                                <!-- Should node types appear as nodes under '/jcr:system/jcr:nodeTypes'? -->
                                <mode:option jcr:name="projectNodeTypes" mode:value="true"/>
                                      <!-- The name of the JAAS application policy, used when clients get a session with credentials.
                                             (This policy is defined in the 'jboss-modeshape-beans.xml' file). -->
                                <mode:option jcr:name="jaasLoginConfigName" mode:value="modeshape"/>
                            </mode:options>
                            <!-- Define any custom node types. Importing CND files via JcrConfiguration is equivalent to specifying here.-->
                            <jcr:nodeTypes>
                                <mode:resource>/org/modeshape/sequencer/teiid/teiid.cnd</mode:resource>
                                <mode:resource>/org/modeshape/connector/meta/jdbc/connector-metajdbc.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/classfile/sequencer-classfile.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/image/images.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/java/javaSource.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/mp3/mp3.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/msoffice/msoffice.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/text/sequencer-text.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/xml/xml.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/zip/zip.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/StandardDdl.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/dialect/derby/DerbyDdl.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/dialect/oracle/OracleDdl.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/dialect/postgres/PostgresDdl.cnd</mode:resource>
                            </jcr:nodeTypes>
                            <!-- Define what the initial content looks like for each workspace -->
                            <mode:initialContent mode:workspaces="default" mode:applyToNewWorkspaces="true" mode:content="modeshape-initial-content.xml"/>
                        </mode:repository>     
                
                
                
                        <mode:repository jcr:name="fileSystemRepository">
                            <mode:source>FS Store</mode:source>
                            <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names-->
                            <mode:options jcr:primaryType="options">
                                <!-- Should node types appear as nodes under '/jcr:system/jcr:nodeTypes'? -->
                                <mode:option jcr:name="projectNodeTypes" mode:value="true"/>
                                      <!-- The name of the JAAS application policy, used when clients get a session with credentials.
                                             (This policy is defined in the 'jboss-modeshape-beans.xml' file). -->
                                <mode:option jcr:name="jaasLoginConfigName" mode:value="modeshape"/>
                            </mode:options>
                            <!-- Define any custom node types. Importing CND files via JcrConfiguration is equivalent to specifying here.-->
                            <jcr:nodeTypes>
                                <mode:resource>/org/modeshape/sequencer/teiid/teiid.cnd</mode:resource>
                                <mode:resource>/org/modeshape/connector/meta/jdbc/connector-metajdbc.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/classfile/sequencer-classfile.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/image/images.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/java/javaSource.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/mp3/mp3.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/msoffice/msoffice.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/text/sequencer-text.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/xml/xml.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/zip/zip.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/StandardDdl.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/dialect/derby/DerbyDdl.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/dialect/oracle/OracleDdl.cnd</mode:resource>
                                <mode:resource>/org/modeshape/sequencer/ddl/dialect/postgres/PostgresDdl.cnd</mode:resource>
                            </jcr:nodeTypes>
                            <!-- Define what the initial content looks like for each workspace -->
                            <mode:initialContent mode:workspaces="dev" mode:applyToNewWorkspaces="true" mode:content="modeshape-initial-content.xml"/>
                        </mode:repository>
                
                
                
                
                
                
                    </mode:repositories>
                
                
                    <!-- Define the sources used by the repository (or repositories) to store and access the content -->
                    <mode:sources jcr:primaryType="nt:unstructured">
                        <mode:source jcr:name="store" 
                                     mode:classname="org.modeshape.graph.connector.inmemory.InMemoryRepositorySource"
                                     mode:retryLimit="3" 
                                     mode:defaultWorkspaceName="default"/>
                
                        <mode:source jcr:name="jpastore"
                                     mode:classname="org.modeshape.connector.store.jpa.JpaSource"
                                     mode:description="The database store for our content"
                                     mode:defaultWorkspaceName="default"
                                     mode:showSql="false"
                                     mode:username="MODESHAPE"
                                     mode:password="modeshape"
                                     mode:dialect="org.hibernate.dialect.Oracle10gDialect"
                                     mode:url="jdbc:oracle:thin:@localhost:1521:XE"
                                     mode:maximumConnectionsInPool="15"
                                     mode:minimumConnectionsInPool="1"
                                     mode:driverClassloaderName="oracle.jdbc.driver.OracleDriver"
                                     mode:autoGenerateSchema="validate"/>
                
                
                
                
                
                        <mode:source jcr:name="FS Store"
                                           mode:classname="org.modeshape.connector.filesystem.FileSystemSource"
                                                 mode:description="The repository for our content"
                                                 mode:workspaceRootPath="C:/Users/Sergio/HOME_MODESHAPE_FS_REPOSITORY"
                                                 mode:defaultWorkspaceName="dev"
                                                 mode:creatingWorkspacesAllowed="false"
                                                 mode:rootNodeUuid="fd129c12-81a8-42ed-aa4b-820dba49e6f0"
                                                 mode:updatesAllowed="true" />
                
                
                    </mode:sources>
                
                    <mode:sequencers>
                                                <!--
                                                These are configured for demonstration purposes, and currently only apply to files uploaded into the 'default' workspace
                                                of the 'store' source.  Adjust the path expressions and use those appropriate for your use case.
                                                -->
                        <mode:sequencer jcr:name="Delimited Text File Sequencer" mode:classname="org.modeshape.sequencer.text.DelimitedTextSequencer">
                            <mode:description>Sequences *.csv text files loaded under '/files', extracting comma-separated and delimited files into columnar information.</mode:description>        
                            <mode:pathExpression>store:default:/files//(*.csv[*])/jcr:content[@jcr:data] => store:default:/sequenced/text/delimited/$1 </mode:pathExpression>
                            <!-- The split pattern is a regular expression used to split each row into columns. -->
                            <mode:splitPattern>,</mode:splitPattern>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="Fixed Width Text File Sequencer" mode:classname="org.modeshape.sequencer.text.FixedWidthTextSequencer">
                            <mode:description>Sequences *.txt fixed-width text files loaded under '/files', extracting splitting rows into columns based on predefined positions.</mode:description>        
                            <mode:pathExpression>store:default:/files//(*.txt[*])/jcr:content[@jcr:data] => store:default:/sequenced/text/fixedWidth/$1 </mode:pathExpression>
                            <!-- The 'columnStartPositions' define the 0-based column start positions. Everything before the 
                                                         first start position is treated as the first column. The default value is the empty string 
                                                         (implying that each row should be treated as a single column). There is an implicit column 
                                                         start position of 0 that never needs to be specified. -->
                                                    <mode:columnStartPositions></mode:columnStartPositions>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="Teiid Model Sequencer" mode:classname="org.modeshape.sequencer.teiid.ModelSequencer">
                            <mode:description>Sequences Teiid relational models (e.g., *.xmi) loaded under '/files', extracting the structure defined in the models.</mode:description>
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only)
                                 but excluding the filename, and places the sequenced content under the same relative path below '/sequenced/teiid/models'. 
                                 For example, if an XMI model is uploaded to '/files/my/favorites/CustomerDetails.xmi', then the sequenced output will be placed at
                                 the '/sequenced/teiid/models/my/favorites/CustomerDetails' node, which will have a primary type of 'xmi:model' and will
                                 contain under it the nodes representing the catalogs, schemas, tables, views, columns, etc. Of course, the 
                                 path expression can be modified as needed; for example, to include the filename of the XMI model in the 
                                 sequenced output path. -->
                            <mode:pathExpression>store:default:/files(//)(*.xmi[*])/jcr:content[@jcr:data] => store:default:/sequenced/teiid/models$1 </mode:pathExpression>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="Teiid VDB Sequencer" mode:classname="org.modeshape.sequencer.teiid.VdbSequencer">
                            <mode:description>Sequences Teiid Virtual Databases (e.g., *.vdb) loaded under '/files', extracting the VDB metadata and the structure defined in the VDB's relational models.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only) 
                                 but excluding the filename, and places the sequenced content under the same relative path below '/sequenced/teiid/models'. 
                                 For example, if a VDB file is uploaded to '/files/my/favorites/Customers.vdb', then the sequenced output will be placed at
                                 the '/sequenced/teiid/models/my/favorites/Customer' node, which will have a primary type of 'vdb:virtualDatabase' and will
                                 contain under it the nodes representing the models (which will each contain the nodes representing that
                                 model's catalogs, schemas, tables, views, columns, etc.).  Of course, the path expression
                                 can be modified as needed; for example, to include the filename of the XMI model in the sequenced output path. -->
                            <mode:pathExpression>store:default:/files(//)(*.vdb[*])/jcr:content[@jcr:data] => store:default:/sequenced/teiid/vdbs$1 </mode:pathExpression>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="Class File Sequencer" mode:classname="org.modeshape.sequencer.classfile.ClassFileSequencer">
                            <mode:description>Sequences Java class files loaded under '/files', extracting structural information.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only)
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/class'. 
                                 For example, if a classfile is uploaded to '/files/my/favorites/org/example/Customers.class', then the sequenced output will be placed at
                                 the '/sequenced/class/org/example/Customers.class' node, which will have a primary type of 'nt:unstructured'
                                 and will contain under it a 'class:class' for each Java class, under which are the nodes representing the
                                 methods, fields, constructors, and annotations. Of course, the path expression can be modified as needed. -->
                            <mode:pathExpression>store:default:/files(//(*.class[*]))/jcr:content[@jcr:data] => store:default:/sequenced/class/$1 </mode:pathExpression>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="Java File Sequencer" mode:classname="org.modeshape.sequencer.java.JavaMetadataSequencer">
                            <mode:description>Sequences Java source files loaded under '/files', extracting structural information.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only)
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/java'. 
                                 For example, if a classfile is uploaded to '/files/my/favorites/org/example/Customers.java', then the sequenced output will be placed at
                                 the '/sequenced/class/org/example/Customers.java' node, which will have a primary type of 'nt:unstructured'
                                 and will contain under it a 'class:class' for each Java class, under which are the nodes representing the
                                 methods, fields, constructors, and annotations. Of course, the path expression can be modified as needed. -->
                            <mode:pathExpression>store:default:/files(//(*.java[*]))/jcr:content[@jcr:data] => store:default:/sequenced/java/$1 </mode:pathExpression>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="CND File Sequencer" mode:classname="org.modeshape.sequencer.cnd.CndSequencer">
                            <mode:description>Sequences CND files loaded under '/files', extracting the contained node type definitions.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only)
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/cnd'. 
                                 For example, if a CND file is uploaded to '/files/my/favorites/Customers.cnd', then the sequenced output will be placed at
                                 the '/sequenced/ddl/my/favorites/Customer.cnd' node, which will have a primary type of 'nt:unstructured' and will
                                 contain under it the 'nt:nodeType', 'nt:propertyDefinition' and 'nt:childNodeDefinition' nodes representing 
                                 the node types, property definitions, and child node definitions contained within the CND file.
                                 Of course, the path expression can be modified as needed; for example, to exclude the filename extension, 
                                 or to exclude the relative path. -->
                            <mode:pathExpression>store:default:/files(//(*.cnd[*]))/jcr:content[@jcr:data] => store:default:/sequenced/cnd/$1 </mode:pathExpression>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="DDL File Sequencer" mode:classname="org.modeshape.sequencer.ddl.DdlSequencer">
                            <mode:description>Sequences DDL files loaded under '/files', extracting the structured abstract syntax tree of the DDL commands and expressions.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only)
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/ddl'. 
                                 For example, if a DDL file is uploaded to '/files/my/favorites/Customers.ddl', then the sequenced output will be placed at
                                 the '/sequenced/ddl/my/favorites/Customer.ddl' node, which will have a primary type of 'nt:unstructured' and will
                                 contain under it the nodes representing the DDL statements. Of course, the path expression
                                 can be modified as needed; for example, to exclude the filename extension, or to exclude the relative path. -->
                            <mode:pathExpression>store:default:/files(//(*.ddl[*]))/jcr:content[@jcr:data] => store:default:/sequenced/ddl/$1 </mode:pathExpression>
                        </mode:sequencer>     
                        <mode:sequencer jcr:name="MS Office File Sequencer" mode:classname="org.modeshape.sequencer.msoffice.MSOfficeMetadataSequencer">
                            <mode:description>Sequences Microsoft Office documents and presentations under '/files', extracting summary information and structure.</mode:description>        
                            <mode:pathExpression>store:default:/files//(*.(xls|ppt|doc)[*])/jcr:content[@jcr:data] => store:default:/sequenced/msoffice/$1 </mode:pathExpression>
                        </mode:sequencer>
                        <mode:sequencer jcr:name="XSD File Sequencer" mode:classname="org.modeshape.sequencer.xsd.XsdSequencer">
                            <mode:description>Sequences XSD files loaded into the repository under '/files', extracting the contents into the equivalent JCR graph structure.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only), 
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/xsd'. 
                                 For example, if an XSD file is uploaded to '/files/my/favorites/Customers.xsd', then the sequenced output will be placed at
                                 the '/sequenced/wsdl/my/favorites/Customer.xsd' node, which will have a primary type of 'xs:schemaDocument' and will
                                 contain under it the nodes representing the XSD components. Of course, the path expression
                                 can be modified as needed; for example, to exclude the filename extension, or to exclude the relative path. -->
                            <mode:pathExpression>/files(//)*.xsd[*]/jcr:content[@jcr:data] => /sequenced/xsd/$1 </mode:pathExpression>
                        </mode:sequencer>  
                        <mode:sequencer jcr:name="WSDL File Sequencer" mode:classname="org.modeshape.sequencer.wsdl.WsdlSequencer">
                            <mode:description>Sequences WSDL 1.1 files loaded into the repository under '/files', extracting the contents into the equivalent JCR graph structure.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only), 
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/wsdl'. 
                                 For example, if a WSDL file is uploaded to '/files/my/favorites/Customers.wsdl', then the sequenced output will be placed at
                                 the '/sequenced/wsdl/my/favorites/Customer.wsdl' node, which will have a primary type of 'wsdl:wsdlDocument' and will
                                 contain under it the nodes representing the WSDL components. Of course, the path expression
                                 can be modified as needed; for example, to exclude the filename extension, or to exclude the relative path. -->
                            <mode:pathExpression>/files(//)*.wsdl[*]/jcr:content[@jcr:data] => /sequenced/wsdl/$1 </mode:pathExpression>
                        </mode:sequencer>  
                        <mode:sequencer jcr:name="XML File Sequencer" mode:classname="org.modeshape.sequencer.xml.XmlSequencer">
                            <mode:description>Sequences XML files loaded under '/files', extracting the contents into the equivalent JCR graph structure.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only), 
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/xml'. 
                                 For example, if an XML file is uploaded to '/files/my/favorites/Customers.xml', then the sequenced output will be placed at
                                 the '/sequenced/xml/my/favorites/Customer.xml' node, which will have a primary type of 'modexml:document' and will
                                 contain under it the nodes representing the XML elements, attributes, and content nodes. Of course, the path expression
                                 can be modified as needed; for example, to exclude the filename extension, or to exclude the relative path. -->
                            <mode:pathExpression>store:default:/files(//)*.xml[*]/jcr:content[@jcr:data] => store:default:/sequenced/xml/$1 </mode:pathExpression>
                        </mode:sequencer>  
                        <mode:sequencer jcr:name="ZIP File Sequencer" mode:classname="org.modeshape.sequencer.zip.ZipSequencer">
                            <mode:description>Sequences ZIP files loaded under '/files', extracting the archive file contents into the equivalent JCR graph structure of 'nt:file' and 'nt:folder' nodes.</mode:description>        
                            <!-- Note this path expression captures the path below '/files' (in the 'store' source and 'default' workspace only), 
                                 including the filename, and places the sequenced content under the same relative path below '/sequenced/zip'. 
                                 For example, if a ZIP file is uploaded to '/files/my/favorites/Customers.zip', then the sequenced output will be placed at
                                 the '/sequenced/xml/my/favorites/Customer.zip' node, which will have a primary type of 'zip:file'
                                 (a subtype of 'nt:folder') and will contain 'nt:file' and 'nt:folder' nodes for each file and folder (respectively)
                                 in the archive file. Of course, the path expression can be modified as needed; for example, to exclude the 
                                 filename extension, or to exclude the relative path. -->
                            <mode:pathExpression>store:default:/files(//)(*.zip[*])/jcr:content[@jcr:data] => store:default:/sequenced/zip/$1 </mode:pathExpression>
                        </mode:sequencer>                          
                    </mode:sequencers>
                </configuration>
                

                 

                Sorry, it is a bit long...

                • 5. Re: Querying a repository
                  riboriori

                  Any news Randall?

                  • 6. Re: Querying a repository
                    riboriori

                    Randall, a little update: if i switch to jpaRepository as active repository (the db based repository) the query show all expected results.

                    Regards

                    • 7. Re: Querying a repository
                      rhauch

                      If i switch to jpaRepository as active repository (the db based repository) the query show all expected results.

                      Hmm... that sounds strange. Would you mind logging a bug in our JIRA and attaching your configuration file and including your code? Something doesn't sound right. Thanks!

                      • 8. Re: Querying a repository
                        riboriori

                        Randall, before adding a jira issue, i want say to you that i used the modeshape kit for jboss as 6, as mentioned from:

                        http://community.jboss.org/message/574112.

                        I think it is not an official release, it is possible to investigate in that direction?

                        If this dont seems to you a good reason i will add a jira issue.

                        • 9. Re: Querying a repository
                          rhauch

                          I don't think it's the JBoss AS 6, but rather the way the file system content is being indexes (or not indexed).

                           

                          Just to reiterate, you're using the file system connector because you want to access existing files/folders or store files/folders in a particular area on your hard drive, right? Remember, the file system connector doesn't store any/all content; instead, it basically provides JCR API access to some of the files and folders on your system by projecting them as nodes that have a primary type of 'nt:file' and 'nt:folder'.

                           

                          If instead you thought the file system connector worked the same as the JPA, Infinispan, or in-memory connectors and could store any/all content (that is, nodes with any primary type), but you just wanted to store the content on the local file system (rather than in a database, data grid or in-memory), then check out the brand new Disk connector (introduced in ModeShape 2.6.0.Beta1), which will do what I think you want to do. It can do a lot more than the file system connector, and its a lot faster and more flexible.

                           

                          Brian has just recently written a really good article called How To Select The Right Connectors. It's got a lot of great information, so give it a read.

                           

                          However, before you log an issue, I would suggest trying a few more things:

                           

                          1. First, please try with the latest release, 2.6.0.Beta1, which was made available on Monday. There is a JBoss AS 6.x kit on our downloads page, so you don't have to do all the work described by that forum post.
                          2. Second, try removing the "<mode:sequencers>" section from your ModeShape configuration file. This section defines a bunch of sequencers that I suspect you aren't using (at least at the moment). You can always add back in the definitions for the sequencers you do want to use. I don't think having them in your configuration hurts or is causing problems, but there's no point in having them if you don't use them.
                          3. Third, comment out the "<jcr:nodeTypes>" section of each of your repositories - or as many "<mode:resource>" lines that you're not using. Again, there's no point in defining a bunch of node types if you're not using them.
                          4. Fourth, how many files and folders are under "C:/Users/Sergio/HOME_MODESHAPE_FS_REPOSITORY"? In that folder I'd expect to see a folder for each workspace that you logged into (e.g., "dev" or "default" or other workspaces your app created using the JCR API), and under those are the files and folders you are accessing.
                          5. Fifth, try enabling caching on the file system connector. There's an example of configuring caching Chapter 11 of our Reference Guide, and it's also describe in the How To Tune ModeShape for Better Performance article. This will hopefully speed up how the indexing system reads the content.
                          6. Finally, try the Disk connector instead of the file system connector.

                           

                          Hopefully these help. However, if none of them do, go ahead and log the issue.

                          • 10. Re: Querying a repository
                            riboriori

                            Randall, i've posted the jira issue;: https://issues.jboss.org/browse/MODE-1221.

                             

                            However:

                            1) I've removed <mode-sequencers> section from my configuration file

                            2) I've commented <jcr:nodeTypes> section from my configuration file

                            3) Under C:/Users/Sergio/HOME_MODESHAPE_FS_REPOSITORY i have three folders: "dev", "prod" and "staging". Under dev folder (the default

                                  folder specified in configuration file, relative to the file system repository, i have various files and folders, but with that JCR-SQL2 query i got only the

                                 root node).    

                             

                            Now i will try to download the 2.6.0 version.

                            Regards

                            • 11. Re: Querying a repository
                              riboriori

                              Randall, i have in logs of console follow warning:

                              [org.modeshape.connector.filesystem.FileSystemSource] Unable to store "jcr:mixinTypes" property for the file "C:\Users\Sergio\HOME_MODESHAPE_FS_REPOSITORY\dev\files" in the "FS Store" file system source. Check the "extraProperties" setting for this source.

                               

                              You know, i'm new to modeshape: what kind of warn message is this?