Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.ModifiableTraversableSource


            getLogger().debug("copy: " + source.getURI() + " -> " + destination.getURI());
        }
       
        if (source instanceof TraversableSource) {
            final TraversableSource origin = (TraversableSource) source;
            ModifiableTraversableSource target = null;
            if (origin.isCollection()) {
                if (!(destination instanceof ModifiableTraversableSource)) {
                    final String message = "copy() is forbidden: " +
                        "Cannot create a collection at the indicated destination.";
                    getLogger().warn(message);
                    return STATUS_FORBIDDEN;
                }
                // TODO: copy properties
                target = ((ModifiableTraversableSource) destination);
                m_interceptor.preStoreSource(target);
                target.makeCollection();
                m_interceptor.postStoreSource(target);
                if (recurse) {
                    Iterator children = origin.getChildren().iterator();
                    while (children.hasNext()) {
                        TraversableSource child = (TraversableSource) children.next();
                        /*int status =*/ copy(child,target.getChild(child.getName()),recurse);
                        // TODO: record this status
                        // according to the spec we must continue moving files even though
                        // a part of the move has not succeeded
                    }
                }
View Full Code Here


            getLogger().debug("copy: " + source.getURI() + " -> " + destination.getURI());
        }
       
        if (source instanceof TraversableSource) {
            final TraversableSource origin = (TraversableSource) source;
            ModifiableTraversableSource target = null;
            if (origin.isCollection()) {
                if (!(destination instanceof ModifiableTraversableSource)) {
                    final String message = "copy() is forbidden: " +
                        "Cannot create a collection at the indicated destination.";
                    getLogger().warn(message);
                    return STATUS_FORBIDDEN;
                }
                // TODO: copy properties
                target = ((ModifiableTraversableSource) destination);
                m_interceptor.preStoreSource(target);
                target.makeCollection();
                m_interceptor.postStoreSource(target);
                if (recurse) {
                    Iterator children = origin.getChildren().iterator();
                    while (children.hasNext()) {
                        TraversableSource child = (TraversableSource) children.next();
                        int status = copy(child,target.getChild(child.getName()),recurse);
                        // TODO: record this status
                        // according to the spec we must continue moving files even though
                        // a part of the move has not succeeded
                    }
                }
View Full Code Here

        return source;
    }

    public static void save(Request request, String dirName) throws Exception {
        TraversableSource collection = getCollection(dirName);
        ModifiableTraversableSource result;
       
        Enumeration params = request.getParameterNames();
        while (params.hasMoreElements()) {
            String name = (String) params.nextElement();
            if (name.indexOf("..") > -1) throw new Exception("We are under attack!!");
View Full Code Here

        contents = resource.getChildren();
      } catch (SourceException se) {
        throw new RuntimeException("Unable to list contents for collection " + resource);
      }
      for (Iterator iter = contents.iterator(); iter.hasNext();) {
                ModifiableTraversableSource element = (ModifiableTraversableSource) iter.next();
                success = remove(element);
            }
                     
        }
        try {
View Full Code Here

        contents = from.getChildren();
      } catch (SourceException se) {
        throw new RuntimeException("Unable to list contents for collection " + from);
      }
      for (Iterator iter = contents.iterator(); iter.hasNext();) {
        ModifiableTraversableSource src = (ModifiableTraversableSource) iter.next();
        SourceUtil.copy(src, resolve(to.getURI() + "/" + src.getName()));       

      }
        } else {
            to = (ModifiableTraversableSource)resolve(to.getURI());
            InputStream in = null;
View Full Code Here

            getLogger().debug("copy: " + source.getURI() + " -> " + destination.getURI());
        }
       
        if (source instanceof TraversableSource) {
            final TraversableSource origin = (TraversableSource) source;
            ModifiableTraversableSource target = null;
            if (origin.isCollection()) {
                if (!(destination instanceof ModifiableTraversableSource)) {
                    final String message = "copy() is forbidden: " +
                        "Cannot create a collection at the indicated destination.";
                    getLogger().warn(message);
                    return STATUS_FORBIDDEN;
                }
                // TODO: copy properties
                target = ((ModifiableTraversableSource) destination);
                m_interceptor.preStoreSource(target);
                target.makeCollection();
                m_interceptor.postStoreSource(target);
                if (recurse) {
                    Iterator children = origin.getChildren().iterator();
                    while (children.hasNext()) {
                        TraversableSource child = (TraversableSource) children.next();
                        int status = copy(child,target.getChild(child.getName()),recurse);
                        // TODO: record this status
                        // according to the spec we must continue moving files even though
                        // a part of the move has not succeeded
                    }
                }
View Full Code Here

        return source;
    }

    public static void save(Request request, String dirName) throws Exception {
        TraversableSource collection = getCollection(dirName);
        ModifiableTraversableSource result;
       
        Enumeration params = request.getParameterNames();
        while (params.hasMoreElements()) {
            String name = (String) params.nextElement();
            if (name.indexOf("..") > -1) throw new Exception("We are under attack!!");
View Full Code Here

        contents = resource.getChildren();
      } catch (SourceException se) {
        throw new RuntimeException("Unable to list contents for collection " + resource);
      }
      for (Iterator iter = contents.iterator(); iter.hasNext();) {
                ModifiableTraversableSource element = (ModifiableTraversableSource) iter.next();
                success = remove(element);
            }
                     
        }
        try {
View Full Code Here

        contents = from.getChildren();
      } catch (SourceException se) {
        throw new RuntimeException("Unable to list contents for collection " + from);
      }
      for (Iterator iter = contents.iterator(); iter.hasNext();) {
        ModifiableTraversableSource src = (ModifiableTraversableSource) iter.next();
        SourceUtil.copy(src, env.resolveURI(to.getURI() + "/" + src.getName()));       

      }
        } else {
            to = (ModifiableTraversableSource)env.resolveURI(to.getURI());
            InputStream in = null;
View Full Code Here

     * @throws IOException if an error occurs.
     */
    public static void delete(String sourceUri, ServiceManager manager) throws ServiceException,
            MalformedURLException, IOException {
        SourceResolver resolver = null;
        ModifiableTraversableSource source = null;
        try {

            resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
            source = (ModifiableTraversableSource) resolver.resolveURI(sourceUri);
            if (source.exists()) {
                source.delete();
            }

        } finally {
            if (resolver != null) {
                if (source != null) {
View Full Code Here

TOP

Related Classes of org.apache.excalibur.source.ModifiableTraversableSource

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.