Package org.apache.cocoon.components.source.helpers

Examples of org.apache.cocoon.components.source.helpers.SourceCredential


        Configuration[] drivers = conf.getChildren("driver");
        for (int i = 0; i < drivers.length; i++) {
            String type = drivers[i].getAttribute("type");
            String driver = drivers[i].getAttribute("class");

            SourceCredential credential = new SourceCredential(null, null);
            credential.setPrincipal(drivers[i].getAttribute("user", null));
            credential.setPassword(drivers[i].getAttribute("password", null));
            credentialMap.put(type, credential);
           
            String base = drivers[i].getAttribute("collection", null);
            if (base != null && base.length() > 0) {
                // Ensure the base collection ends with a '/'
View Full Code Here


            throw new MalformedURLException("Mispelled XML:DB URL. " +
                                            "The syntax is \"xmldb:databasetype://host/collection/resource\"");
        }

        String type = location.substring(start, end);
        SourceCredential credential = (SourceCredential)credentialMap.get(type);
       
        if (credential == null) {
            throw new MalformedURLException("xmldb type '" + type + "' is unknown for URL " + location);
        }
       
        String base = (String)baseMap.get(type);

        if (base != null && base.length() > 0) {
            String path = location.substring(end+1);
            if (!path.startsWith("//")) {
                // URL is not absolute, add base, avoiding to double the '/'
                if (path.charAt(0) == '/') {
                    path = path.substring(1);
                }
                location = location.substring(0, end + 1) + base + path;
            }
        }

        return new XMLDBSource(this.getLogger(), credential.getPrincipal(), credential.getPassword(), location);
    }
View Full Code Here

        String branch = queryParameters.getParameter("cocoon-source-branch",
                            null);

        getLogger().debug("Used prinical '"+principal+"' for source");

        SourceCredential credential;

        if (password!=null) {
            credential = new SourceCredential(principal, password);
        } else {
            credential = new SourceCredential(principal);
        }

        if (path.length()==0) {
            path = "/";
        }
View Full Code Here

        Configuration[] drivers = conf.getChildren("driver");
        for (int i = 0; i < drivers.length; i++) {
            String type = drivers[i].getAttribute("type");
            String driver = drivers[i].getAttribute("class");

            SourceCredential credential = new SourceCredential(null, null);
            credential.setPrincipal(drivers[i].getAttribute("user", null));
            credential.setPassword(drivers[i].getAttribute("password", null));
            credentialMap.put(type, credential);

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Initializing XML:DB connection, using driver " + driver);
            }
View Full Code Here

            throw new MalformedURLException("Mispelled XML:DB URL. " +
                                            "The syntax is \"xmldb:databasetype://host/collection/resource\"");
        }

        String type = location.substring(start, end);
        SourceCredential credential = (SourceCredential)credentialMap.get(type);

        return new XMLDBSource(this.getLogger(),
                               credential, location,
                               this.m_manager,
                               this.context);
View Full Code Here

        Configuration[] drivers = conf.getChildren("driver");
        for (int i = 0; i < drivers.length; i++) {
            String type = drivers[i].getAttribute("type");
            String driver = drivers[i].getAttribute("class");

            SourceCredential credential = new SourceCredential(null, null);
            credential.setPrincipal(drivers[i].getAttribute("user", null));
            credential.setPassword(drivers[i].getAttribute("password", null));
            credentialMap.put(type, credential);
           
            String base = drivers[i].getAttribute("collection", null);
            if (base != null && base.length() > 0) {
                // Ensure the base collection ends with a '/'
View Full Code Here

            throw new MalformedURLException("Mispelled XML:DB URL. " +
                                            "The syntax is \"xmldb:databasetype://host/collection/resource\"");
        }

        String type = location.substring(start, end);
        SourceCredential credential = (SourceCredential)credentialMap.get(type);
       
        if (credential == null) {
            throw new MalformedURLException("xmldb type '" + type + "' is unknown for URL " + location);
        }
       
        String base = (String)baseMap.get(type);

        if (base != null && base.length() > 0) {
            String path = location.substring(end+1);
            if (!path.startsWith("//")) {
                // URL is not absolute, add base, avoiding to double the '/'
                if (path.charAt(0) == '/') {
                    path = path.substring(1);
                }
                location = location.substring(0, end + 1) + base + path;
            }
        }

        return new XMLDBSource(this.getLogger(), credential.getPrincipal(), credential.getPassword(), location);
    }
View Full Code Here

        try {

            Source source = resolver.resolveURI(uri);

            if (source instanceof RestrictableSource)
                ((RestrictableSource)source).setSourceCredential(new SourceCredential(principal, password));

            if (source instanceof InspectableSource) {
                InspectableSource inspectablesource = (InspectableSource)source;

                SourceProperty property = new SourceProperty(namespace, name, value);
View Full Code Here

        try {

            Source source = resolver.resolveURI(uri);

            if (source instanceof RestrictableSource)
                ((RestrictableSource)source).setSourceCredential(new SourceCredential(principal, password));

            if (source instanceof InspectableSource) {
                InspectableSource inspectablesource = (InspectableSource)source;

                inspectablesource.removeSourceProperty(namespace, name);
View Full Code Here

            Source source = resolver.resolveURI(uri);

            if (source instanceof RestrictableSource) {
                RestrictableSource restrictablesource = (RestrictableSource)source;

                restrictablesource.setSourceCredential(new SourceCredential(principal, password));

                SourcePermission permission =
                    new PrincipalSourcePermission(subject, privilege, inheritable, negative);

                restrictablesource.addSourcePermission(permission);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.source.helpers.SourceCredential

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.