Examples of MetaInf


Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

        PackageManager packageManager = mock(PackageManager.class);
        VaultPackage vaultPackage = mock(VaultPackage.class);
        File file = mock(File.class);
        when(file.getAbsolutePath()).thenReturn("/path/to/file");
        when(vaultPackage.getFile()).thenReturn(file);
        MetaInf inf = mock(MetaInf.class);
        when(vaultPackage.getMetaInf()).thenReturn(inf);
        when(packageManager.assemble(any(Session.class), any(ExportOptions.class), any(File.class))).thenReturn(vaultPackage);
        when(packaging.getPackageManager()).thenReturn(packageManager);

        ResourceResolver resourceResolver = mock(ResourceResolver.class);
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

    private final String action;

    public FileVaultReplicationPackage(VaultPackage pkg) {
        this.pkg = pkg;
        MetaInf metaInf = pkg.getMetaInf();
        String[] paths = new String[0];
        if (metaInf != null) {
            WorkspaceFilter filter = metaInf.getFilter();
            if (filter == null) {
                filter = new DefaultWorkspaceFilter();
            }
            List<PathFilterSet> filterSets = filter.getFilterSets();
            paths = new String[filterSets.size()];
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

     * {@inheritDoc}
     */
    public void unwrap(Archive archive, boolean autoSave)
            throws RepositoryException, IOException {
        if (archive != null) {
            MetaInf inf = archive.getMetaInf();
            // explode definition if present
            if (inf.hasDefinition()) {
                extractDefinition(archive, false);
            }
            if (inf.getFilter() != null) {
                writeFilter(inf.getFilter(), false);
            }
            if (inf.getProperties() != null) {
                writeProperties(inf.getProperties(), false);
            }
        }
        defNode.setProperty("unwrapped", (Value) null);
        defNode.setProperty(PN_LAST_UNWRAPPED, Calendar.getInstance());
        if (autoSave) {
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

            RepositoryAddress mp =
                    new RepositoryAddress(uri.toString());
            log.info("Mounting JcrFs on {}", mp.toString());

            ExportRoot exportRoot = ExportRoot.findRoot(getPlatformFile("", true));
            MetaInf inf = exportRoot == null ? null : exportRoot.getMetaInf();

            // get config
            VaultFsConfig jcrfsConfig = null;
            if (config != null) {
                File configFile = new File(config);
                if (configFile.canRead()) {
                    jcrfsConfig = AbstractVaultFsConfig.load(configFile);
                    log.info("using {}", configFile.getCanonicalPath());
                }
            }
            if (jcrfsConfig == null && inf != null) {
                jcrfsConfig = inf.getConfig();
                if (jcrfsConfig != null) {
                    log.info("using config from {}", exportRoot.getMetaDir().getPath());
                }
            }
            if (jcrfsConfig == null) {
                log.info("using embeded default config");
            }
            // get workspace filter
            WorkspaceFilter wspFilter = null;
            if (filter != null) {
                File filterFile = new File(filter);
                if (filterFile.canRead()) {
                    wspFilter = new DefaultWorkspaceFilter();
                    ((DefaultWorkspaceFilter) wspFilter).load(filterFile);
                    log.info("using {}", filterFile.getCanonicalPath());
                }
            }
            if (wspFilter == null && inf != null) {
                wspFilter = inf.getFilter();
                if (wspFilter != null) {
                    log.info("using filter from {}", exportRoot.getMetaDir().getPath());
                }
            }
            if (wspFilter == null) {
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

            log.error(msg);
            bin.dispose();
            throw new IOException(msg);
        }

        final MetaInf inf = archive.getMetaInf();
        PackagePropertiesImpl props = new PackagePropertiesImpl() {
            @Override
            protected Properties getPropertiesMap() {
                return inf.getProperties();
            }
        };
        PackageId pid = props.getId();

        // invalidate pid if path is unknown
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

            }
            addr = new RepositoryAddress("/" + s.getWorkspace().getName() + mountPath);
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException(e);
        }
        MetaInf metaInf = opts.getMetaInf();
        if (metaInf == null) {
            metaInf = new DefaultMetaInf();
        }
        VaultFileSystem jcrfs = Mounter.mount(metaInf.getConfig(), metaInf.getFilter(), addr, opts.getRootPath(), s);
        JarExporter exporter = new JarExporter(out);
        exporter.setProperties(metaInf.getProperties());
        if (opts.getListener() != null) {
            exporter.setVerbose(opts.getListener());
        }
        if (opts.getPostProcessor() != null) {
            exporter.export(jcrfs.getRoot(), true);
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

    /**
     * {@inheritDoc}
     */
    public void rewrap(ExportOptions opts, VaultPackage src, OutputStream out)
            throws IOException {
        MetaInf metaInf = opts.getMetaInf();
        if (metaInf == null) {
            metaInf = new DefaultMetaInf();
        }
        JarExporter exporter = new JarExporter(out);
        exporter.open();
        exporter.setProperties(metaInf.getProperties());
        ProgressTracker tracker = null;
        if (opts.getListener() != null) {
            tracker = new ProgressTracker();
            exporter.setVerbose(opts.getListener());
        }

        // merge
        MetaInf inf = opts.getMetaInf();
        ZipFile zip = new ZipFile(src.getFile(), ZipFile.OPEN_READ);
        if (opts.getPostProcessor() == null) {
            // no post processor, we keep all files except the properties
            Enumeration e = zip.entries();
            while (e.hasMoreElements()) {
                ZipEntry entry = (ZipEntry) e.nextElement();
                String path = entry.getName();
                if (!path.equals(Constants.META_DIR + "/" + Constants.PROPERTIES_XML)) {
                    exporter.write(zip, entry);
                }
            }
        } else {
            Set<String> keep = new HashSet<String>();
            keep.add(Constants.META_DIR + "/");
            keep.add(Constants.META_DIR + "/" + Constants.NODETYPES_CND);
            keep.add(Constants.META_DIR + "/" + Constants.CONFIG_XML);
            keep.add(Constants.META_DIR + "/" + Constants.FILTER_XML);
            Enumeration e = zip.entries();
            while (e.hasMoreElements()) {
                ZipEntry entry = (ZipEntry) e.nextElement();
                String path = entry.getName();
                if (!path.startsWith(Constants.META_DIR + "/") || keep.contains(path)) {
                    exporter.write(zip, entry);
                }
            }
        }
        zip.close();

        // write updated properties
        ByteArrayOutputStream tmpOut = new ByteArrayOutputStream();
        inf.getProperties().storeToXML(tmpOut, "FileVault Package Properties", "utf-8");
        exporter.writeFile(new ByteArrayInputStream(tmpOut.toByteArray()), Constants.META_DIR + "/" + Constants.PROPERTIES_XML);
        if (tracker != null) {
            tracker.track("A", Constants.META_DIR + "/" + Constants.PROPERTIES_XML);
        }

View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

            return;
        }
        log.info("unwrapping package {}", pack == null ? "(unknown)" : pack.getId());
        long now = System.currentTimeMillis();
        if (pack != null && pack.getFile() != null) {
            MetaInf inf = pack.getMetaInf();
            // explode definition if present
            if (inf.hasDefinition()) {
                extractDefinition(pack.getArchive(), false);
            }
            if (inf.getFilter() != null) {
                writeFilter(inf.getFilter(), false);
            }
            if (inf.getProperties() != null) {
                writeProperties(inf.getProperties(), false);
            }
        }
        defNode.setProperty("unwrapped", (Value) null);
        defNode.setProperty(PN_LAST_UNWRAPPED, Calendar.getInstance());
        if (autoSave) {
View Full Code Here

Examples of org.apache.jackrabbit.vault.fs.config.MetaInf

            RepositoryAddress mp =
                    new RepositoryAddress(uri.toString());
            log.info("Mounting JcrFs on {}", mp.toString());

            ExportRoot exportRoot = ExportRoot.findRoot(getPlatformFile("", true));
            MetaInf inf = exportRoot == null ? null : exportRoot.getMetaInf();

            // get config
            VaultFsConfig jcrfsConfig = null;
            if (config != null) {
                File configFile = new File(config);
                if (configFile.canRead()) {
                    jcrfsConfig = AbstractVaultFsConfig.load(configFile);
                    log.info("using {}", configFile.getCanonicalPath());
                }
            }
            if (jcrfsConfig == null && inf != null) {
                jcrfsConfig = inf.getConfig();
                if (jcrfsConfig != null) {
                    log.info("using config from {}", exportRoot.getMetaDir().getPath());
                }
            }
            if (jcrfsConfig == null) {
                log.info("using embeded default config");
            }
            // get workspace filter
            WorkspaceFilter wspFilter = null;
            if (filter != null) {
                File filterFile = new File(filter);
                if (filterFile.canRead()) {
                    wspFilter = new DefaultWorkspaceFilter();
                    ((DefaultWorkspaceFilter) wspFilter).load(filterFile);
                    log.info("using {}", filterFile.getCanonicalPath());
                }
            }
            if (wspFilter == null && inf != null) {
                wspFilter = inf.getFilter();
                if (wspFilter != null) {
                    log.info("using filter from {}", exportRoot.getMetaDir().getPath());
                }
            }
            if (wspFilter == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.