Package org.apache.jackrabbit.vault.fs.api

Examples of org.apache.jackrabbit.vault.fs.api.VaultInputSource


                    repoBase = repoName.substring(0, idx);
                    ext = repoName.substring(idx);
                }
                SerializationType serType = SerializationType.GENERIC;
                ArtifactType type = ArtifactType.PRIMARY;
                VaultInputSource is = archive.getInputSource(file);
                if (ext.equals(".xml")) {
                    // this can either be an generic exported docview or a 'user-xml' that is imported as file
                    // btw: this only works for input sources that can refetch their input stream
                    serType = XmlAnalyzer.analyze(is);
                    if (serType == SerializationType.XML_DOCVIEW) {
                        // in this case, the extension was added by the exporter.
                        repoName = repoBase;
                    } else {
                        ext = "";
                        serType = SerializationType.GENERIC;
                        type = ArtifactType.FILE;
                    }
                } else if (ext.equals(".cnd")) {
                    if (opts.getCndPattern().matcher(repoPath).matches()) {
                        InputStream in = is.getByteStream();
                        try {
                            Reader r = new InputStreamReader(in, "utf8");
                            CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
                            // provide session namespaces
                            reader.read(r, is.getSystemId(), new NamespaceMapping(resolver));
                            nodeTypes.add(reader);
                            log.debug("Loaded nodetypes from {}.", repoPath);
                        } catch (IOException e1) {
                            log.error("Error while reading CND.", e1);
                        } finally {
View Full Code Here


    public VaultInputSource getInputSource(Entry entry) throws IOException {
        final VirtualEntry ve = (VirtualEntry) entry;
        if (ve == null) {
            return null;
        }
        return new VaultInputSource() {

            @Override
            public String getSystemId() {
                String systemId = super.getSystemId();
                if (systemId == null) {
View Full Code Here

            throws IOException, ConfigurationException {
        DefaultMetaInf inf = new DefaultMetaInf();
        // filter
        for (Entry entry: dir.getChildren()) {
            String name = entry.getName();
            VaultInputSource src = getInputSource(entry);
            if (name.equals(Constants.FILTER_XML)) {
                // load filter
                inf.loadFilter(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.CONFIG_XML)) {
                // load config
                inf.loadConfig(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.SETTINGS_XML)) {
                // load settings
                inf.loadSettings(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.PROPERTIES_XML)) {
                // load properties
                inf.loadProperties(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.PRIVILEGES_XML)) {
                // load privileges
                inf.loadPrivileges(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.PACKAGE_DEFINITION_XML)) {
                inf.setHasDefinition(true);
                log.info("Contains package definition {}.", src.getSystemId());
            } else if (name.endsWith(".cnd")) {
                try {
                    Reader r = new InputStreamReader(src.getByteStream(), "utf8");
                    CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
                    reader.read(r, entry.getName(), null);
                    inf.getNodeTypes().add(reader);
                    log.info("Loaded nodetypes from {}.", src.getSystemId());
                } catch (IOException e1) {
                    log.error("Error while reading CND: {}", e1.toString());
                    if (strict) {
                        throw e1;
                    }
View Full Code Here

            return null;
        }
        try {
            final Node content = ((JcrEntry) entry).node.getNode(JcrConstants.JCR_CONTENT);
            final String systemId = ((JcrEntry) entry).node.getPath();
            return new VaultInputSource() {

                {
                    setSystemId(systemId);
                }
View Full Code Here

        }
        final ZipEntry ze = zip.getEntry(e.zipEntryName);
        if (ze == null) {
            throw new IOException("ZipEntry could not be found: " + e.zipEntryName);
        }
        return new VaultInputSource() {

            {
                setSystemId(ze.getName());
            }
View Full Code Here

                    repoBase = repoName.substring(0, idx);
                    ext = repoName.substring(idx);
                }
                SerializationType serType = SerializationType.GENERIC;
                ArtifactType type = ArtifactType.PRIMARY;
                VaultInputSource is = archive.getInputSource(file);
                if (ext.equals(".xml")) {
                    // this can either be an generic exported docview or a 'user-xml' that is imported as file
                    // btw: this only works for input sources that can refetch their input stream
                    serType = XmlAnalyzer.analyze(is);
                    if (serType == SerializationType.XML_DOCVIEW) {
                        // in this case, the extension was added by the exporter.
                        repoName = repoBase;
                    } else {
                        ext = "";
                        serType = SerializationType.GENERIC;
                        type = ArtifactType.FILE;
                    }
                } else if (ext.equals(".cnd")) {
                    if (opts.getCndPattern().matcher(repoPath).matches()) {
                        InputStream in = is.getByteStream();
                        try {
                            Reader r = new InputStreamReader(in, "utf8");
                            CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
                            // provide session namespaces
                            reader.read(r, is.getSystemId(), new NamespaceMapping(resolver));
                            nodeTypes.add(reader);
                            log.debug("Loaded nodetypes from {}.", repoPath);
                        } catch (IOException e1) {
                            log.error("Error while reading CND.", e1);
                        } finally {
View Full Code Here

     *
     * @return a input source which systemId is the path of the underlying property
     */
    public VaultInputSource getInputSource() throws IOException, RepositoryException {
        final InputStream in = getInputStream();
        return new VaultInputSource() {

            @Override
            public String getSystemId() {
                return path;
            }
View Full Code Here

            size = out.getData().length;
        } else {
            in = new TempFileInputStream(out.getFile());
            size = out.getFile().length();
        }
        return new VaultInputSource() {

            @Override
            public String getSystemId() {
                return SerializerArtifact.this.getRelativePath();
            }
View Full Code Here

                    repoBase = repoName.substring(0, idx);
                    ext = repoName.substring(idx);
                }
                SerializationType serType = SerializationType.GENERIC;
                ArtifactType type = ArtifactType.PRIMARY;
                VaultInputSource is = archive.getInputSource(file);
                if (ext.equals(".xml")) {
                    // this can either be an generic exported docview or a 'user-xml' that is imported as file
                    // btw: this only works for input sources that can refetch their input stream
                    serType = XmlAnalyzer.analyze(is);
                    if (serType == SerializationType.XML_DOCVIEW) {
                        // in this case, the extension was added by the exporter.
                        repoName = repoBase;
                    } else {
                        ext = "";
                        serType = SerializationType.GENERIC;
                        type = ArtifactType.FILE;
                    }
                } else if (ext.equals(".cnd")) {
                    if (opts.getCndPattern().matcher(repoPath).matches()) {
                        InputStream in = is.getByteStream();
                        try {
                            Reader r = new InputStreamReader(in, "utf8");
                            CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
                            // provide session namespaces
                            reader.read(r, is.getSystemId(), new NamespaceMapping(resolver));
                            nodeTypes.add(reader);
                            log.debug("Loaded nodetypes from {}.", repoPath);
                        } catch (IOException e1) {
                            log.error("Error while reading CND.", e1);
                        } finally {
View Full Code Here

            throws IOException, ConfigurationException {
        DefaultMetaInf inf = new DefaultMetaInf();
        // filter
        for (Entry entry: dir.getChildren()) {
            String name = entry.getName();
            VaultInputSource src = getInputSource(entry);
            if (name.equals(Constants.FILTER_XML)) {
                // load filter
                inf.loadFilter(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.CONFIG_XML)) {
                // load config
                inf.loadConfig(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.SETTINGS_XML)) {
                // load settings
                inf.loadSettings(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.PROPERTIES_XML)) {
                // load properties
                inf.loadProperties(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.PRIVILEGES_XML)) {
                // load privileges
                inf.loadPrivileges(src.getByteStream(), src.getSystemId());
            } else if (name.equals(Constants.PACKAGE_DEFINITION_XML)) {
                inf.setHasDefinition(true);
                log.info("Contains package definition {}.", src.getSystemId());
            } else if (name.endsWith(".cnd")) {
                try {
                    Reader r = new InputStreamReader(src.getByteStream(), "utf8");
                    CNDReader reader = ServiceProviderFactory.getProvider().getCNDReader();
                    reader.read(r, entry.getName(), null);
                    inf.getNodeTypes().add(reader);
                    log.info("Loaded nodetypes from {}.", src.getSystemId());
                } catch (IOException e1) {
                    log.error("Error while reading CND: {}", e1.toString());
                    if (strict) {
                        throw e1;
                    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.vault.fs.api.VaultInputSource

Copyright © 2018 www.massapicom. 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.