Hi Mathijs, it is difficult to imagine what the problem could be. how exactly do you import the package? when you use the normal file archive it uses the be default the workspace filter from the META-INF/vault/filter.xml but you can override this in the import options.
maybe you can give me an example? regards, toby On Mon, Sep 8, 2014 at 9:50 AM, Mathijs den Burger <[email protected]> wrote: > Hi Toby, > > On Wed, Sep 3, 2014 at 8:27 PM, Tobias Bocanegra <[email protected]> wrote: >> Hi Mathijs, >> >> >> On Wed, Sep 3, 2014 at 1:27 AM, Mathijs den Burger >> <[email protected]> wrote: >>> Hi, >>> >>> I'm forwarding this question to the dev list, which seems more >>> appropriate then the users list. >>> >>> I'm trying to use FileVault to automatically sync a local directory >>> from filesystem into a Hippo repository (which is based on >>> JackRabbit). The main reason for using FileVault is the automatic >>> handling of meta-data in the .content.xml files. >>> >>> So far I've successfully used the Importer class to import an Archive >>> based on files or a zip file. I've also implemented a simple file >>> watcher that triggers a reimport whenever something changes. This >>> nicely imports changes and newly added files and directories. So far >>> so good. >> >> great! >> >>> The problem is that deleting files or directories does not delete >>> their counterparts in JCR. I'd expect that using ImportMode.REPLACE >>> would completely replace the JCR node structure and automatically >>> delete everything that is no longer present in the imported archive, >>> but that's not the case. >> >> how to you setup the WorkspaceFilter ? Only nodes covered by the >> filter are updated. IIRC, if you don't use a filter at all, the >> importer only does updates. > > I did not setup any filter, which made the Importer use a plain > DefaultWorkspaceFilter, which returned an empty list of filter sets. > > So I tried using my own DefaultWorkspaceFilter to which I added > PathFilterSet.INCLUDE_ALL. But to no avail: a deleted file or deleted > directory is still not deleted by the Importer. Also additional nodes > declared in .content.xml files are not deleted when they are deleted > again from the .content.xml files and reimported. > > To summarize: the Importer only seems to process what's in an archive, > and not what's no longer in the archive :) > Still odd, since the javadoc of ImportMode.REPLACE states: > > "Normal behavior. Existing content is replaced completely by the > imported content, i.e. is overridden or deleted accordingly." > >>> Reading through code it seems the vlt tool uses the meta-data in the >>> .vlt directory to track deleted files, which are then processed during >>> a commit. Is there a way to add such meta-data to an Archive or >>> educate the Importer somehow? >> >> The vault cli tool works completely different than the packageing. it >> mimics a subversion like behaviour and is probably unsuited for your >> needs. The main magic is done in the >> org.apache.jackrabbit.vault.fs.impl.TransactionImpl which uses the >> recorded changes to figure out which nodes to sync. > > OK, so then the only options seems to be > > a) delete everything before importing again (which is a bit crude and > won't perform very well for large imports) > b) build up a TransactionImpl from the observed file system changes > and commit that > > Or do I miss a viable alternative? > >>> I've also read through the code of the vault-sync tool, which >>> basically implements my use case. I cannot use it as-is though, since >>> Hippo does not use OSGI. IIUC vault-sync does not use Archives or >>> Packages at all, but uses its own TreeSync class that does lots of >>> plain JCR calls. Does that mean that vault-sync does not process >>> meta-data files at all? >> >> no. currently vault-sync only handle simple files and folders. > > Ah, that's too limited. > > best, > Mathijs
