3 Replies Latest reply on Nov 14, 2014 5:22 AM by Horia Chiorean

    ModeShape Change Custom Node and Properties at External Resources

    Mustafa Mizrak Newbie

      I add custom type and properties when creating a node at external resource (file system). After session.save(), I want to change custom properties value. However, the previous value does not change.

       

      Does ModeShape not change custom properties at external resources? If so, what does ModeShape provide different than writing binary with FileOutputStream in Java?


      Any help is appreciated!

       

      Best regards,




        • 1. Re: ModeShape Change Custom Node and Properties at External Resources
          Horia Chiorean Master

          What does your configuration look like ? The FSConnector supports (via the configuration) multiple types of extra properties stores: File system connector - ModeShape 4 - Project Documentation Editor

          I want to change custom properties value. However, the previous value does not change.

          How are you changing/reading the values ? Are doing it via the JCR API ?

          If so, what does ModeShape provide different than writing binary with FileOutputStream in Java?

          ModeShape's FileSystemConnector provides a way to project/integrate the repository with an external FS and therefore manipulate files & folders via the JCR API. Extra properties are stored/handled differently depending on the configuration. By default, ModeShape should store these properties in the same place as the regular (repository internal) nodes.

          • 2. Re: Re: ModeShape Change Custom Node and Properties at External Resources
            Mustafa Mizrak Newbie

            External resource configuration:

             

            /subsystem=modeshape/repository=samplerepository/source=sampleextsource:add(classname="org.modeshape.connector.filesystem.FileSystemConnector",properties=[{"directoryPath"=>"/somewhere"}], readonly="false",projections=["default:/extsource => /"], cacheTtlSeconds="1")

             

            Reading and updating property values:

                        // Creating custom type and property
            
                        NodeTypeManager ntm = ...
                        NodeTypeTemplate ntt = ntm.createNodeTypeTemplate();
                        ntt.setName("sometype");
                        ntt.setMixin(true);
            
                        PropertyDefinitionTemplate pdt = ntm.createPropertyDefinitionTemplate();
                        pdt.setName("someproperty");
                        pdt.setRequiredType(PropertyType.STRING);
            
                        ntt.getPropertyDefinitionTemplates().add(pdt);
                        ntm.registerNodeType(ntt, true);
            
                        ...
            
                        Node node = ...
                        node.addMixin("sometype");
                        node.setProperty("someproperty", "sample");
                        node.addMixin(JcrConstants.MIX_REFERENCEABLE);
            
            
            
                        // Changing "someproperty" property value "sample" to "change" in somewhere else.
            
                        session = ...
            
                        Node node = ...
                        node.setProperty("someproperty", "change");
            
                        session.save();
            
            
            
            

             

            However, "someproperty" is still "sample".

             

            With external fs resources, we cannot use versioning, hashed naming and structured binary file organization. That is why I asked:

             

            If so, what does ModeShape provide different than writing binary with FileOutputStream in Java?

             

            Regards.

            • 3. Re: Re: ModeShape Change Custom Node and Properties at External Resources
              Horia Chiorean Master

              It does look like a bug then, since the extra properties should be stored in the ISPN cache. Feel free to open a JIRA for this. Thanks.