Bug 780075 (SOA-2441) - FileSystemConnect does not create files
Summary: FileSystemConnect does not create files
Keywords:
Status: CLOSED NOTABUG
Alias: SOA-2441
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: EDS
Version: 5.1.0.ER3
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: ---
Assignee: Van Halbert
QA Contact:
URL: http://jira.jboss.org/jira/browse/SOA...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-19 15:43 UTC by Jiri Pechanec
Modified: 2010-11-02 02:33 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-11-02 02:33:33 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SOA-2441 0 Critical Closed FileSystemConnect does not create files 2013-09-12 16:00:37 UTC

Description Jiri Pechanec 2010-10-19 15:43:01 UTC
project_key: SOA

This code does not work
                Session session = RepositoryReferenceFactory.getRepository("test-file").login();
                ValueFactory vf = session.getValueFactory();

                Node root = session.getRootNode();
                Node file = root.addNode("createfile.mode", "nt:file");
                Node content = file.addNode("jcr:content", "nt:resource");
                content.setProperty("jcr:data", vf.createBinary(new ByteArrayInputStream("Write 1".getBytes())));
                session.save();

                session.getNode("/createfile.mode");

It throws an exception
javax.jcr.PathNotFoundException: Unable to find "{}createfile.mode"; lowest existing path is "/"
        at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:779)
        at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:649)
        at org.modeshape.jcr.JcrSession.getNode(JcrSession.java:106)
        at org.jboss.soa.modeshape.qa.tests.BrokenFileConnectorTest.fileCreate(BrokenFileConnectorTest.java:31)

Connector configuration
                        <mode:source jcr:name="test-file"
                                mode:classname="org.modeshape.connector.filesystem.FileSystemSource"
                                mode:creatingWorkspaceAllowed="true"
                                mode:retryLimit="3"
                                mode:defaultWorkspaceName="default"
                                mode:filenameFilter="*.mode"
                                mode:updatesAllowed="true"
                                >
                                <xsl:attribute name="mode:workspaceRootPath">
                                        <xsl:value-of select="$repositorypath"/>
                                </xsl:attribute>
                                <mode:predefinedWorkspaceNames>file1</mode:predefinedWorkspaceNames>
                                <mode:predefinedWorkspaceNames>file2</mode:predefinedWorkspaceNames>
                                <mode:predefinedWorkspaceNames>custom-federated</mode:predefinedWorkspaceNames>
                        </mode:source>


The file is not physically created after the session.save(). Creating folders works reliably.
This code was worked in ER2.

Comment 1 Van Halbert 2010-10-19 17:39:48 UTC
Link: Added: This issue depends MODE-967


Comment 2 Van Halbert 2010-10-19 19:07:04 UTC
The problem with the above code is that the nt:file node being added is called "createfile.mode", which would be represented on the file system with a "createfile.mode" file. However, you've configured the connector's filename filter to exclude files ending in ".mode", so your file will not be exposed by the connector. The filename filter is used to **hide** files from JCR.

Therefore, marking this issue as 'rejected'. 

Comment 3 Jiri Pechanec 2010-10-20 05:04:22 UTC
From the documentation
filenameFilter - Specifies the FilenameFilter that is used to determine which files and folders in the underlying file system should be exposed through this connector.

So the property defines which files are visible or not. I tried to remove the property and the result is same is with the property set.

Moreover I see two further problems
1) Usability - exclusion is defined by using regular expression for for inclusion I have to provide classname
2) Configuration handling - this source was clearly mis-configured. By mistake I put there a regular expression instead of classname and ModeShape happily allowed me to work with it.

Comment 4 Jiri Pechanec 2010-10-20 15:09:25 UTC
Link: Added: This issue is incorporated by SOA-2447


Comment 5 Van Halbert 2010-10-27 19:33:52 UTC
Regarding the filenameFilter, we need to determine what's the expected behavior is, whether its  for inclusion or exclusion.   Once that's determined, the connector can be fixed accordingly.

As for the misconfiguration, i'll create another jira to track that a validation check should be performed on the filenamFilter value, and throw an exception if its invalid. 

Comment 6 Van Halbert 2010-11-02 02:33:33 UTC
The filenameFilter is suppose to be a class that filters what the user sees, not a pattern.     There's a jira regarding the validation that should be done.


Note You need to log in before you can comment on or make changes to this bug.