diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..fc2a03accc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +language: java +sudo: false + +jdk: + - openjdk7 + - oraclejdk8 + +after_success: + - mvn clean cobertura:cobertura coveralls:report diff --git a/BUILDING.txt b/BUILDING.txt index ed6bc8b976..33e4e6d433 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -1,6 +1,6 @@ Building Apache Commons VFS -To build Apache Commons VFS, you need a JDK implementation version 1.6 or greater, and Apache Maven. +To build Apache Commons VFS, you need a JDK implementation version 1.7 or greater, and Apache Maven 3. To perform the license release audit, a.k.a. "RAT check", run: @@ -8,9 +8,9 @@ mvn apache-rat:check To perform a Clirr check, run: -mvn clirr:check -pl core +mvn clirr:check -pl commons-vfs2 -To build the site with Java 6, make sure you give Maven enough memory using +To build the site with Java 7, make sure you give Maven enough memory using MAVEN_OPTS with options appropriate for your JVM. Alternatively, you can build with Java 8 and not deal with MAVEN_OPTS. @@ -18,14 +18,7 @@ To build the site, from a command line, run: mvn clean install mvn site - -On Windows, use a local staging directory, for example: - -mvn site:stage-deploy -DstagingSiteURL=file:///%HOME%/vfs - -On UNIX, use a local staging directory, for example: - -mvn site:stage-deploy -DstagingSiteURL=file:///$HOME/vfs +mvn site:stage To test, run: diff --git a/NOTICE.txt b/NOTICE.txt index b49f10e3ed..583b6620e2 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Commons VFS -Copyright 2002-2016 The Apache Software Foundation +Copyright 2002-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/README.md b/README.md index f74d6d5360..b7469ad571 100644 --- a/README.md +++ b/README.md @@ -43,18 +43,21 @@ Apache Commons VFS =================== +[![Build Status](https://travis-ci.org/apache/commons-vfs.svg?branch=trunk)](https://travis-ci.org/apache/commons-vfs) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-vfs2/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-vfs2/) + Apache Commons VFS is a Virtual File System library. Documentation ------------- -More information can be found on the [homepage](http://commons.apache.org/proper/commons-vfs). -The [JavaDoc](http://commons.apache.org/proper/commons-vfs/apidocs/index.html) can be browsed. +More information can be found on the [Apache Commons VFS homepage](https://commons.apache.org/proper/commons-vfs). +The [JavaDoc](https://commons.apache.org/proper/commons-vfs/apidocs/index.html) can be browsed. Questions related to the usage of Apache Commons VFS should be posted to the [user mailing list][ml]. Where can I get the latest release? ----------------------------------- -You can download source and binaries from our [download page](http://commons.apache.org/proper/commons-vfs/download.html). +You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-vfs2/download_vfs2.cgi). Alternatively you can pull it from the central Maven repositories: @@ -62,37 +65,39 @@ Alternatively you can pull it from the central Maven repositories: org.apache.commons commons-vfs2 - 2.0 + 2.2 ``` Contributing ------------ -We accept PRs via github. The [developer mailing list][ml] is the main channel of communication for contributors. +We accept Pull Requests via GitHub. The [developer mailing list][ml] is the main channel of communication for contributors. There are some guidelines which will make applying PRs easier for us: + No tabs! Please use spaces for indentation. + Respect the code style. + Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change. + Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running ```mvn clean test```. -If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](http://www.apache.org/licenses/#clas). -You can learn more about contributing via GitHub in our [contribution guidelines](https://github.com/apache/commons-vfs/blob/trunk/CONTRIBUTING.md). +If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas). +You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md). License ------- -Code is under the [Apache Licence v2](http://www.apache.org/licenses/LICENSE-2.0.txt). +This code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0). + +See the `NOTICE.txt` file for required notices and attributions. Donations --------- -You like Apache Commons VFS? Then [donate back to the ASF](http://www.apache.org/foundation/contributing.html) to support the development. +You like Apache Commons VFS? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support the development. Additional Resources -------------------- -+ [Apache Commons Homepage](http://commons.apache.org/) -+ [Apache Bugtracker (JIRA)](https://issues.apache.org/jira/) ++ [Apache Commons Homepage](https://commons.apache.org/) ++ [Apache Issue Tracker (JIRA)](https://issues.apache.org/jira/browse/VFS) + [Apache Commons Twitter Account](https://twitter.com/ApacheCommons) -+ #apachecommons IRC channel on freenode.org ++ `#apache-commons` IRC channel on `irc.freenode.org` -[ml]:http://commons.apache.org/proper/commons-vfs/mail-lists.html +[ml]:https://commons.apache.org/mail-lists.html diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 112f13e408..1d6cc7434a 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,7 +1,51 @@ + Apache Commons VFS Project 2.2 + RELEASE NOTES + +The Apache Commons VFS Project team is pleased to announce the release of Apache Commons VFS Project 2.2. + +Apache Commons VFS is a Virtual File System library. + +New features and bug fix release. + +Changes in this version include: + +New features: +o VFS-628: Add a file inverter FileSelector: InvertIncludeFileSelector. + +Fixed Bugs: +o VFS-189: Possible NPE in DefaultFileSystemManager. +o VFS-620: FileObject.moveTo(FileObject) API doesn't work well for a Linux FTP. Thanks to stevezhuang. +o VFS-291: ZIP archives are not properly closed after unzipping and cannot be deleted until the JVM exists. +o VFS-644: AbstractFileSystem.streamClosed() always sets openStream count to zero. + +Changes: +o VFS-642: Upgrade to jcifs 1.3.17 Thanks to ilangoldfeld. +o VFS-612: Update the platform requirement from Java 6 to Java 7. +o VFS-615: Update Apache Commons Compress from 1.11 to 1.12. +o VFS-629: Update Apache Commons Compress from 1.12 to 1.13. +o VFS-639: Update Apache Commons Compress from 1.13 to 1.14. +o VFS-631: Update from Apache Commons Net 3.5 to 3.6. +o VFS-632: Update from JCraft jsch for SFTP/SSH from 0.1.53 to 0.1.54. +o VFS-621: Add API VFS.setManager(FileSystemManager). +o VFS-643: VFS should not log at the INFO level. + +Known Problems: +o VFS-645: VfsClassLoaderTests fails on Java 9. + + +Historical list of changes: http://commons.apache.org/proper/commons-vfs/changes-report.html + +For complete information on Apache Commons VFS Project, including instructions on how to submit bug reports, +patches, or suggestions for improvement, see the Apache Apache Commons VFS Project website: + +http://commons.apache.org/proper/commons-vfs/ + +----------------------------------------------------------------------------- + Apache Commons VFS 2.1 RELEASE NOTES -The Apache Commons VFS team is pleased to announce the release of Apache Commons VFS 2.1 +The Apache Commons VFS team is pleased to announce the release of Apache Commons VFS 2.1. Apache Commons VFS is a Virtual File System library. @@ -214,3 +258,5 @@ For complete information on Apache Commons VFS, including instructions on how to patches, or suggestions for improvement, see the Apache Apache Commons VFS website: http://commons.apache.org/proper/commons-vfs/ + +----------------------------------------------------------------------------- \ No newline at end of file diff --git a/checkstyle.xml b/checkstyle.xml index 966243b67d..1547bdfa98 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -4,210 +4,207 @@ "http://www.puppycrawl.com/dtds/configuration_1_1.dtd"> - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - - + - - - - + + + + + + - - - - - - - + + + + - - - - - - - + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/pom.xml b/commons-vfs2-distribution/pom.xml similarity index 98% rename from dist/pom.xml rename to commons-vfs2-distribution/pom.xml index b1c67caebd..3cb00cf273 100644 --- a/dist/pom.xml +++ b/commons-vfs2-distribution/pom.xml @@ -23,14 +23,14 @@ limitations under the License. Apache Commons VFS Distribution org.apache.commons commons-vfs2-distribution - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT pom Apache Commons VFS is a Virtual File System library - Distribution archives. org.apache.commons commons-vfs2-project - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT ../ diff --git a/dist/src/assembly/bin.xml b/commons-vfs2-distribution/src/assembly/bin.xml similarity index 100% rename from dist/src/assembly/bin.xml rename to commons-vfs2-distribution/src/assembly/bin.xml diff --git a/dist/src/assembly/src.xml b/commons-vfs2-distribution/src/assembly/src.xml similarity index 98% rename from dist/src/assembly/src.xml rename to commons-vfs2-distribution/src/assembly/src.xml index 25c32a702d..568a52a5db 100644 --- a/dist/src/assembly/src.xml +++ b/commons-vfs2-distribution/src/assembly/src.xml @@ -30,7 +30,7 @@ .. true - **/sandbox/** + **/commons-vfs2-sandbox/** %regex[(?!((?!${project.build.directory}/)[^/]+/)*src/).*${project.build.directory}.*] diff --git a/examples/pom.xml b/commons-vfs2-examples/pom.xml similarity index 97% rename from examples/pom.xml rename to commons-vfs2-examples/pom.xml index 13c466983f..b9b28bf174 100644 --- a/examples/pom.xml +++ b/commons-vfs2-examples/pom.xml @@ -24,13 +24,13 @@ Apache Commons VFS Examples org.apache.commons commons-vfs2-examples - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT Apache Commons VFS is a Virtual File System library - Examples. org.apache.commons commons-vfs2-project - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT ../ diff --git a/examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java similarity index 91% rename from examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java rename to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java index a5ff9d8532..0871e26460 100644 --- a/examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java +++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ChangeLastModificationTime.java @@ -22,17 +22,13 @@ /** * Example to change the last modification time of the given file. */ -public final class ChangeLastModificationTime -{ - private ChangeLastModificationTime() - { +public final class ChangeLastModificationTime { + private ChangeLastModificationTime() { /* main class not instantiated. */ } - public static void main(final String[] args) throws Exception - { - if (args.length == 0) - { + public static void main(final String[] args) throws Exception { + if (args.length == 0) { System.err.println("Please pass the name of a file as parameter."); return; } diff --git a/examples/src/main/java/org/apache/commons/vfs2/example/Shell.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/Shell.java similarity index 63% rename from examples/src/main/java/org/apache/commons/vfs2/example/Shell.java rename to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/Shell.java index 1484cc12fe..e6dfe5ea82 100644 --- a/examples/src/main/java/org/apache/commons/vfs2/example/Shell.java +++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/Shell.java @@ -42,62 +42,46 @@ /** * A simple command-line shell for performing file operations. *

- * See - * Commons VFS Shell Examples - * in Apache Commons Wiki. + * See Commons VFS Shell Examples in Apache Commons Wiki. */ -public final class Shell -{ +public final class Shell { private final FileSystemManager mgr; private FileObject cwd; private final BufferedReader reader; - private Shell() throws IOException - { + private Shell() throws IOException { mgr = VFS.getManager(); cwd = mgr.toFileObject(new File(System.getProperty("user.dir"))); reader = new BufferedReader(new InputStreamReader(System.in, Charset.defaultCharset())); } - public static void main(final String[] args) - { - try - { + public static void main(final String[] args) { + try { new Shell().go(); - } - catch (final Exception e) - { + } catch (final Exception e) { e.printStackTrace(); System.exit(1); } System.exit(0); } - private void go() throws Exception - { + private void go() throws Exception { System.out.println("VFS Shell " + getVersion(Shell.class)); - while (true) - { + while (true) { final String[] cmd = nextCommand(); - if (cmd == null) - { + if (cmd == null) { return; } - if (cmd.length == 0) - { + if (cmd.length == 0) { continue; } final String cmdName = cmd[0]; - if (cmdName.equalsIgnoreCase("exit") || cmdName.equalsIgnoreCase("quit")) - { + if (cmdName.equalsIgnoreCase("exit") || cmdName.equalsIgnoreCase("quit")) { return; } - try - { + try { handleCommand(cmd); - } - catch (final Exception e) - { + } catch (final Exception e) { System.err.println("Command failed:"); e.printStackTrace(System.err); } @@ -107,113 +91,77 @@ private void go() throws Exception /** * Handles a command. */ - private void handleCommand(final String[] cmd) throws Exception - { + private void handleCommand(final String[] cmd) throws Exception { final String cmdName = cmd[0]; - if (cmdName.equalsIgnoreCase("cat")) - { + if (cmdName.equalsIgnoreCase("cat")) { cat(cmd); - } - else if (cmdName.equalsIgnoreCase("cd")) - { + } else if (cmdName.equalsIgnoreCase("cd")) { cd(cmd); - } - else if (cmdName.equalsIgnoreCase("cp")) - { + } else if (cmdName.equalsIgnoreCase("cp")) { cp(cmd); - } - else if (cmdName.equalsIgnoreCase("help") || cmdName.equals("?")) - { + } else if (cmdName.equalsIgnoreCase("help") || cmdName.equals("?")) { help(); - } - else if (cmdName.equalsIgnoreCase("ls")) - { + } else if (cmdName.equalsIgnoreCase("ls")) { ls(cmd); - } - else if (cmdName.equalsIgnoreCase("pwd")) - { + } else if (cmdName.equalsIgnoreCase("pwd")) { pwd(); - } - else if (cmdName.equalsIgnoreCase("rm")) - { + } else if (cmdName.equalsIgnoreCase("rm")) { rm(cmd); - } - else if (cmdName.equalsIgnoreCase("touch")) - { + } else if (cmdName.equalsIgnoreCase("touch")) { touch(cmd); - } - else if (cmdName.equalsIgnoreCase("info")) - { + } else if (cmdName.equalsIgnoreCase("info")) { info(cmd); - } - else - { + } else { System.err.println("Unknown command \"" + cmdName + "\" (Try 'help')."); } } - private void info(String[] cmd) throws Exception - { - if (cmd.length > 1) - { + private void info(String[] cmd) throws Exception { + if (cmd.length > 1) { info(cmd[1]); - } - else - { - System.out.println("Default manager: \"" + mgr.getClass().getName() + "\" " + - "version " + getVersion(mgr.getClass())); + } else { + System.out.println( + "Default manager: \"" + mgr.getClass().getName() + "\" " + "version " + getVersion(mgr.getClass())); String[] schemes = mgr.getSchemes(); - List virtual = new ArrayList(); - List physical = new ArrayList(); - for (int i = 0; i < schemes.length; i++) - { + List virtual = new ArrayList<>(); + List physical = new ArrayList<>(); + for (int i = 0; i < schemes.length; i++) { Collection caps = mgr.getProviderCapabilities(schemes[i]); - if (caps != null) - { - if (caps.contains(Capability.VIRTUAL) || - caps.contains(Capability.COMPRESS) || - caps.contains(Capability.DISPATCHER)) - { + if (caps != null) { + if (caps.contains(Capability.VIRTUAL) || caps.contains(Capability.COMPRESS) + || caps.contains(Capability.DISPATCHER)) { virtual.add(schemes[i]); - } - else - { + } else { physical.add(schemes[i]); } } } - if (!physical.isEmpty()) - { + if (!physical.isEmpty()) { System.out.println(" Provider Schemes: " + physical); } - if (!virtual.isEmpty()) - { + if (!virtual.isEmpty()) { System.out.println(" Virtual Schemes: " + virtual); } - } + } } - private void info(String scheme) throws Exception - { - System.out.println("Provider Info for scheme \"" + scheme + "\":"); - Collection caps; - caps = mgr.getProviderCapabilities(scheme); - if (caps != null && !caps.isEmpty()) - { - System.out.println(" capabilities: " + caps); - } - FileOperationProvider[] ops = mgr.getOperationProviders(scheme); - if (ops != null && ops.length > 0) - { - System.out.println(" operations: " + ops); - } + private void info(String scheme) throws Exception { + System.out.println("Provider Info for scheme \"" + scheme + "\":"); + Collection caps; + caps = mgr.getProviderCapabilities(scheme); + if (caps != null && !caps.isEmpty()) { + System.out.println(" capabilities: " + caps); + } + FileOperationProvider[] ops = mgr.getOperationProviders(scheme); + if (ops != null && ops.length > 0) { + System.out.println(" operations: " + ops); + } } /** * Does a 'help' command. */ - private void help() - { + private void help() { System.out.println("Commands:"); System.out.println("cat Displays the contents of a file."); System.out.println("cd [folder] Changes current folder."); @@ -230,10 +178,8 @@ private void help() /** * Does an 'rm' command. */ - private void rm(final String[] cmd) throws Exception - { - if (cmd.length < 2) - { + private void rm(final String[] cmd) throws Exception { + if (cmd.length < 2) { throw new Exception("USAGE: rm "); } @@ -244,17 +190,14 @@ private void rm(final String[] cmd) throws Exception /** * Does a 'cp' command. */ - private void cp(final String[] cmd) throws Exception - { - if (cmd.length < 3) - { + private void cp(final String[] cmd) throws Exception { + if (cmd.length < 3) { throw new Exception("USAGE: cp "); } final FileObject src = mgr.resolveFile(cwd, cmd[1]); FileObject dest = mgr.resolveFile(cwd, cmd[2]); - if (dest.exists() && dest.getType() == FileType.FOLDER) - { + if (dest.exists() && dest.getType() == FileType.FOLDER) { dest = dest.resolveFile(src.getName().getBaseName()); } @@ -264,10 +207,8 @@ private void cp(final String[] cmd) throws Exception /** * Does a 'cat' command. */ - private void cat(final String[] cmd) throws Exception - { - if (cmd.length < 2) - { + private void cat(final String[] cmd) throws Exception { + if (cmd.length < 2) { throw new Exception("USAGE: cat "); } @@ -282,35 +223,26 @@ private void cat(final String[] cmd) throws Exception /** * Does a 'pwd' command. */ - private void pwd() - { + private void pwd() { System.out.println("Current folder is " + cwd.getName()); } /** - * Does a 'cd' command. - * If the taget directory does not exist, a message is printed to System.err. + * Does a 'cd' command. If the taget directory does not exist, a message is printed to System.err. */ - private void cd(final String[] cmd) throws Exception - { + private void cd(final String[] cmd) throws Exception { final String path; - if (cmd.length > 1) - { + if (cmd.length > 1) { path = cmd[1]; - } - else - { + } else { path = System.getProperty("user.home"); } // Locate and validate the folder final FileObject tmp = mgr.resolveFile(cwd, path); - if (tmp.exists()) - { + if (tmp.exists()) { cwd = tmp; - } - else - { + } else { System.out.println("Folder does not exist: " + tmp.getName()); } System.out.println("Current folder is " + cwd.getName()); @@ -319,38 +251,28 @@ private void cd(final String[] cmd) throws Exception /** * Does an 'ls' command. */ - private void ls(final String[] cmd) throws FileSystemException - { + private void ls(final String[] cmd) throws FileSystemException { int pos = 1; final boolean recursive; - if (cmd.length > pos && cmd[pos].equals("-R")) - { + if (cmd.length > pos && cmd[pos].equals("-R")) { recursive = true; pos++; - } - else - { + } else { recursive = false; } final FileObject file; - if (cmd.length > pos) - { + if (cmd.length > pos) { file = mgr.resolveFile(cwd, cmd[pos]); - } - else - { + } else { file = cwd; } - if (file.getType() == FileType.FOLDER) - { + if (file.getType() == FileType.FOLDER) { // List the contents System.out.println("Contents of " + file.getName()); listChildren(file, recursive, ""); - } - else - { + } else { // Stat the file System.out.println(file.getName()); final FileContent content = file.getContent(); @@ -364,15 +286,12 @@ private void ls(final String[] cmd) throws FileSystemException /** * Does a 'touch' command. */ - private void touch(final String[] cmd) throws Exception - { - if (cmd.length < 2) - { + private void touch(final String[] cmd) throws Exception { + if (cmd.length < 2) { throw new Exception("USAGE: touch "); } final FileObject file = mgr.resolveFile(cwd, cmd[1]); - if (!file.exists()) - { + if (!file.exists()) { file.createFile(); } file.getContent().setLastModifiedTime(System.currentTimeMillis()); @@ -381,26 +300,18 @@ private void touch(final String[] cmd) throws Exception /** * Lists the children of a folder. */ - private void listChildren(final FileObject dir, - final boolean recursive, - final String prefix) - throws FileSystemException - { + private void listChildren(final FileObject dir, final boolean recursive, final String prefix) + throws FileSystemException { final FileObject[] children = dir.getChildren(); - for (final FileObject child : children) - { + for (final FileObject child : children) { System.out.print(prefix); System.out.print(child.getName().getBaseName()); - if (child.getType() == FileType.FOLDER) - { + if (child.getType() == FileType.FOLDER) { System.out.println("/"); - if (recursive) - { + if (recursive) { listChildren(child, recursive, prefix + " "); } - } - else - { + } else { System.out.println(); } } @@ -409,31 +320,24 @@ private void listChildren(final FileObject dir, /** * Returns the next command, split into tokens. */ - private String[] nextCommand() throws IOException - { + private String[] nextCommand() throws IOException { System.out.print("> "); final String line = reader.readLine(); - if (line == null) - { + if (line == null) { return null; } - final ArrayList cmd = new ArrayList(); + final ArrayList cmd = new ArrayList<>(); final StringTokenizer tokens = new StringTokenizer(line); - while (tokens.hasMoreTokens()) - { + while (tokens.hasMoreTokens()) { cmd.add(tokens.nextToken()); } return cmd.toArray(new String[cmd.size()]); } - private static String getVersion(Class cls) - { - try - { + private static String getVersion(Class cls) { + try { return cls.getPackage().getImplementationVersion(); - } - catch (Exception ignored) - { + } catch (Exception ignored) { return "N/A"; } } diff --git a/examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java similarity index 78% rename from examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java rename to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java index db095c813c..c9ae26f204 100644 --- a/examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java +++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/ShowProperties.java @@ -28,28 +28,22 @@ /** * Example which prints all properties of the file passed as first parameter. */ -public final class ShowProperties -{ +public final class ShowProperties { /** Maximum number of children to show. */ private static final int SHOW_MAX = 5; - private ShowProperties() - { + private ShowProperties() { /* main class not instantiated. */ } - public static void main(final String[] args) - { - if (args.length == 0) - { + public static void main(final String[] args) { + if (args.length == 0) { System.err.println("Please pass the name of a file as parameter."); System.err.println("e.g. java org.apache.commons.vfs2.example.ShowProperties LICENSE.txt"); return; } - for (final String arg : args) - { - try - { + for (final String arg : args) { + try { final FileSystemManager mgr = VFS.getManager(); System.out.println(); System.out.println("Parsing: " + arg); @@ -68,40 +62,29 @@ public static void main(final String[] args) System.out.println("Readable: " + file.isReadable()); System.out.println("Writeable: " + file.isWriteable()); System.out.println("Root path: " + file.getFileSystem().getRoot().getName().getPath()); - if (file.exists()) - { - if (file.getType().equals(FileType.FILE)) - { + if (file.exists()) { + if (file.getType().equals(FileType.FILE)) { System.out.println("Size: " + file.getContent().getSize() + " bytes"); - } - else if (file.getType().equals(FileType.FOLDER) && file.isReadable()) - { + } else if (file.getType().equals(FileType.FOLDER) && file.isReadable()) { final FileObject[] children = file.getChildren(); System.out.println("Directory with " + children.length + " files"); - for (int iterChildren = 0; iterChildren < children.length; iterChildren++) - { + for (int iterChildren = 0; iterChildren < children.length; iterChildren++) { System.out.println("#" + iterChildren + ": " + children[iterChildren].getName()); - if (iterChildren > SHOW_MAX) - { + if (iterChildren > SHOW_MAX) { break; } } } - System.out.println("Last modified: " + DateFormat.getInstance().format( - new Date(file.getContent().getLastModifiedTime()))); - } - else - { + System.out.println("Last modified: " + + DateFormat.getInstance().format(new Date(file.getContent().getLastModifiedTime()))); + } else { System.out.println("The file does not exist"); } file.close(); - } - catch (final FileSystemException ex) - { + } catch (final FileSystemException ex) { ex.printStackTrace(); } } } } - diff --git a/examples/src/main/java/org/apache/commons/vfs2/example/package.html b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package.html similarity index 100% rename from examples/src/main/java/org/apache/commons/vfs2/example/package.html rename to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/package.html diff --git a/examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java similarity index 84% rename from examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java rename to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java index 542ae4f1fc..bb3d91ebe9 100644 --- a/examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java +++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/FtpCheck.java @@ -26,67 +26,54 @@ /** * Basic check for FTP. */ -public final class FtpCheck -{ - private FtpCheck() - { +public final class FtpCheck { + private FtpCheck() { /* main class not instantiated. */ } - public static void main(final String[] args) throws Exception - { - if (args.length < 3) - { + public static void main(final String[] args) throws Exception { + if (args.length < 3) { throw new IllegalArgumentException("Usage: FtpCheck user pass host dir"); } final String user = args[0]; final String pass = args[1]; final String host = args[2]; String dir = null; - if (args.length == 4) - { + if (args.length == 4) { dir = args[3]; } final FTPClient client = new FTPClient(); client.connect(host); final int reply = client.getReplyCode(); - if (!FTPReply.isPositiveCompletion(reply)) - { + if (!FTPReply.isPositiveCompletion(reply)) { throw new IllegalArgumentException("cant connect: " + reply); } - if (!client.login(user, pass)) - { + if (!client.login(user, pass)) { throw new IllegalArgumentException("login failed"); } client.enterLocalPassiveMode(); final OutputStream os = client.storeFileStream(dir + "/test.txt"); - if (os == null) - { + if (os == null) { throw new IllegalStateException(client.getReplyString()); } os.write("test".getBytes(Charset.defaultCharset())); os.close(); client.completePendingCommand(); - if (dir != null && !client.changeWorkingDirectory(dir)) - { + if (dir != null && !client.changeWorkingDirectory(dir)) { throw new IllegalArgumentException("change dir to '" + dir + "' failed"); } System.err.println("System: " + client.getSystemType()); final FTPFile[] files = client.listFiles(); - for (int i = 0; i < files.length; i++) - { + for (int i = 0; i < files.length; i++) { final FTPFile file = files[i]; - if (file == null) - { + if (file == null) { System.err.println("#" + i + ": " + null); - } - else - { + } else { System.err.println("#" + i + ": " + file.getRawListing()); System.err.println("#" + i + ": " + file.toString()); System.err.println("\t name:" + file.getName() + " type:" + file.getType()); diff --git a/examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java similarity index 82% rename from examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java rename to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java index 7990a1b043..3f346efab6 100644 --- a/examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java +++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/SftpCheck.java @@ -28,17 +28,13 @@ /** * Basic check for SFTP. */ -public final class SftpCheck -{ - private SftpCheck() - { +public final class SftpCheck { + private SftpCheck() { /* main class not instantiated. */ } - public static void main(final String[] args) throws Exception - { - if (args.length != 4) - { + public static void main(final String[] args) throws Exception { + if (args.length != 4) { throw new IllegalArgumentException("Usage: SftpCheck user pass host dir"); } final String user = args[0]; @@ -50,41 +46,34 @@ public static void main(final String[] args) throws Exception props.setProperty("StrictHostKeyChecking", "false"); final JSch jsch = new JSch(); final Session session = jsch.getSession(user, host, 22); - session.setUserInfo(new UserInfo() - { + session.setUserInfo(new UserInfo() { @Override - public String getPassphrase() - { + public String getPassphrase() { return null; } @Override - public String getPassword() - { + public String getPassword() { return null; } @Override - public boolean promptPassword(final String string) - { + public boolean promptPassword(final String string) { return false; } @Override - public boolean promptPassphrase(final String string) - { + public boolean promptPassphrase(final String string) { return false; } @Override - public boolean promptYesNo(final String string) - { + public boolean promptYesNo(final String string) { return true; } @Override - public void showMessage(final String string) - { + public void showMessage(final String string) { } }); session.setPassword(pass); @@ -93,8 +82,7 @@ public void showMessage(final String string) chan.connect(); final Vector list = chan.ls(dir); final Iterator iterList = list.iterator(); - while (iterList.hasNext()) - { + while (iterList.hasNext()) { System.err.println(iterList.next()); } System.err.println("done"); diff --git a/examples/src/main/java/org/apache/commons/vfs2/libcheck/package.html b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/package.html similarity index 100% rename from examples/src/main/java/org/apache/commons/vfs2/libcheck/package.html rename to commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/libcheck/package.html diff --git a/examples/src/site/site.xml b/commons-vfs2-examples/src/site/site.xml similarity index 100% rename from examples/src/site/site.xml rename to commons-vfs2-examples/src/site/site.xml diff --git a/examples/src/site/xdoc/index.xml b/commons-vfs2-examples/src/site/xdoc/index.xml similarity index 72% rename from examples/src/site/xdoc/index.xml rename to commons-vfs2-examples/src/site/xdoc/index.xml index 3e80778cd7..55f673a7ff 100644 --- a/examples/src/site/xdoc/index.xml +++ b/commons-vfs2-examples/src/site/xdoc/index.xml @@ -64,17 +64,17 @@ @@ -84,16 +84,16 @@ java -cp $LIB org.apache.commons.vfs2.example.Shell set REP=%USERPROFILE%\.m2\repository set LIB=%REP%\commons-logging\commons-logging\1.2\commons-logging-1.2.jar set LIB=%LIB%;%REP%\commons-net\commons-net\2.2\commons-net-2.2.jar -REM # set LIB=%LIB%;%REP%\org\apache\commons\commons-collections4\4.0\commons-collection-4.0.jar +REM # set LIB=%LIB%;%REP%\org\apache\commons\commons-collections4\4.1\commons-collection-4.1.jar set LIB=%LIB%;%REP%\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;%REP%\commons-codec\commons-codec\1.2\commons-codec-1.2.jar -set LIB=%LIB%;%REP%\com\jcraft\jsch\0.1.51\jsch-0.1.51.jar +set LIB=%LIB%;%REP%\com\jcraft\jsch\0.1.54\jsch-0.1.54.jar REM # next 3 lines are for webdav -REM # set LIB=%LIB%;%REP%\org\apache\jackrabbit\jackrabbit-webdav\1.6.5\jackrabbit-webdav-1.6.5.jar -REM # set LIB=%LIB%;%REP%\org\slf4j\slf4j-api\1.5.11\slf4j-api-1.5.11.jar;%REP%\org\slf4j\slf4j-simple\1.5.3\slf4j-simple-1.5.3.jar -REM # set LIB=%LIB%;%REP%\org\apache\jackrabbit\jackrabbit-jcr-commons\1.6.5\jackrabbit-jcr-commons-1.6.5.jar -REM # set LIB=%LIB%;%REP%\org\apache\commons\commons-vfs2-sandbox\2.1\commons-vfs2-sandbox-2.1.jar;%REP%\jcifs\jcifs\0.8.3\jcifs-0.8.3.jar -set LIB=%LIB%;%REP%\org\apache\commons\commons-vfs2-examples\2.1\commons-vfs2-examples-2.1.jar -set LIB=%LIB%;%REP%\org\apache\commons\commons-vfs2\2.1\commons-vfs2-2.1.jar +set LIB=%LIB%;%REP%\org\apache\jackrabbit\jackrabbit-webdav\1.6.5\jackrabbit-webdav-1.6.5.jar +set LIB=%LIB%;%REP%\org\slf4j\slf4j-api\1.5.11\slf4j-api-1.5.11.jar;%REP%\org\slf4j\slf4j-simple\1.5.3\slf4j-simple-1.5.3.jar +set LIB=%LIB%;%REP%\org\apache\jackrabbit\jackrabbit-jcr-commons\1.6.5\jackrabbit-jcr-commons-1.6.5.jar +REM # set LIB=%LIB%;%REP%\org\apache\commons\commons-vfs2-sandbox\2.2\commons-vfs2-sandbox-2.2.jar;%REP%\jcifs\jcifs\0.8.3\jcifs-0.8.3.jar +set LIB=%LIB%;%REP%\org\apache\commons\commons-vfs2-examples\2.2\commons-vfs2-examples-2.2.jar +set LIB=%LIB%;%REP%\org\apache\commons\commons-vfs2\2.2\commons-vfs2-2.2.jar java -cp %LIB% org.apache.commons.vfs2.example.Shell ]]> diff --git a/sandbox/pom.xml b/commons-vfs2-sandbox/pom.xml similarity index 98% rename from sandbox/pom.xml rename to commons-vfs2-sandbox/pom.xml index b177c5329b..358cf11ba9 100644 --- a/sandbox/pom.xml +++ b/commons-vfs2-sandbox/pom.xml @@ -24,13 +24,13 @@ Apache Commons VFS Sandbox org.apache.commons commons-vfs2-sandbox - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT Apache Commons VFS is a Virtual File System library - Sandbox. org.apache.commons commons-vfs2-project - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT ../ diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java similarity index 69% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java index 3d336c0fda..29eee4299a 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java @@ -41,165 +41,122 @@ /** * A map which tries to allow access to the various aspects of the mail. */ -public class MimeAttributesMap implements Map -{ +public class MimeAttributesMap implements Map { private static final String OBJECT_PREFIX = "obj."; private final Log log = LogFactory.getLog(MimeAttributesMap.class); private final Part part; - private final Map mimeMessageGetters = new TreeMap(); + private final Map mimeMessageGetters = new TreeMap<>(); private Map backingMap; - - public MimeAttributesMap(final Part part) - { + public MimeAttributesMap(final Part part) { this.part = part; addMimeMessageMethod(part.getClass().getMethods()); addMimeMessageMethod(part.getClass().getDeclaredMethods()); } - private void addMimeMessageMethod(final Method[] methods) - { - for (final Method method : methods) - { - if (!Modifier.isPublic(method.getModifiers())) - { + private void addMimeMessageMethod(final Method[] methods) { + for (final Method method : methods) { + if (!Modifier.isPublic(method.getModifiers())) { continue; } - if (method.getParameterTypes().length > 0) - { + if (method.getParameterTypes().length > 0) { continue; } - if (method.getName().startsWith("get")) - { + if (method.getName().startsWith("get")) { mimeMessageGetters.put(method.getName().substring(3), method); - } - else if (method.getName().startsWith("is")) - { + } else if (method.getName().startsWith("is")) { mimeMessageGetters.put(method.getName().substring(2), method); } } } - private Map getMap() - { - if (backingMap == null) - { + private Map getMap() { + if (backingMap == null) { backingMap = createMap(); } return backingMap; } - private Map createMap() - { + private Map createMap() { // Object is either a String, or a List of Strings - final Map ret = new TreeMap(); + final Map ret = new TreeMap<>(); Enumeration

headers; - try - { + try { @SuppressWarnings("unchecked") // Javadoc say Part returns Header - final - Enumeration
allHeaders = part.getAllHeaders(); + final Enumeration
allHeaders = part.getAllHeaders(); headers = allHeaders; - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { throw new RuntimeException(e); } // add all headers - while (headers.hasMoreElements()) - { + while (headers.hasMoreElements()) { final Header header = headers.nextElement(); final String headerName = header.getName(); final Object values = ret.get(headerName); - if (values == null) - { + if (values == null) { ret.put(headerName, header.getValue()); - } - else if (values instanceof String) - { - final ArrayList newValues = new ArrayList(); + } else if (values instanceof String) { + final ArrayList newValues = new ArrayList<>(); newValues.add((String) values); newValues.add(header.getValue()); ret.put(headerName, newValues); - } - else if (values instanceof List) - { + } else if (values instanceof List) { @SuppressWarnings("unchecked") // we only add Strings to the Lists - final - List list = (List) values; + final List list = (List) values; list.add(header.getValue()); } } // add all simple get/is results (with obj. prefix) final Iterator> iterEntries = mimeMessageGetters.entrySet().iterator(); - while (iterEntries.hasNext()) - { + while (iterEntries.hasNext()) { final Map.Entry entry = iterEntries.next(); final String name = entry.getKey(); final Method method = entry.getValue(); - try - { + try { final Object value = method.invoke(part); ret.put(OBJECT_PREFIX + name, value); - } - catch (final IllegalAccessException e) - { + } catch (final IllegalAccessException e) { log.debug(e.getLocalizedMessage(), e); - } - catch (final InvocationTargetException e) - { + } catch (final InvocationTargetException e) { log.debug(e.getLocalizedMessage(), e); } } // add extended fields (with obj. prefix too) - if (part instanceof MimeMessage) - { + if (part instanceof MimeMessage) { final MimeMessage message = (MimeMessage) part; - try - { + try { final Address[] address = message.getRecipients(MimeMessage.RecipientType.BCC); ret.put(OBJECT_PREFIX + "Recipients.BCC", address); - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { log.debug(e.getLocalizedMessage(), e); } - try - { + try { final Address[] address = message.getRecipients(MimeMessage.RecipientType.CC); ret.put(OBJECT_PREFIX + "Recipients.CC", address); - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { log.debug(e.getLocalizedMessage(), e); } - try - { + try { final Address[] address = message.getRecipients(MimeMessage.RecipientType.TO); ret.put(OBJECT_PREFIX + "Recipients.TO", address); - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { log.debug(e.getLocalizedMessage(), e); } - try - { + try { final Address[] address = message.getRecipients(MimeMessage.RecipientType.NEWSGROUPS); ret.put(OBJECT_PREFIX + "Recipients.NEWSGROUPS", address); - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { log.debug(e.getLocalizedMessage(), e); } } @@ -207,63 +164,51 @@ else if (values instanceof List) return ret; } - public int size() - { + public int size() { return getMap().size(); } - public boolean isEmpty() - { + public boolean isEmpty() { return getMap().size() < 1; } - public boolean containsKey(final Object key) - { + public boolean containsKey(final Object key) { return getMap().containsKey(key); } - public boolean containsValue(final Object value) - { + public boolean containsValue(final Object value) { return getMap().containsValue(value); } - public Object get(final Object key) - { + public Object get(final Object key) { return getMap().get(key); } - public Object put(final String key, final Object value) - { + public Object put(final String key, final Object value) { throw new UnsupportedOperationException(); } - public Object remove(final Object key) - { + public Object remove(final Object key) { throw new UnsupportedOperationException(); } - public void putAll(final Map t) - { + public void putAll(final Map t) { throw new UnsupportedOperationException(); } - public void clear() - { + public void clear() { throw new UnsupportedOperationException(); } - public Set keySet() - { + public Set keySet() { return Collections.unmodifiableSet(getMap().keySet()); } - public Collection values() - { + public Collection values() { return Collections.unmodifiableCollection(getMap().values()); } - public Set> entrySet() - { + public Set> entrySet() { return Collections.unmodifiableSet(getMap().entrySet()); } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java similarity index 82% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java index de3643fc4f..49ae3c28b5 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java @@ -29,21 +29,17 @@ /** * Get access to the content info stuff for mime objects. */ -public class MimeFileContentInfoFactory implements FileContentInfoFactory -{ - public FileContentInfo create(final FileContent fileContent) throws FileSystemException - { +public class MimeFileContentInfoFactory implements FileContentInfoFactory { + public FileContentInfo create(final FileContent fileContent) throws FileSystemException { final MimeFileObject mimeFile = (MimeFileObject) fileContent.getFile(); final Part part = mimeFile.getPart(); String contentTypeString = null; String charset = null; - try - { + try { // special handling for multipart - if (mimeFile.isMultipart()) - { + if (mimeFile.isMultipart()) { // get the original content type, but ... contentTypeString = part.getContentType(); @@ -51,44 +47,32 @@ public FileContentInfo create(final FileContent fileContent) throws FileSystemEx // the preamble will be delivered in UTF-8 - fixed charset = MimeFileSystem.PREAMBLE_CHARSET; } - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { throw new FileSystemException(e); } - if (contentTypeString == null) - { + if (contentTypeString == null) { // normal message ... get the content type - try - { + try { contentTypeString = part.getContentType(); - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { throw new FileSystemException(e); } } ContentType contentType; - try - { + try { contentType = new ContentType(contentTypeString); - } - catch (final MessagingException e) - { + } catch (final MessagingException e) { throw new FileSystemException(e); } - if (charset == null) - { + if (charset == null) { // charset might already be set by the multipart message stuff, else // extract it from the contentType now charset = contentType.getParameter("charset"); // NON-NLS } - return new DefaultFileContentInfo( - contentType.getBaseType(), - charset); + return new DefaultFileContentInfo(contentType.getBaseType(), charset); } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java similarity index 69% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java index f9dade3d6c..8a91e72e49 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java @@ -44,30 +44,23 @@ /** * A part of a MIME message. */ -public class MimeFileObject - extends AbstractFileObject - implements FileObject -{ +public class MimeFileObject extends AbstractFileObject implements FileObject { private Part part; private Map attributeMap; - protected MimeFileObject(final AbstractFileName name, - final Part part, - final MimeFileSystem fileSystem) throws FileSystemException - { + protected MimeFileObject(final AbstractFileName name, final Part part, final MimeFileSystem fileSystem) + throws FileSystemException { super(name, fileSystem); setPart(part); } + /** * Attaches this file object to its file resource. */ @Override - protected void doAttach() throws Exception - { - if (part == null) - { - if (!getName().equals(getFileSystem().getRootName())) - { + protected void doAttach() throws Exception { + if (part == null) { + if (!getName().equals(getFileSystem().getRootName())) { final MimeFileObject foParent = (MimeFileObject) FileObjectUtils.getAbstractFileObject(getParent()); setPart(foParent.findPart(getName().getBaseName())); return; @@ -77,22 +70,17 @@ protected void doAttach() throws Exception } } - private Part findPart(final String partName) throws Exception - { - if (getType() == FileType.IMAGINARY) - { + private Part findPart(final String partName) throws Exception { + if (getType() == FileType.IMAGINARY) { // not existent return null; } - if (isMultipart()) - { - final Multipart multipart = (Multipart) part.getContent(); - if (partName.startsWith(MimeFileSystem.NULL_BP_NAME)) - { + if (isMultipart()) { + final Multipart multipart = (Multipart) part.getContent(); + if (partName.startsWith(MimeFileSystem.NULL_BP_NAME)) { final int partNumber = Integer.parseInt(partName.substring(MimeFileSystem.NULL_BP_NAME.length()), 10); - if (partNumber < 0 || partNumber + 1 > multipart.getCount()) - { + if (partNumber < 0 || partNumber + 1 > multipart.getCount()) { // non existent return null; } @@ -100,11 +88,9 @@ private Part findPart(final String partName) throws Exception return multipart.getBodyPart(partNumber); } - for (int i = 0; i < multipart.getCount(); i++) - { + for (int i = 0; i < multipart.getCount(); i++) { final Part childPart = multipart.getBodyPart(i); - if (partName.equals(childPart.getFileName())) - { + if (partName.equals(childPart.getFileName())) { return childPart; } } @@ -114,24 +100,19 @@ private Part findPart(final String partName) throws Exception } @Override - protected void doDetach() throws Exception - { + protected void doDetach() throws Exception { } /** - * Determines the type of the file, returns null if the file does not - * exist. + * Determines the type of the file, returns null if the file does not exist. */ @Override - protected FileType doGetType() throws Exception - { - if (part == null) - { + protected FileType doGetType() throws Exception { + if (part == null) { return FileType.IMAGINARY; } - if (isMultipart()) - { + if (isMultipart()) { // we cant have children ... return FileType.FILE_OR_FOLDER; } @@ -140,46 +121,37 @@ protected FileType doGetType() throws Exception } @Override - protected String[] doListChildren() throws Exception - { + protected String[] doListChildren() throws Exception { return null; } /** - * Lists the children of the file. Is only called if {@link #doGetType} - * returns {@link org.apache.commons.vfs2.FileType#FOLDER}. + * Lists the children of the file. Is only called if {@link #doGetType} returns + * {@link org.apache.commons.vfs2.FileType#FOLDER}. */ @Override - protected FileObject[] doListChildrenResolved() throws Exception - { - if (part == null) - { + protected FileObject[] doListChildrenResolved() throws Exception { + if (part == null) { return null; } - final List vfs = new ArrayList(); - if (isMultipart()) - { + final List vfs = new ArrayList<>(); + if (isMultipart()) { final Object container = part.getContent(); - if (container instanceof Multipart) - { + if (container instanceof Multipart) { final Multipart multipart = (Multipart) container; - for (int i = 0; i < multipart.getCount(); i++) - { + for (int i = 0; i < multipart.getCount(); i++) { final Part part = multipart.getBodyPart(i); String filename = UriParser.encode(part.getFileName()); - if (filename == null) - { + if (filename == null) { filename = MimeFileSystem.NULL_BP_NAME + i; } - final MimeFileObject fo = (MimeFileObject) FileObjectUtils.getAbstractFileObject( - getFileSystem().resolveFile( - getFileSystem().getFileSystemManager().resolveName(getName(), - filename, - NameScope.CHILD))); + final MimeFileObject fo = (MimeFileObject) FileObjectUtils + .getAbstractFileObject(getFileSystem().resolveFile(getFileSystem().getFileSystemManager() + .resolveName(getName(), filename, NameScope.CHILD))); fo.setPart(part); vfs.add(fo); } @@ -189,8 +161,7 @@ protected FileObject[] doListChildrenResolved() throws Exception return vfs.toArray(new MimeFileObject[vfs.size()]); } - private void setPart(final Part part) - { + private void setPart(final Part part) { this.part = part; this.attributeMap = null; } @@ -199,8 +170,7 @@ private void setPart(final Part part) * Returns the size of the file content (in bytes). */ @Override - protected long doGetContentSize() throws Exception - { + protected long doGetContentSize() throws Exception { return part.getSize(); } @@ -208,29 +178,22 @@ protected long doGetContentSize() throws Exception * Returns the last modified time of this file. */ @Override - protected long doGetLastModifiedTime() - throws Exception - { + protected long doGetLastModifiedTime() throws Exception { final Message mm = getMessage(); - if (mm == null) - { + if (mm == null) { return -1; } - if (mm.getSentDate() != null) - { + if (mm.getSentDate() != null) { return mm.getSentDate().getTime(); } - if (mm.getReceivedDate() != null) - { + if (mm.getReceivedDate() != null) { mm.getReceivedDate(); } return 0; } - private Message getMessage() throws FileSystemException - { - if (part instanceof Message) - { + private Message getMessage() throws FileSystemException { + if (part instanceof Message) { return (Message) part; } @@ -241,16 +204,13 @@ private Message getMessage() throws FileSystemException * Creates an input stream to read the file content from. */ @Override - protected InputStream doGetInputStream() throws Exception - { - if (isMultipart()) - { + protected InputStream doGetInputStream() throws Exception { + if (isMultipart()) { // deliver the preamble as the only content final String preamble = ((MimeMultipart) part.getContent()).getPreamble(); - if (preamble == null) - { - return new ByteArrayInputStream(new byte[]{}); + if (preamble == null) { + return new ByteArrayInputStream(new byte[] {}); } return new ByteArrayInputStream(preamble.getBytes(MimeFileSystem.PREAMBLE_CHARSET)); } @@ -258,19 +218,16 @@ protected InputStream doGetInputStream() throws Exception return part.getInputStream(); } - boolean isMultipart() throws MessagingException - { + boolean isMultipart() throws MessagingException { return part.getContentType() != null && part.getContentType().startsWith("multipart/"); } @Override - protected FileContentInfoFactory getFileContentInfoFactory() - { + protected FileContentInfoFactory getFileContentInfoFactory() { return new MimeFileContentInfoFactory(); } - protected Part getPart() - { + protected Part getPart() { return part; } @@ -284,16 +241,11 @@ protected Part getPart() * */ @Override - protected Map doGetAttributes() throws Exception - { - if (attributeMap == null) - { - if (part != null) - { + protected Map doGetAttributes() throws Exception { + if (attributeMap == null) { + if (part != null) { attributeMap = new MimeAttributesMap(part); - } - else - { + } else { attributeMap = Collections.emptyMap(); } } @@ -302,8 +254,7 @@ protected Map doGetAttributes() throws Exception } @SuppressWarnings("unchecked") // Javadoc says Part returns Header - protected Enumeration
getAllHeaders() throws MessagingException - { + protected Enumeration
getAllHeaders() throws MessagingException { return part.getAllHeaders(); } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java similarity index 67% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java index 295664bf1e..7c9ba37b4f 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileProvider.java @@ -34,23 +34,12 @@ /** * A provider for MIME Message. */ -public class MimeFileProvider - extends AbstractLayeredFileProvider - implements FileProvider -{ - static final Collection capabilities = - Collections.unmodifiableCollection(Arrays.asList(new Capability[] - { - Capability.GET_TYPE, - Capability.GET_LAST_MODIFIED, - Capability.LIST_CHILDREN, - Capability.READ_CONTENT, - Capability.URI, - Capability.ATTRIBUTES - })); +public class MimeFileProvider extends AbstractLayeredFileProvider implements FileProvider { + static final Collection capabilities = Collections + .unmodifiableCollection(Arrays.asList(new Capability[] { Capability.GET_TYPE, Capability.GET_LAST_MODIFIED, + Capability.LIST_CHILDREN, Capability.READ_CONTENT, Capability.URI, Capability.ATTRIBUTES })); - public MimeFileProvider() - { + public MimeFileProvider() { super(); } @@ -59,16 +48,12 @@ public MimeFileProvider() */ @Override protected FileSystem doCreateFileSystem(final String scheme, final FileObject file, - final FileSystemOptions fileSystemOptions) - throws FileSystemException - { - final FileName name = - new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER); + final FileSystemOptions fileSystemOptions) throws FileSystemException { + final FileName name = new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER); return new MimeFileSystem(name, file, fileSystemOptions); } - public Collection getCapabilities() - { + public Collection getCapabilities() { return capabilities; } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java similarity index 83% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java index 960688a9f0..a7c340c036 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java @@ -38,9 +38,7 @@ /** * An MIME file system. */ -public class MimeFileSystem - extends AbstractFileSystem -{ +public class MimeFileSystem extends AbstractFileSystem { static final String NULL_BP_NAME = "_body_part_"; static final String CONTENT_NAME = "_content"; static final String PREAMBLE_CHARSET = "UTF-8"; @@ -50,8 +48,7 @@ public class MimeFileSystem private InputStream mimeStream = null; protected MimeFileSystem(final FileName rootName, final FileObject parentLayer, - final FileSystemOptions fileSystemOptions) - { + final FileSystemOptions fileSystemOptions) { super(rootName, parentLayer, fileSystemOptions); } @@ -59,8 +56,7 @@ protected MimeFileSystem(final FileName rootName, final FileObject parentLayer, * Creates a file object. */ @Override - protected FileObject createFile(final AbstractFileName name) throws FileSystemException - { + protected FileObject createFile(final AbstractFileName name) throws FileSystemException { return new MimeFileObject(name, null, this); } @@ -68,62 +64,45 @@ protected FileObject createFile(final AbstractFileName name) throws FileSystemEx * Returns the capabilities of this file system. */ @Override - protected void addCapabilities(final Collection caps) - { + protected void addCapabilities(final Collection caps) { caps.addAll(MimeFileProvider.capabilities); } - @Override - protected void doCloseCommunicationLink() - { - try - { - if (mimeStream == null) - { + protected void doCloseCommunicationLink() { + try { + if (mimeStream == null) { return; } closeMimeStream(); mimeStream = null; - } - catch (final IOException e) - { + } catch (final IOException e) { log.warn(e.getLocalizedMessage(), e); } } - private void closeMimeStream() throws IOException - { - if (mimeStream instanceof SharedRandomContentInputStream) - { + private void closeMimeStream() throws IOException { + if (mimeStream instanceof SharedRandomContentInputStream) { ((SharedRandomContentInputStream) mimeStream).closeAll(); - } - else - { + } else { mimeStream.close(); } } - public Part createCommunicationLink() throws IOException, MessagingException - { - if (mimeStream != null) - { + public Part createCommunicationLink() throws IOException, MessagingException { + if (mimeStream != null) { closeMimeStream(); } final FileObject parentLayer = getParentLayer(); - if (!parentLayer.exists()) - { + if (!parentLayer.exists()) { return null; } - if (parentLayer.getFileSystem().hasCapability(Capability.RANDOM_ACCESS_READ)) - { + if (parentLayer.getFileSystem().hasCapability(Capability.RANDOM_ACCESS_READ)) { mimeStream = new SharedRandomContentInputStream(parentLayer); - } - else - { + } else { mimeStream = getParentLayer().getContent().getInputStream(); } return new MimeMessage(null, mimeStream); diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/package.html b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/package.html similarity index 100% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/package.html rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/package.html diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java similarity index 75% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java index 96dfb7d44d..b7593816a2 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileName.java @@ -22,27 +22,17 @@ import org.apache.commons.vfs2.provider.GenericFileName; /** - * An SMB URI. Adds a share name to the generic URI. + * An SMB URI. Adds a share name to the generic URI. */ -public class SmbFileName extends GenericFileName -{ +public class SmbFileName extends GenericFileName { private static final int DEFAULT_PORT = 139; private final String share; private final String domain; private String uriWithoutAuth; - protected SmbFileName( - final String scheme, - final String hostName, - final int port, - final String userName, - final String password, - final String domain, - final String share, - final String path, - final FileType type) - { + protected SmbFileName(final String scheme, final String hostName, final int port, final String userName, + final String password, final String domain, final String share, final String path, final FileType type) { super(scheme, hostName, port, DEFAULT_PORT, userName, password, path, type); this.share = share; this.domain = domain; @@ -50,10 +40,10 @@ protected SmbFileName( /** * Returns the share name. + * * @return share name */ - public String getShare() - { + public String getShare() { return share; } @@ -61,8 +51,7 @@ public String getShare() * Builds the root URI for this file name. */ @Override - protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) - { + protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) { super.appendRootUri(buffer, addPassword); buffer.append('/'); buffer.append(share); @@ -74,11 +63,8 @@ protected void appendRootUri(final StringBuilder buffer, final boolean addPasswo * Uses super method to add password or password placeholder. */ @Override - protected void appendCredentials(final StringBuilder buffer, final boolean addPassword) - { - if (getDomain() != null && getDomain().length() != 0 && - getUserName() != null && getUserName().length() != 0) - { + protected void appendCredentials(final StringBuilder buffer, final boolean addPassword) { + if (getDomain() != null && getDomain().length() != 0 && getUserName() != null && getUserName().length() != 0) { buffer.append(getDomain()); buffer.append("\\"); } @@ -93,18 +79,9 @@ protected void appendCredentials(final StringBuilder buffer, final boolean addPa * @return new SmbFileName object, never null. */ @Override - public FileName createName(final String path, final FileType type) - { - return new SmbFileName( - getScheme(), - getHostName(), - getPort(), - getUserName(), - getPassword(), - domain, - share, - path, - type); + public FileName createName(final String path, final FileType type) { + return new SmbFileName(getScheme(), getHostName(), getPort(), getUserName(), getPassword(), domain, share, path, + type); } /** @@ -113,10 +90,8 @@ public FileName createName(final String path, final FileType type) * @return caches and return URI with no username/password, never null * @throws FileSystemException if any of the invoked methods throw */ - public String getUriWithoutAuth() throws FileSystemException - { - if (uriWithoutAuth != null) - { + public String getUriWithoutAuth() throws FileSystemException { + if (uriWithoutAuth != null) { return uriWithoutAuth; } @@ -124,8 +99,7 @@ public String getUriWithoutAuth() throws FileSystemException sb.append(getScheme()); sb.append("://"); sb.append(getHostName()); - if (getPort() != DEFAULT_PORT) - { + if (getPort() != DEFAULT_PORT) { sb.append(":"); sb.append(getPort()); } @@ -138,10 +112,10 @@ public String getUriWithoutAuth() throws FileSystemException /** * Returns the domain name. + * * @return domain name */ - public String getDomain() - { + public String getDomain() { return domain; } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java similarity index 74% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java index 7d8cd3a763..3623b1c18b 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileNameParser.java @@ -27,25 +27,21 @@ /** * Implementation for sftp. set default port to 139 */ -public class SmbFileNameParser extends URLFileNameParser -{ +public class SmbFileNameParser extends URLFileNameParser { private static final SmbFileNameParser INSTANCE = new SmbFileNameParser(); private static final int SMB_PORT = 139; - public SmbFileNameParser() - { + public SmbFileNameParser() { super(SMB_PORT); } - public static FileNameParser getInstance() - { + public static FileNameParser getInstance() { return INSTANCE; } @Override - public FileName parseUri(final VfsComponentContext context, final FileName base, - final String filename) throws FileSystemException - { + public FileName parseUri(final VfsComponentContext context, final FileName base, final String filename) + throws FileSystemException { final StringBuilder name = new StringBuilder(); // Extract the scheme and authority parts @@ -54,8 +50,7 @@ public FileName parseUri(final VfsComponentContext context, final FileName base, // extract domain String username = auth.getUserName(); final String domain = extractDomain(username); - if (domain != null) - { + if (domain != null) { username = username.substring(domain.length() + 1); } @@ -65,39 +60,26 @@ public FileName parseUri(final VfsComponentContext context, final FileName base, // Extract the share final String share = UriParser.extractFirstElement(name); - if (share == null || share.length() == 0) - { + if (share == null || share.length() == 0) { throw new FileSystemException("vfs.provider.smb/missing-share-name.error", filename); } - // Normalise the path. Do this after extracting the share name, + // Normalise the path. Do this after extracting the share name, // to deal with things like smb://hostname/share/.. final FileType fileType = UriParser.normalisePath(name); final String path = name.toString(); - return new SmbFileName( - auth.getScheme(), - auth.getHostName(), - auth.getPort(), - username, - auth.getPassword(), - domain, - share, - path, - fileType); + return new SmbFileName(auth.getScheme(), auth.getHostName(), auth.getPort(), username, auth.getPassword(), + domain, share, path, fileType); } - private String extractDomain(final String username) - { - if (username == null) - { + private String extractDomain(final String username) { + if (username == null) { return null; } - for (int i = 0; i < username.length(); i++) - { - if (username.charAt(i) == '\\') - { + for (int i = 0; i < username.length(); i++) { + if (username.charAt(i) == '\\') { return username.substring(0, i); } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java similarity index 66% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java index b6d863f1f3..7a9dc40c0f 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java @@ -42,15 +42,11 @@ /** * A file in an SMB file system. */ -public class SmbFileObject - extends AbstractFileObject -{ +public class SmbFileObject extends AbstractFileObject { // private final String fileName; private SmbFile file; - protected SmbFileObject(final AbstractFileName name, - final SmbFileSystem fileSystem) throws FileSystemException - { + protected SmbFileObject(final AbstractFileName name, final SmbFileSystem fileSystem) throws FileSystemException { super(name, fileSystem); // this.fileName = UriParser.decode(name.getURI()); } @@ -59,50 +55,42 @@ protected SmbFileObject(final AbstractFileName name, * Attaches this file object to its file resource. */ @Override - protected void doAttach() throws Exception - { + protected void doAttach() throws Exception { // Defer creation of the SmbFile to here - if (file == null) - { + if (file == null) { file = createSmbFile(getName()); } } @Override - protected void doDetach() throws Exception - { + protected void doDetach() throws Exception { // file closed through content-streams file = null; } private SmbFile createSmbFile(final FileName fileName) - throws MalformedURLException, SmbException, FileSystemException - { + throws MalformedURLException, SmbException, FileSystemException { final SmbFileName smbFileName = (SmbFileName) fileName; final String path = smbFileName.getUriWithoutAuth(); UserAuthenticationData authData = null; SmbFile file; - try - { - authData = UserAuthenticatorUtils.authenticate( - getFileSystem().getFileSystemOptions(), - SmbFileProvider.AUTHENTICATOR_TYPES); + try { + authData = UserAuthenticatorUtils.authenticate(getFileSystem().getFileSystemOptions(), + SmbFileProvider.AUTHENTICATOR_TYPES); NtlmPasswordAuthentication auth = null; - if (authData != null) - { + if (authData != null) { auth = new NtlmPasswordAuthentication( - UserAuthenticatorUtils.toString( - UserAuthenticatorUtils.getData(authData, UserAuthenticationData.DOMAIN, - UserAuthenticatorUtils.toChar(smbFileName.getDomain()))), - UserAuthenticatorUtils.toString( - UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, - UserAuthenticatorUtils.toChar(smbFileName.getUserName()))), - UserAuthenticatorUtils.toString( - UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, - UserAuthenticatorUtils.toChar(smbFileName.getPassword())))); + UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, + UserAuthenticationData.DOMAIN, UserAuthenticatorUtils.toChar(smbFileName.getDomain()))), + UserAuthenticatorUtils + .toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, + UserAuthenticatorUtils.toChar(smbFileName.getUserName()))), + UserAuthenticatorUtils + .toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, + UserAuthenticatorUtils.toChar(smbFileName.getPassword())))); } // if auth == null SmbFile uses default credentials @@ -111,35 +99,25 @@ private SmbFile createSmbFile(final FileName fileName) // ANONYMOUS=("","","") file = new SmbFile(path, auth); - if (file.isDirectory() && !file.toString().endsWith("/")) - { + if (file.isDirectory() && !file.toString().endsWith("/")) { file = new SmbFile(path + "/", auth); } return file; - } - finally - { + } finally { UserAuthenticatorUtils.cleanup(authData); // might be null } } /** - * Determines the type of the file, returns null if the file does not - * exist. + * Determines the type of the file, returns null if the file does not exist. */ @Override - protected FileType doGetType() throws Exception - { - if (!file.exists()) - { + protected FileType doGetType() throws Exception { + if (!file.exists()) { return FileType.IMAGINARY; - } - else if (file.isDirectory()) - { + } else if (file.isDirectory()) { return FileType.FOLDER; - } - else if (file.isFile()) - { + } else if (file.isFile()) { return FileType.FILE; } @@ -147,15 +125,12 @@ else if (file.isFile()) } /** - * Lists the children of the file. Is only called if {@link #doGetType} - * returns {@link FileType#FOLDER}. + * Lists the children of the file. Is only called if {@link #doGetType} returns {@link FileType#FOLDER}. */ @Override - protected String[] doListChildren() throws Exception - { + protected String[] doListChildren() throws Exception { // VFS-210: do not try to get listing for anything else than directories - if (!file.isDirectory()) - { + if (!file.isDirectory()) { return null; } @@ -166,8 +141,7 @@ protected String[] doListChildren() throws Exception * Determines if this file is hidden. */ @Override - protected boolean doIsHidden() throws Exception - { + protected boolean doIsHidden() throws Exception { return file.isHidden(); } @@ -175,14 +149,12 @@ protected boolean doIsHidden() throws Exception * Deletes the file. */ @Override - protected void doDelete() throws Exception - { + protected void doDelete() throws Exception { file.delete(); } @Override - protected void doRename(final FileObject newfile) throws Exception - { + protected void doRename(final FileObject newfile) throws Exception { file.renameTo(createSmbFile(newfile.getName())); } @@ -190,8 +162,7 @@ protected void doRename(final FileObject newfile) throws Exception * Creates this file as a folder. */ @Override - protected void doCreateFolder() throws Exception - { + protected void doCreateFolder() throws Exception { file.mkdir(); file = createSmbFile(getName()); } @@ -200,8 +171,7 @@ protected void doCreateFolder() throws Exception * Returns the size of the file content (in bytes). */ @Override - protected long doGetContentSize() throws Exception - { + protected long doGetContentSize() throws Exception { return file.length(); } @@ -209,9 +179,7 @@ protected long doGetContentSize() throws Exception * Returns the last modified time of this file. */ @Override - protected long doGetLastModifiedTime() - throws Exception - { + protected long doGetLastModifiedTime() throws Exception { return file.getLastModified(); } @@ -219,20 +187,13 @@ protected long doGetLastModifiedTime() * Creates an input stream to read the file content from. */ @Override - protected InputStream doGetInputStream() throws Exception - { - try - { + protected InputStream doGetInputStream() throws Exception { + try { return new SmbFileInputStream(file); - } - catch (final SmbException e) - { - if (e.getErrorCode() == SmbException.ERRbadfile) - { + } catch (final SmbException e) { + if (e.getNtStatus() == SmbException.NT_STATUS_NO_SUCH_FILE) { throw new org.apache.commons.vfs2.FileNotFoundException(getName()); - } - else if (file.isDirectory()) - { + } else if (file.isDirectory()) { throw new FileTypeHasNoContentException(getName()); } @@ -244,8 +205,7 @@ else if (file.isDirectory()) * Creates an output stream to write the file content to. */ @Override - protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception - { + protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception { return new SmbFileOutputStream(file, bAppend); } @@ -253,14 +213,12 @@ protected OutputStream doGetOutputStream(final boolean bAppend) throws Exception * random access */ @Override - protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception - { + protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception { return new SmbFileRandomAccessContent(file, mode); } @Override - protected boolean doSetLastModifiedTime(final long modtime) throws Exception - { + protected boolean doSetLastModifiedTime(final long modtime) throws Exception { file.setLastModified(modtime); return true; } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java similarity index 64% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java index 9413954904..66d4c2b88d 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java @@ -32,37 +32,19 @@ /** * A provider for SMB (Samba, Windows share) file systems. */ -public class SmbFileProvider - extends AbstractOriginatingFileProvider - implements FileProvider -{ +public class SmbFileProvider extends AbstractOriginatingFileProvider implements FileProvider { /** Authentication data supported by this provider. */ - public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[] - { - UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD, UserAuthenticationData.DOMAIN - }; + public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[] { + UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD, UserAuthenticationData.DOMAIN }; - static final Collection capabilities = - Collections.unmodifiableCollection(Arrays.asList(new Capability[] - { - Capability.CREATE, - Capability.DELETE, - Capability.RENAME, - Capability.GET_TYPE, - Capability.GET_LAST_MODIFIED, - Capability.SET_LAST_MODIFIED_FILE, - Capability.SET_LAST_MODIFIED_FOLDER, - Capability.LIST_CHILDREN, - Capability.READ_CONTENT, - Capability.URI, - Capability.WRITE_CONTENT, - Capability.APPEND_CONTENT, - Capability.RANDOM_ACCESS_READ, - Capability.RANDOM_ACCESS_WRITE - })); + static final Collection capabilities = Collections + .unmodifiableCollection(Arrays.asList(new Capability[] { Capability.CREATE, Capability.DELETE, + Capability.RENAME, Capability.GET_TYPE, Capability.GET_LAST_MODIFIED, + Capability.SET_LAST_MODIFIED_FILE, Capability.SET_LAST_MODIFIED_FOLDER, Capability.LIST_CHILDREN, + Capability.READ_CONTENT, Capability.URI, Capability.WRITE_CONTENT, Capability.APPEND_CONTENT, + Capability.RANDOM_ACCESS_READ, Capability.RANDOM_ACCESS_WRITE })); - public SmbFileProvider() - { + public SmbFileProvider() { super(); setFileNameParser(SmbFileNameParser.getInstance()); } @@ -72,13 +54,11 @@ public SmbFileProvider() */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + throws FileSystemException { return new SmbFileSystem(name, fileSystemOptions); } - public Collection getCapabilities() - { + public Collection getCapabilities() { return capabilities; } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java similarity index 63% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java index 73b9cd591a..2e0b31b721 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileRandomAccessContent.java @@ -32,26 +32,20 @@ /** * RandomAccess for smb files */ -class SmbFileRandomAccessContent extends AbstractRandomAccessContent -{ +class SmbFileRandomAccessContent extends AbstractRandomAccessContent { private final SmbRandomAccessFile raf; private final InputStream rafis; - SmbFileRandomAccessContent(final SmbFile smbFile, final RandomAccessMode mode) throws FileSystemException - { + SmbFileRandomAccessContent(final SmbFile smbFile, final RandomAccessMode mode) throws FileSystemException { super(mode); - try - { + try { raf = new SmbRandomAccessFile(smbFile, mode.getModeString()); - rafis = new InputStream() - { + rafis = new InputStream() { @Override - public int available() throws IOException - { + public int available() throws IOException { final long available = raf.length() - raf.getFilePointer(); - if (available > Integer.MAX_VALUE) - { + if (available > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } @@ -59,232 +53,187 @@ public int available() throws IOException } @Override - public void close() throws IOException - { + public void close() throws IOException { raf.close(); } @Override - public int read() throws IOException - { + public int read() throws IOException { return raf.readByte(); } @Override - public int read(final byte[] b) throws IOException - { + public int read(final byte[] b) throws IOException { return raf.read(b); } @Override - public int read(final byte[] b, final int off, final int len) throws IOException - { + public int read(final byte[] b, final int off, final int len) throws IOException { return raf.read(b, off, len); } @Override - public long skip(final long n) throws IOException - { + public long skip(final long n) throws IOException { raf.seek(raf.getFilePointer() + n); return n; } }; - } - catch (final MalformedURLException e) - { + } catch (final MalformedURLException e) { throw new FileSystemException("vfs.provider/random-access-open-failed.error", smbFile, e); - } - catch (final SmbException e) - { + } catch (final SmbException e) { throw new FileSystemException("vfs.provider/random-access-open-failed.error", smbFile, e); - } - catch (final UnknownHostException e) - { + } catch (final UnknownHostException e) { throw new FileSystemException("vfs.provider/random-access-open-failed.error", smbFile, e); } } - public void close() throws IOException - { + public void close() throws IOException { raf.close(); } - public long getFilePointer() throws IOException - { + public long getFilePointer() throws IOException { return raf.getFilePointer(); } - public InputStream getInputStream() throws IOException - { + public InputStream getInputStream() throws IOException { return rafis; } - public long length() throws IOException - { + public long length() throws IOException { return raf.length(); } - public boolean readBoolean() throws IOException - { + public boolean readBoolean() throws IOException { return raf.readBoolean(); } - public byte readByte() throws IOException - { + public byte readByte() throws IOException { return raf.readByte(); } - public char readChar() throws IOException - { + public char readChar() throws IOException { return raf.readChar(); } - public double readDouble() throws IOException - { + public double readDouble() throws IOException { return raf.readDouble(); } - public float readFloat() throws IOException - { + public float readFloat() throws IOException { return raf.readFloat(); } - public void readFully(final byte[] b) throws IOException - { + public void readFully(final byte[] b) throws IOException { raf.readFully(b); } - public void readFully(final byte[] b, final int off, final int len) throws IOException - { + public void readFully(final byte[] b, final int off, final int len) throws IOException { raf.readFully(b, off, len); } - public int readInt() throws IOException - { + public int readInt() throws IOException { return raf.readInt(); } - public long readLong() throws IOException - { + public long readLong() throws IOException { return raf.readLong(); } - public short readShort() throws IOException - { + public short readShort() throws IOException { return raf.readShort(); } - public int readUnsignedByte() throws IOException - { + public int readUnsignedByte() throws IOException { return raf.readUnsignedByte(); } - public int readUnsignedShort() throws IOException - { + public int readUnsignedShort() throws IOException { return raf.readUnsignedShort(); } - public String readUTF() throws IOException - { + public String readUTF() throws IOException { return raf.readUTF(); } - public void seek(final long pos) throws IOException - { + public void seek(final long pos) throws IOException { raf.seek(pos); } - public void setLength(final long newLength) throws IOException - { + public void setLength(final long newLength) throws IOException { raf.setLength(newLength); } - public int skipBytes(final int n) throws IOException - { + public int skipBytes(final int n) throws IOException { return raf.skipBytes(n); } @Override - public void write(final byte[] b) throws IOException - { + public void write(final byte[] b) throws IOException { raf.write(b); } @Override - public void write(final byte[] b, final int off, final int len) throws IOException - { + public void write(final byte[] b, final int off, final int len) throws IOException { raf.write(b, off, len); } @Override - public void write(final int b) throws IOException - { + public void write(final int b) throws IOException { raf.write(b); } @Override - public void writeBoolean(final boolean v) throws IOException - { + public void writeBoolean(final boolean v) throws IOException { raf.writeBoolean(v); } @Override - public void writeByte(final int v) throws IOException - { + public void writeByte(final int v) throws IOException { raf.writeByte(v); } @Override - public void writeBytes(final String s) throws IOException - { + public void writeBytes(final String s) throws IOException { raf.writeBytes(s); } @Override - public void writeChar(final int v) throws IOException - { + public void writeChar(final int v) throws IOException { raf.writeChar(v); } @Override - public void writeChars(final String s) throws IOException - { + public void writeChars(final String s) throws IOException { raf.writeChars(s); } @Override - public void writeDouble(final double v) throws IOException - { + public void writeDouble(final double v) throws IOException { raf.writeDouble(v); } @Override - public void writeFloat(final float v) throws IOException - { + public void writeFloat(final float v) throws IOException { raf.writeFloat(v); } @Override - public void writeInt(final int v) throws IOException - { + public void writeInt(final int v) throws IOException { raf.writeInt(v); } @Override - public void writeLong(final long v) throws IOException - { + public void writeLong(final long v) throws IOException { raf.writeLong(v); } @Override - public void writeShort(final int v) throws IOException - { + public void writeShort(final int v) throws IOException { raf.writeShort(v); } @Override - public void writeUTF(final String str) throws IOException - { + public void writeUTF(final String str) throws IOException { raf.writeUTF(str); } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileSystem.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileSystem.java similarity index 92% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileSystem.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileSystem.java index ed1942ee6a..bae807d4a1 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileSystem.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileSystem.java @@ -29,11 +29,8 @@ /** * An SMB file system. */ -public class SmbFileSystem - extends AbstractFileSystem -{ - protected SmbFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) - { +public class SmbFileSystem extends AbstractFileSystem { + protected SmbFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); } @@ -41,8 +38,7 @@ protected SmbFileSystem(final FileName rootName, final FileSystemOptions fileSys * Creates a file object. */ @Override - protected FileObject createFile(final AbstractFileName name) throws FileSystemException - { + protected FileObject createFile(final AbstractFileName name) throws FileSystemException { return new SmbFileObject(name, this); } @@ -50,8 +46,7 @@ protected FileObject createFile(final AbstractFileName name) throws FileSystemEx * Returns the capabilities of this file system. */ @Override - protected void addCapabilities(final Collection caps) - { + protected void addCapabilities(final Collection caps) { caps.addAll(SmbFileProvider.capabilities); } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/package.html b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/package.html similarity index 100% rename from sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/package.html rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/package.html diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java similarity index 78% rename from sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java index d3258983d4..1c650e5835 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java @@ -28,39 +28,30 @@ /** * (Sandbox) Provide access to a FileObject as JAF DataSource. */ -public class FileObjectDataSource implements DataSource -{ +public class FileObjectDataSource implements DataSource { private final FileObject fo; - public FileObjectDataSource(final FileObject fo) - { + public FileObjectDataSource(final FileObject fo) { this.fo = fo; } - public InputStream getInputStream() throws IOException - { + public InputStream getInputStream() throws IOException { return fo.getContent().getInputStream(); } - public OutputStream getOutputStream() throws IOException - { + public OutputStream getOutputStream() throws IOException { return fo.getContent().getOutputStream(); } - public String getContentType() - { - try - { + public String getContentType() { + try { return fo.getContent().getContentInfo().getContentType(); - } - catch (final FileSystemException e) - { + } catch (final FileSystemException e) { throw new RuntimeException(e); } } - public String getName() - { + public String getName() { return fo.getName().getBaseName(); } } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/util/RACRandomAccessFile.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/RACRandomAccessFile.java similarity index 71% rename from sandbox/src/main/java/org/apache/commons/vfs2/util/RACRandomAccessFile.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/RACRandomAccessFile.java index 1ec9cad602..3a525d389f 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/util/RACRandomAccessFile.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/RACRandomAccessFile.java @@ -22,127 +22,104 @@ import org.apache.commons.vfs2.RandomAccessContent; /** - * (Sandbox) Encapsulates a {@link RandomAccessContent} instance, allowing it to be used - * as a {@link RandomAccessFile} instance. + * (Sandbox) Encapsulates a {@link RandomAccessContent} instance, allowing it to be used as a {@link RandomAccessFile} + * instance. */ -public class RACRandomAccessFile extends RandomAccessFile implements RandomAccessContent -{ +public class RACRandomAccessFile extends RandomAccessFile implements RandomAccessContent { private final byte[] singleByteBuf = new byte[1]; private RandomAccessContent rac; - public RACRandomAccessFile(final RandomAccessContent rac) throws IOException - { + public RACRandomAccessFile(final RandomAccessContent rac) throws IOException { this(createTempFile()); this.rac = rac; } - private RACRandomAccessFile(final File tempFile) throws IOException - { + private RACRandomAccessFile(final File tempFile) throws IOException { super(tempFile, "r"); deleteTempFile(tempFile); } - private static File createTempFile() throws IOException - { + private static File createTempFile() throws IOException { return File.createTempFile("fraf", ""); } - private void deleteTempFile(final File tempFile) - { - try - { + private void deleteTempFile(final File tempFile) { + try { super.close(); - } - catch (final IOException ex) - { + } catch (final IOException ex) { throw new RuntimeException(ex); - } - finally - { + } finally { /* ignored = */ tempFile.delete(); } } @Override - public long getFilePointer() throws IOException - { + public long getFilePointer() throws IOException { return this.rac.getFilePointer(); } @Override - public void seek(final long pos) throws IOException - { + public void seek(final long pos) throws IOException { this.rac.seek(pos); } @Override - public int skipBytes(final int n) throws IOException - { + public int skipBytes(final int n) throws IOException { return this.rac.skipBytes(n); } @Override - public long length() throws IOException - { + public long length() throws IOException { return this.rac.length(); } @Override - public void setLength(final long newLength) throws IOException - { + public void setLength(final long newLength) throws IOException { throw new IOException("Underlying RandomAccessContent instance length cannot be modified."); } - public InputStream getInputStream() throws IOException - { + public InputStream getInputStream() throws IOException { return this.rac.getInputStream(); } @Override - public void close() throws IOException - { + public void close() throws IOException { this.rac.close(); } @Override - public final int read(final byte[] b) throws IOException - { + public final int read(final byte[] b) throws IOException { return read(b, 0, b.length); } @Override - public final int read() throws IOException - { + public final int read() throws IOException { final byte[] buf = this.singleByteBuf; final int count = read(buf, 0, 1); return count < 0 ? -1 : buf[0] & 0xFF; } @Override - public int read(final byte[] b, final int off, final int len) throws IOException - { + public int read(final byte[] b, final int off, final int len) throws IOException { this.rac.readFully(b, off, len); return len; } @Override - public final void write(final int b) throws IOException - { + public final void write(final int b) throws IOException { final byte[] buf = this.singleByteBuf; buf[0] = (byte) b; write(buf, 0, 1); } @Override - public final void write(final byte[] b) throws IOException - { + public final void write(final byte[] b) throws IOException { write(b, 0, b.length); } @Override - public void write(final byte[] b, final int off, final int len) throws IOException - { + public void write(final byte[] b, final int off, final int len) throws IOException { this.rac.write(b, off, len); } diff --git a/sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java similarity index 66% rename from sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java rename to commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java index 2fbd130add..535d631f52 100644 --- a/sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java +++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java @@ -32,8 +32,7 @@ /** * (Sandbox) A wrapper to an FileObject to get a {@link javax.mail.internet.SharedInputStream}. */ -public class SharedRandomContentInputStream extends BufferedInputStream implements SharedInputStream -{ +public class SharedRandomContentInputStream extends BufferedInputStream implements SharedInputStream { private final Set createdStreams; private final FileObject fo; private final long fileStart; @@ -43,14 +42,11 @@ public class SharedRandomContentInputStream extends BufferedInputStream implemen private long resetCount; private SharedRandomContentInputStream(final Set createdStreams, - final FileObject fo, final long fileStart, final long fileEnd, - final InputStream is) - throws FileSystemException - { + final FileObject fo, final long fileStart, final long fileEnd, final InputStream is) + throws FileSystemException { super(is); - if (!fo.getFileSystem().hasCapability(Capability.RANDOM_ACCESS_READ)) - { + if (!fo.getFileSystem().hasCapability(Capability.RANDOM_ACCESS_READ)) { throw new FileSystemException("vfs.util/missing-capability.error", Capability.RANDOM_ACCESS_READ); } @@ -59,23 +55,18 @@ private SharedRandomContentInputStream(final Set this.fileEnd = fileEnd; this.createdStreams = createdStreams; - synchronized (createdStreams) - { + synchronized (createdStreams) { createdStreams.add(this); } } - public SharedRandomContentInputStream(final FileObject fo) throws FileSystemException - { + public SharedRandomContentInputStream(final FileObject fo) throws FileSystemException { this(new HashSet(), fo, 0, -1, fo.getContent().getInputStream()); } - @Override - public synchronized int read() throws IOException - { - if (checkEnd()) - { + public synchronized int read() throws IOException { + if (checkEnd()) { return -1; } final int r = super.read(); @@ -85,15 +76,12 @@ public synchronized int read() throws IOException } @Override - public synchronized int read(final byte[] b, final int off, int len) throws IOException - { - if (checkEnd()) - { + public synchronized int read(final byte[] b, final int off, int len) throws IOException { + if (checkEnd()) { return -1; } - if (fileEnd > -1 && calcFilePosition(len) > fileEnd) - { + if (fileEnd > -1 && calcFilePosition(len) > fileEnd) { // we can not read past our end len = (int) (fileEnd - getFilePosition()); } @@ -105,15 +93,12 @@ public synchronized int read(final byte[] b, final int off, int len) throws IOEx } @Override - public synchronized long skip(long n) throws IOException - { - if (checkEnd()) - { + public synchronized long skip(long n) throws IOException { + if (checkEnd()) { return -1; } - if (fileEnd > -1 && calcFilePosition(n) > fileEnd) - { + if (fileEnd > -1 && calcFilePosition(n) > fileEnd) { // we can not skip past our end n = fileEnd - getFilePosition(); } @@ -125,106 +110,73 @@ public synchronized long skip(long n) throws IOException } /* - public synchronized int available() throws IOException - { - long realFileEnd = fileEnd; - if (realFileEnd < 0) - { - realFileEnd = fo.getContent().getSize(); - } - if (realFileEnd < 0) - { - // we cant determine if there is really something available - return 8192; - } - - long available = realFileEnd - (fileStart + pos); - if (available > Integer.MAX_VALUE) - { - return Integer.MAX_VALUE; - } - - return (int) available; - } - */ - - private boolean checkEnd() - { + * public synchronized int available() throws IOException { long realFileEnd = fileEnd; if (realFileEnd < 0) { + * realFileEnd = fo.getContent().getSize(); } if (realFileEnd < 0) { // we cant determine if there is really + * something available return 8192; } + * + * long available = realFileEnd - (fileStart + pos); if (available > Integer.MAX_VALUE) { return Integer.MAX_VALUE; + * } + * + * return (int) available; } + */ + + private boolean checkEnd() { return fileEnd > -1 && (getFilePosition() >= fileEnd); } - protected long getFilePosition() - { + protected long getFilePosition() { return fileStart + pos; } - protected long calcFilePosition(final long nadd) - { + protected long calcFilePosition(final long nadd) { return getFilePosition() + nadd; } @Override - public synchronized void mark(final int readlimit) - { + public synchronized void mark(final int readlimit) { super.mark(readlimit); resetCount = 0; } @Override - public synchronized void reset() throws IOException - { + public synchronized void reset() throws IOException { super.reset(); pos -= resetCount; resetCount = 0; } - public long getPosition() - { + public long getPosition() { return pos; } - @Override - public void close() throws IOException - { + public void close() throws IOException { super.close(); - synchronized (createdStreams) - { + synchronized (createdStreams) { createdStreams.remove(this); } } - public InputStream newStream(final long start, final long end) - { - try - { + public InputStream newStream(final long start, final long end) { + try { final long newFileStart = this.fileStart + start; final long newFileEnd = end < 0 ? this.fileEnd : this.fileStart + end; final RandomAccessContent rac = fo.getContent().getRandomAccessContent(RandomAccessMode.READ); rac.seek(newFileStart); - return new SharedRandomContentInputStream( - createdStreams, - fo, - newFileStart, - newFileEnd, - rac.getInputStream()); - } - catch (final IOException e) - { + return new SharedRandomContentInputStream(createdStreams, fo, newFileStart, newFileEnd, + rac.getInputStream()); + } catch (final IOException e) { throw new RuntimeException(e); } } - public void closeAll() throws IOException - { - synchronized (createdStreams) - { + public void closeAll() throws IOException { + synchronized (createdStreams) { final SharedRandomContentInputStream[] streams = new SharedRandomContentInputStream[createdStreams.size()]; createdStreams.toArray(streams); - for (final SharedRandomContentInputStream stream : streams) - { + for (final SharedRandomContentInputStream stream : streams) { stream.close(); } } diff --git a/sandbox/src/main/resources/META-INF/vfs-providers.xml b/commons-vfs2-sandbox/src/main/resources/META-INF/vfs-providers.xml similarity index 100% rename from sandbox/src/main/resources/META-INF/vfs-providers.xml rename to commons-vfs2-sandbox/src/main/resources/META-INF/vfs-providers.xml diff --git a/sandbox/src/site/site.xml b/commons-vfs2-sandbox/src/site/site.xml similarity index 100% rename from sandbox/src/site/site.xml rename to commons-vfs2-sandbox/src/site/site.xml diff --git a/sandbox/src/site/xdoc/index.xml b/commons-vfs2-sandbox/src/site/xdoc/index.xml similarity index 100% rename from sandbox/src/site/xdoc/index.xml rename to commons-vfs2-sandbox/src/site/xdoc/index.xml diff --git a/sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/FileNameTestCase.java b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/FileNameTestCase.java similarity index 95% rename from sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/FileNameTestCase.java rename to commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/FileNameTestCase.java index 585836ea2a..b19cba40de 100644 --- a/sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/FileNameTestCase.java +++ b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/FileNameTestCase.java @@ -24,17 +24,16 @@ /** * Some additional SMB file name test cases. */ -public class FileNameTestCase - extends AbstractVfsTestCase -{ +public class FileNameTestCase extends AbstractVfsTestCase { /** * Tests parsing a URI into its parts. + * * @throws Exception in case of error */ - public void testParseUri() throws Exception - { + public void testParseUri() throws Exception { // Simple name - SmbFileName name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, "smb://hostname/share/file"); + SmbFileName name = (SmbFileName) SmbFileNameParser.getInstance().parseUri(null, null, + "smb://hostname/share/file"); assertEquals("smb", name.getScheme()); assertNull(name.getUserName()); assertNull(name.getPassword()); @@ -113,10 +112,10 @@ public void testParseUri() throws Exception /** * Tests error handling in URI parser. + * * @throws Exception in case of error */ - public void testBadlyFormedUri() throws Exception - { + public void testBadlyFormedUri() throws Exception { // Does not start with smb:// testBadlyFormedUri("smb:", "vfs.provider/missing-double-slashes.error"); testBadlyFormedUri("smb:/", "vfs.provider/missing-double-slashes.error"); @@ -145,15 +144,11 @@ public void testBadlyFormedUri() throws Exception /** * Assert that parsing a URI fails with the expected error. */ - private void testBadlyFormedUri(final String uri, final String errorMsg) - { - try - { + private void testBadlyFormedUri(final String uri, final String errorMsg) { + try { SmbFileNameParser.getInstance().parseUri(null, null, uri); fail(); - } - catch (final FileSystemException e) - { + } catch (final FileSystemException e) { assertSameMessage(errorMsg, uri, e); } } diff --git a/sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java similarity index 83% rename from sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java rename to commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java index 1ad9820df0..2ce36624d4 100644 --- a/sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java +++ b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java @@ -29,19 +29,13 @@ /** * Tests for the SMB file system. */ -public class SmbProviderTestCase - extends AbstractProviderTestConfig - implements ProviderTestConfig -{ +public class SmbProviderTestCase extends AbstractProviderTestConfig implements ProviderTestConfig { private static final String TEST_URI = "test.smb.uri"; - public static Test suite() throws Exception - { - if (System.getProperty(TEST_URI) != null) - { + + public static Test suite() throws Exception { + if (System.getProperty(TEST_URI) != null) { return new ProviderTestSuite(new SmbProviderTestCase()); - } - else - { + } else { return notConfigured(SmbProviderTestCase.class); } } @@ -50,9 +44,7 @@ public static Test suite() throws Exception * Prepares the file system manager. */ @Override - public void prepare(final DefaultFileSystemManager manager) - throws Exception - { + public void prepare(final DefaultFileSystemManager manager) throws Exception { manager.addProvider("smb", new SmbFileProvider()); } @@ -60,8 +52,7 @@ public void prepare(final DefaultFileSystemManager manager) * Returns the base folder for tests. */ @Override - public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception - { + public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception { final String uri = System.getProperty(TEST_URI); return manager.resolveFile(uri); } diff --git a/core/pom.xml b/commons-vfs2/pom.xml similarity index 98% rename from core/pom.xml rename to commons-vfs2/pom.xml index e8f862f1d5..a9137dd85f 100644 --- a/core/pom.xml +++ b/commons-vfs2/pom.xml @@ -21,17 +21,17 @@ 4.0.0 - Apache Commons VFS Core + Apache Commons VFS org.apache.commons commons-vfs2 - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT Apache Commons VFS is a Virtual File System library. http://commons.apache.org/proper/commons-vfs/ org.apache.commons commons-vfs2-project - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT ../ @@ -90,7 +90,7 @@ sardine 5.6 - + junit junit @@ -136,10 +136,10 @@ - org.apache.jackrabbit - jackrabbit-standalone - 1.6.5 - + org.apache.jackrabbit + jackrabbit-standalone + 1.6.5 + * * @@ -331,7 +331,7 @@ - + ftp @@ -503,7 +503,7 @@ - + javadoc false diff --git a/core/src/main/java/org/apache/commons/vfs2/AllFileSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/AllFileSelector.java similarity index 91% rename from core/src/main/java/org/apache/commons/vfs2/AllFileSelector.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/AllFileSelector.java index 9255618f39..ad2fb8d044 100644 --- a/core/src/main/java/org/apache/commons/vfs2/AllFileSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/AllFileSelector.java @@ -19,28 +19,26 @@ /** * A {@link FileSelector} that selects everything. */ -public class AllFileSelector - implements FileSelector -{ +public class AllFileSelector implements FileSelector { /** * Determines if a file or folder should be selected. + * * @param fileInfo The file selection information. * @return true if the file should be selected, false otherwise. */ @Override - public boolean includeFile(final FileSelectInfo fileInfo) - { + public boolean includeFile(final FileSelectInfo fileInfo) { return true; } /** * Determines whether a folder should be traversed. + * * @param fileInfo The file selection information. * @return true if descendants should be traversed, false otherwise. */ @Override - public boolean traverseDescendents(final FileSelectInfo fileInfo) - { + public boolean traverseDescendents(final FileSelectInfo fileInfo) { return true; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/CacheStrategy.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/CacheStrategy.java similarity index 86% rename from core/src/main/java/org/apache/commons/vfs2/CacheStrategy.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/CacheStrategy.java index c2785e58a9..2e0d793447 100644 --- a/core/src/main/java/org/apache/commons/vfs2/CacheStrategy.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/CacheStrategy.java @@ -19,8 +19,7 @@ /** * An enumerated type to deal with the various cache strategies. */ -public enum CacheStrategy -{ +public enum CacheStrategy { /** * Deal with cached data manually. Call {@link FileObject#refresh()} to refresh the object data. */ @@ -32,9 +31,8 @@ public enum CacheStrategy ON_RESOLVE("onresolve"), /** - * Refresh the data every time you call a method on the fileObject. - * You'll use this only if you really need the latest info as this setting is a major performance - * loss. + * Refresh the data every time you call a method on the fileObject. You'll use this only if you really need the + * latest info as this setting is a major performance loss. */ ON_CALL("oncall"); @@ -43,27 +41,26 @@ public enum CacheStrategy */ private final String realName; - private CacheStrategy(final String name) - { + private CacheStrategy(final String name) { this.realName = name; } /** * Returns the name of the scope. + * * @return the name of the scope. */ @Override - public String toString() - { + public String toString() { return realName; } /** * Returns the name of the scope. + * * @return the name of the scope. */ - public String getName() - { + public String getName() { return realName; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/Capability.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/Capability.java similarity index 88% rename from core/src/main/java/org/apache/commons/vfs2/Capability.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/Capability.java index 8fe8474371..32685e0cbd 100644 --- a/core/src/main/java/org/apache/commons/vfs2/Capability.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/Capability.java @@ -19,8 +19,7 @@ /** * An enumerated type representing the capabilities of files and file systems. */ -public enum Capability -{ +public enum Capability { /** * File content can be read. */ @@ -107,8 +106,7 @@ public enum Capability LIST_CHILDREN, /** - * URI are supported. Files without this capability use URI that do not - * globally and uniquely identify the file. + * URI are supported. Files without this capability use URI that do not globally and uniquely identify the file. */ URI, @@ -123,16 +121,16 @@ public enum Capability JUNCTIONS, /** - * The set of attributes defined by the Jar manifest specification are - * supported. The attributes aren't necessarily stored in a manifest file. + * The set of attributes defined by the Jar manifest specification are supported. The attributes aren't necessarily + * stored in a manifest file. */ MANIFEST_ATTRIBUTES, /** - * The provider itself do not provide a filesystem. It simply resolves a full name - * and dispatches the request back to the filesystemmanager.
- * A provider with this capability cant tell much about the capabilities about the - * finally used filesystem in advance. + * The provider itself do not provide a filesystem. It simply resolves a full name and dispatches the request back + * to the filesystemmanager.
+ * A provider with this capability cant tell much about the capabilities about the finally used filesystem in + * advance. */ DISPATCHER, @@ -149,6 +147,7 @@ public enum Capability /** * Provides directories which allows you to read its content through * {@link org.apache.commons.vfs2.FileContent#getInputStream()}. + * * @since 2.0 */ DIRECTORY_READ_CONTENT; diff --git a/core/src/main/java/org/apache/commons/vfs2/FileChangeEvent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileChangeEvent.java similarity index 90% rename from core/src/main/java/org/apache/commons/vfs2/FileChangeEvent.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileChangeEvent.java index 74a72ab2c5..dc6dfa8502 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileChangeEvent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileChangeEvent.java @@ -19,24 +19,22 @@ /** * An event fired when a file is changed. */ -public class FileChangeEvent -{ +public class FileChangeEvent { /** * The file object */ private final FileObject file; - public FileChangeEvent(final FileObject file) - { + public FileChangeEvent(final FileObject file) { this.file = file; } /** * Returns the file that changed. + * * @return The FileObject that was changed. */ - public FileObject getFile() - { + public FileObject getFile() { return file; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContent.java similarity index 65% rename from core/src/main/java/org/apache/commons/vfs2/FileContent.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContent.java index 95ea8fc71e..39ae7c2a7e 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileContent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContent.java @@ -31,8 +31,8 @@ * To read from a file, use the {@code InputStream} returned by {@link #getInputStream()}. *

*

- * To write to a file, use the {@code OutputStream} returned by {@link #getOutputStream()} method. This will create - * the file, and the parent folder, if necessary. + * To write to a file, use the {@code OutputStream} returned by {@link #getOutputStream()} method. This will create the + * file, and the parent folder, if necessary. *

*

* A file may have multiple InputStreams open at the same time. @@ -40,10 +40,10 @@ * * @see FileObject#getContent */ -public interface FileContent extends Closeable -{ +public interface FileContent extends Closeable { /** * Returns the file which this is the content of. + * * @return The FileObject this is the content of. */ FileObject getFile(); @@ -52,8 +52,7 @@ public interface FileContent extends Closeable * Determines the size of the file, in bytes. * * @return The size of the file, in bytes. - * @throws FileSystemException If the file does not exist, or is being written to, or on error - * determining the size. + * @throws FileSystemException If the file does not exist, or is being written to, or on error determining the size. */ long getSize() throws FileSystemException; @@ -61,18 +60,17 @@ public interface FileContent extends Closeable * Determines the last-modified timestamp of the file. * * @return The last-modified timestamp. - * @throws FileSystemException If the file does not exist, or is being written to, or on error - * determining the last-modified timestamp. + * @throws FileSystemException If the file does not exist, or is being written to, or on error determining the + * last-modified timestamp. */ long getLastModifiedTime() throws FileSystemException; /** - * Sets the last-modified timestamp of the file. Creates the file if - * it does not exist. + * Sets the last-modified timestamp of the file. Creates the file if it does not exist. * * @param modTime The time to set the last-modified timestamp to. - * @throws FileSystemException If the file is read-only, or is being written to, or on error - * setting the last-modified timestamp. + * @throws FileSystemException If the file is read-only, or is being written to, or on error setting the + * last-modified timestamp. */ void setLastModifiedTime(long modTime) throws FileSystemException; @@ -81,14 +79,13 @@ public interface FileContent extends Closeable * * @param attrName The name of the attribute. * @return true if the attribute exists, false otherwise. - * @throws FileSystemException If the file does not exist, or does not support - * attributes. + * @throws FileSystemException If the file does not exist, or does not support attributes. */ - boolean hasAttribute(String attrName) - throws FileSystemException; + boolean hasAttribute(String attrName) throws FileSystemException; /** * Returns a read-only map of this file's attributes. + * * @return The attribute Map. * @throws FileSystemException If the file does not exist, or does not support attributes. */ @@ -97,7 +94,7 @@ boolean hasAttribute(String attrName) /** * Lists the attributes of the file's content. * - * @return The names of the attributes. Never returns null; + * @return The names of the attributes. Never returns null; * @throws FileSystemException If the file does not exist, or does not support attributes. */ String[] getAttributeNames() throws FileSystemException; @@ -105,40 +102,35 @@ boolean hasAttribute(String attrName) /** * Gets the value of an attribute of the file's content. * - * @param attrName The name of the attribute. Attribute names are case insensitive. - * @return The value of the attribute, or null if the attribute value is - * unknown. + * @param attrName The name of the attribute. Attribute names are case insensitive. + * @return The value of the attribute, or null if the attribute value is unknown. * @throws FileSystemException If the file does not exist, or does not support attributes. */ Object getAttribute(String attrName) throws FileSystemException; /** - * Sets the value of an attribute of the file's content. Creates the - * file if it does not exist. + * Sets the value of an attribute of the file's content. Creates the file if it does not exist. * * @param attrName The name of the attribute. - * @param value The value of the attribute. - * @throws FileSystemException If the file does not exist, or is read-only, or does not support - * attributes, or on error setting the attribute. + * @param value The value of the attribute. + * @throws FileSystemException If the file does not exist, or is read-only, or does not support attributes, or on + * error setting the attribute. */ - void setAttribute(String attrName, Object value) - throws FileSystemException; + void setAttribute(String attrName, Object value) throws FileSystemException; /** * Removes the value of an attribute of the file's content. * * @param attrName The name of the attribute. - * @throws FileSystemException If the file does not exist, or is read-only, or does not support - * attributes, or on error removing the attribute. + * @throws FileSystemException If the file does not exist, or is read-only, or does not support attributes, or on + * error removing the attribute. */ - void removeAttribute(String attrName) - throws FileSystemException; + void removeAttribute(String attrName) throws FileSystemException; /** * Retrieves the certificates if any used to sign this file or folder. * - * @return The certificates, or an empty array if there are no certificates or - * the file does not support signing. + * @return The certificates, or an empty array if there are no certificates or the file does not support signing. * @throws FileSystemException If the file does not exist, or is being written. */ Certificate[] getCertificates() throws FileSystemException; @@ -146,81 +138,67 @@ void removeAttribute(String attrName) /** * Returns an input stream for reading the file's content. *

- * There may only be a single input or output stream open for the - * file at any time. + * There may only be a single input or output stream open for the file at any time. * - * @return An input stream to read the file's content from. The input - * stream is buffered, so there is no need to wrap it in a - * {@code BufferedInputStream}. - * @throws FileSystemException If the file does not exist, or is being read, or is being written, - * or on error opening the stream. + * @return An input stream to read the file's content from. The input stream is buffered, so there is no need to + * wrap it in a {@code BufferedInputStream}. + * @throws FileSystemException If the file does not exist, or is being read, or is being written, or on error + * opening the stream. */ InputStream getInputStream() throws FileSystemException; /** * Returns an output stream for writing the file's content. *

- * If the file does not exist, this method creates it, and the parent - * folder, if necessary. If the file does exist, it is replaced with - * whatever is written to the output stream. + * If the file does not exist, this method creates it, and the parent folder, if necessary. If the file does exist, + * it is replaced with whatever is written to the output stream. *

- * There may only be a single input or output stream open for the - * file at any time. + * There may only be a single input or output stream open for the file at any time. * - * @return An output stream to write the file's content to. The stream is - * buffered, so there is no need to wrap it in a - * {@code BufferedOutputStream}. - * @throws FileSystemException If the file is read-only, or is being read, or is being written, - * or on error opening the stream. + * @return An output stream to write the file's content to. The stream is buffered, so there is no need to wrap it + * in a {@code BufferedOutputStream}. + * @throws FileSystemException If the file is read-only, or is being read, or is being written, or on error opening + * the stream. */ OutputStream getOutputStream() throws FileSystemException; /** * Returns an stream for reading/writing the file's content. *

- * If the file does not exist, and you use one of the write* methods, - * this method creates it, and the parent folder, if necessary. - * If the file does exist, parts of the file are replaced with whatever is written - * at a given position. + * If the file does not exist, and you use one of the write* methods, this method creates it, and the parent folder, + * if necessary. If the file does exist, parts of the file are replaced with whatever is written at a given + * position. *

- * There may only be a single input or output stream open for the - * file at any time. + * There may only be a single input or output stream open for the file at any time. * * @param mode The mode to use to access the file. * @return the stream for reading and writing the file's content. - * @throws FileSystemException If the file is read-only, or is being read, or is being written, - * or on error opening the stream. + * @throws FileSystemException If the file is read-only, or is being read, or is being written, or on error opening + * the stream. */ RandomAccessContent getRandomAccessContent(final RandomAccessMode mode) throws FileSystemException; /** * Returns an output stream for writing the file's content. *

- * If the file does not exist, this method creates it, and the parent - * folder, if necessary. If the file does exist, it is replaced with - * whatever is written to the output stream. + * If the file does not exist, this method creates it, and the parent folder, if necessary. If the file does exist, + * it is replaced with whatever is written to the output stream. *

- * There may only be a single input or output stream open for the - * file at any time. + * There may only be a single input or output stream open for the file at any time. * - * @param bAppend true if you would like to append to the file. - * This may not be supported by all implementations. - * @return An output stream to write the file's content to. The stream is - * buffered, so there is no need to wrap it in a - * {@code BufferedOutputStream}. - * @throws FileSystemException If the file is read-only, or is being read, or is being written, - * or bAppend is true and the implementation does not support it, - * or on error opening the stream. + * @param bAppend true if you would like to append to the file. This may not be supported by all implementations. + * @return An output stream to write the file's content to. The stream is buffered, so there is no need to wrap it + * in a {@code BufferedOutputStream}. + * @throws FileSystemException If the file is read-only, or is being read, or is being written, or bAppend is true + * and the implementation does not support it, or on error opening the stream. */ OutputStream getOutputStream(boolean bAppend) throws FileSystemException; /** - * Closes all resources used by the content, including any open stream. - * Commits pending changes to the file. + * Closes all resources used by the content, including any open stream. Commits pending changes to the file. *

- * This method is a hint to the implementation that it can release - * resources. This object can continue to be used after calling this - * method. + * This method is a hint to the implementation that it can release resources. This object can continue to be used + * after calling this method. * * @throws FileSystemException if an error occurs closing the file. */ @@ -229,6 +207,7 @@ void removeAttribute(String attrName) /** * get the content info. e.g. type, encoding, ... + * * @return the FileContentInfo * @throws FileSystemException if an error occurs. */ @@ -236,6 +215,7 @@ void removeAttribute(String attrName) /** * check if this file has open streams. + * * @return true if the file is open, false otherwise. */ boolean isOpen(); @@ -243,10 +223,8 @@ void removeAttribute(String attrName) /** * Writes this content to another FileContent. * - * @param output - * The target OutputStream. - * @throws IOException - * if an error occurs writing the content. + * @param output The target OutputStream. + * @throws IOException if an error occurs writing the content. * @return the total number of bytes written * @since 2.1 */ @@ -255,10 +233,8 @@ void removeAttribute(String attrName) /** * Writes this content to another FileObject. * - * @param file - * The target FileObject. - * @throws IOException - * if an error occurs writing the content. + * @param file The target FileObject. + * @throws IOException if an error occurs writing the content. * @return the total number of bytes written * @since 2.1 */ @@ -267,11 +243,9 @@ void removeAttribute(String attrName) /** * Writes this content to an OutputStream. * - * @param output - * The target OutputStream. + * @param output The target OutputStream. * @return the total number of bytes written - * @throws IOException - * if an error occurs writing the content. + * @throws IOException if an error occurs writing the content. * @since 2.1 */ long write(OutputStream output) throws IOException; @@ -279,13 +253,10 @@ void removeAttribute(String attrName) /** * Writes this content to an OutputStream. * - * @param output - * The target OutputStream. - * @param bufferSize - * The buffer size to write data chunks. + * @param output The target OutputStream. + * @param bufferSize The buffer size to write data chunks. * @return the total number of bytes written - * @throws IOException - * if an error occurs writing the file. + * @throws IOException if an error occurs writing the file. * @since 2.1 */ long write(OutputStream output, int bufferSize) throws IOException; diff --git a/core/src/main/java/org/apache/commons/vfs2/FileContentInfo.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContentInfo.java similarity index 97% rename from core/src/main/java/org/apache/commons/vfs2/FileContentInfo.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContentInfo.java index 052018db23..f278ed8054 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileContentInfo.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContentInfo.java @@ -19,8 +19,7 @@ /** * Informs on the content of a file with content type and encoding. */ -public interface FileContentInfo -{ +public interface FileContentInfo { /** * Gets the content encoding. * diff --git a/core/src/main/java/org/apache/commons/vfs2/FileContentInfoFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContentInfoFactory.java similarity index 82% rename from core/src/main/java/org/apache/commons/vfs2/FileContentInfoFactory.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContentInfoFactory.java index 689f2035c2..18561f2b15 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileContentInfoFactory.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileContentInfoFactory.java @@ -19,16 +19,13 @@ /** * Creates {@link FileContentInfo} instances to determine the content-info for given file contents. */ -public interface FileContentInfoFactory -{ +public interface FileContentInfoFactory { /** * Creates a FileContentInfo for a the given FileContent. * - * @param fileContent - * Use this FileContent to create a matching FileContentInfo + * @param fileContent Use this FileContent to create a matching FileContentInfo * @return a FileContentInfo for the given FileContent. - * @throws FileSystemException - * when a problem occurs creating the FileContentInfo. + * @throws FileSystemException when a problem occurs creating the FileContentInfo. */ FileContentInfo create(FileContent fileContent) throws FileSystemException; } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java similarity index 79% rename from core/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java index 364f00d3d1..2ee581d44a 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileDepthSelector.java @@ -19,8 +19,7 @@ /** * A {@link FileSelector} that selects all files in a particular depth range. */ -public class FileDepthSelector implements FileSelector -{ +public class FileDepthSelector implements FileSelector { /** * The minimum depth */ @@ -34,13 +33,10 @@ public class FileDepthSelector implements FileSelector /** * Creates a selector with the given minimum and maximum depths. * - * @param minDepth - * minimum depth - * @param maxDepth - * maximum depth + * @param minDepth minimum depth + * @param maxDepth maximum depth */ - public FileDepthSelector(final int minDepth, final int maxDepth) - { + public FileDepthSelector(final int minDepth, final int maxDepth) { this.minDepth = minDepth; this.maxDepth = maxDepth; } @@ -48,12 +44,10 @@ public FileDepthSelector(final int minDepth, final int maxDepth) /** * Creates a selector with the same minimum and maximum depths. * - * @param minMaxDepth - * minimum and maximum depth + * @param minMaxDepth minimum and maximum depth * @since 2.1 */ - public FileDepthSelector(final int minMaxDepth) - { + public FileDepthSelector(final int minMaxDepth) { this(minMaxDepth, minMaxDepth); } @@ -62,21 +56,18 @@ public FileDepthSelector(final int minMaxDepth) * * @since 2.1 */ - public FileDepthSelector() - { + public FileDepthSelector() { this(0, 0); } /** * Determines if a file or folder should be selected. * - * @param fileInfo - * The file selection information + * @param fileInfo The file selection information * @return true if the file or folder should be included, false otherwise. */ @Override - public boolean includeFile(final FileSelectInfo fileInfo) - { + public boolean includeFile(final FileSelectInfo fileInfo) { final int depth = fileInfo.getDepth(); return minDepth <= depth && depth <= maxDepth; } @@ -84,13 +75,11 @@ public boolean includeFile(final FileSelectInfo fileInfo) /** * Determines whether a folder should be traversed. * - * @param fileInfo - * The file selection information + * @param fileInfo The file selection information * @return true if the file or folder should be traversed, false otherwise. */ @Override - public boolean traverseDescendents(final FileSelectInfo fileInfo) - { + public boolean traverseDescendents(final FileSelectInfo fileInfo) { return fileInfo.getDepth() < maxDepth; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java similarity index 72% rename from core/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java index 81f3d1d288..4bd165c9b3 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java @@ -33,8 +33,7 @@ * * @since 2.1 */ -public class FileExtensionSelector implements FileSelector -{ +public class FileExtensionSelector implements FileSelector { /** * The extensions to select. @@ -44,13 +43,10 @@ public class FileExtensionSelector implements FileSelector /** * Creates a new selector for the given extensions. * - * @param extensions - * The extensions to be included by this selector. + * @param extensions The extensions to be included by this selector. */ - public FileExtensionSelector(final Collection extensions) - { - if (extensions != null) - { + public FileExtensionSelector(final Collection extensions) { + if (extensions != null) { this.extensions.addAll(extensions); } } @@ -58,13 +54,10 @@ public FileExtensionSelector(final Collection extensions) /** * Creates a new selector for the given extensions. * - * @param extensions - * The extensions to be included by this selector. + * @param extensions The extensions to be included by this selector. */ - public FileExtensionSelector(final String... extensions) - { - if (extensions != null) - { + public FileExtensionSelector(final String... extensions) { + if (extensions != null) { this.extensions.addAll(Arrays.asList(extensions)); } } @@ -72,21 +65,16 @@ public FileExtensionSelector(final String... extensions) /** * Determines if a file or folder should be selected. * - * @param fileInfo - * The file selection information. + * @param fileInfo The file selection information. * @return true if the file should be selected, false otherwise. */ @Override - public boolean includeFile(final FileSelectInfo fileInfo) - { - if (this.extensions == null) - { + public boolean includeFile(final FileSelectInfo fileInfo) { + if (this.extensions == null) { return false; } - for (final String extension : this.extensions) - { - if (fileInfo.getFile().getName().getExtension().equalsIgnoreCase(extension)) - { + for (final String extension : this.extensions) { + if (fileInfo.getFile().getName().getExtension().equalsIgnoreCase(extension)) { return true; } } @@ -96,13 +84,11 @@ public boolean includeFile(final FileSelectInfo fileInfo) /** * Determines whether a folder should be traversed. * - * @param fileInfo - * The file selection information. + * @param fileInfo The file selection information. * @return true if descendants should be traversed, fase otherwise. */ @Override - public boolean traverseDescendents(final FileSelectInfo fileInfo) - { + public boolean traverseDescendents(final FileSelectInfo fileInfo) { return true; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileFilter.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilter.java similarity index 97% rename from core/src/main/java/org/apache/commons/vfs2/FileFilter.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilter.java index 828619f3b4..a559c0ea18 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileFilter.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilter.java @@ -19,8 +19,7 @@ /** * This interface is used to select files when traversing the direct children of the base. */ -public interface FileFilter -{ +public interface FileFilter { /** * Determines if a file or folder should be selected. * diff --git a/core/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java similarity index 83% rename from core/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java index 3b65ddeab1..ffce27a099 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileFilterSelector.java @@ -23,34 +23,30 @@ *

* This is to mimic the {@link java.io.FileFilter} interface. */ -public class FileFilterSelector extends FileDepthSelector -{ +public class FileFilterSelector extends FileDepthSelector { /** * The FileFilter. */ private final FileFilter fileFilter; - public FileFilterSelector() - { + public FileFilterSelector() { this(null); } - public FileFilterSelector(final FileFilter fileFilter) - { + public FileFilterSelector(final FileFilter fileFilter) { super(1, 1); this.fileFilter = fileFilter; } /** * Determines if a file or folder should be selected. + * * @param fileInfo The file selection information. * @return true if the file or folder should be included, false otherwise. */ @Override - public boolean includeFile(final FileSelectInfo fileInfo) - { - if (!super.includeFile(fileInfo)) - { + public boolean includeFile(final FileSelectInfo fileInfo) { + if (!super.includeFile(fileInfo)) { return false; } @@ -59,13 +55,12 @@ public boolean includeFile(final FileSelectInfo fileInfo) /** * Determines whether the file should be selected. + * * @param fileInfo The file selection information. * @return true if the file should be selected, false otherwise. */ - public boolean accept(final FileSelectInfo fileInfo) - { - if (fileFilter != null) - { + public boolean accept(final FileSelectInfo fileInfo) { + if (fileFilter != null) { return fileFilter.accept(fileInfo); } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileListener.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileListener.java similarity index 98% rename from core/src/main/java/org/apache/commons/vfs2/FileListener.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileListener.java index 06c016e767..e5daa5146d 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileListener.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileListener.java @@ -19,8 +19,7 @@ /** * Listens for changes to a file. */ -public interface FileListener -{ +public interface FileListener { /** * Called when a file is created. * diff --git a/core/src/main/java/org/apache/commons/vfs2/FileMonitor.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileMonitor.java similarity index 96% rename from core/src/main/java/org/apache/commons/vfs2/FileMonitor.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileMonitor.java index 716ef274ad..07270feb5b 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileMonitor.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileMonitor.java @@ -19,16 +19,17 @@ /** * FileMonitor interface. */ -public interface FileMonitor -{ +public interface FileMonitor { /** * Adds a file to be monitored. + * * @param file The FileObject to monitor. */ void addFile(final FileObject file); /** * Removes a file from being monitored. + * * @param file The FileObject to stop monitoring. */ void removeFile(final FileObject file); diff --git a/core/src/main/java/org/apache/commons/vfs2/FileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileName.java similarity index 75% rename from core/src/main/java/org/apache/commons/vfs2/FileName.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileName.java index 6dce63f33c..9fd2912f30 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileName.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileName.java @@ -17,13 +17,11 @@ package org.apache.commons.vfs2; /** - * Represents a file name. File names are immutable, and work correctly as - * keys in hash tables. + * Represents a file name. File names are immutable, and work correctly as keys in hash tables. * * @see FileObject */ -public interface FileName extends Comparable -{ +public interface FileName extends Comparable { /** * The separator character used in file paths. */ @@ -40,44 +38,40 @@ public interface FileName extends Comparable String ROOT_PATH = "/"; /** - * Returns the base name of this file. The base name is the last element - * of the file name. For example the base name of - * {@code /somefolder/somefile} is {@code somefile}. + * Returns the base name of this file. The base name is the last element of the file name. For example the base name + * of {@code /somefolder/somefile} is {@code somefile}. *

* The root file of a file system has an empty base name. *

* - * @return The base name. Never returns null. + * @return The base name. Never returns null. */ String getBaseName(); /** - * Returns the absolute path of this file, within its file system. This - * path is normalized, so that {@code .} and {@code ..} elements - * have been removed. Also, the path only contains {@code /} as its - * separator character. The path always starts with {@code /} + * Returns the absolute path of this file, within its file system. This path is normalized, so that {@code .} and + * {@code ..} elements have been removed. Also, the path only contains {@code /} as its separator character. The + * path always starts with {@code /} *

* The root of a file system has {@code /} as its absolute path. *

* - * @return The path. Never returns null. + * @return The path. Never returns null. */ String getPath(); /** - * Returns the absolute path of this file, within its file system. This - * path is normalized, so that {@code .} and {@code ..} elements - * have been removed. Also, the path only contains {@code /} as its - * separator character. The path always starts with {@code /} + * Returns the absolute path of this file, within its file system. This path is normalized, so that {@code .} and + * {@code ..} elements have been removed. Also, the path only contains {@code /} as its separator character. The + * path always starts with {@code /} *

* The root of a file system has {@code /} as its absolute path. *

*

- * In contrast to {@link #getPath()} the path is decoded i.e. all %nn stuff - * replaced by its character. + * In contrast to {@link #getPath()} the path is decoded i.e. all %nn stuff replaced by its character. *

* - * @return The path. Never returns null. + * @return The path. Never returns null. * @throws FileSystemException if the path is not correctly encoded */ String getPathDecoded() throws FileSystemException; @@ -85,15 +79,13 @@ public interface FileName extends Comparable /** * Returns the extension of this file name. * - * @return The extension. Returns an empty string if the name has no - * extension. + * @return The extension. Returns an empty string if the name has no extension. */ String getExtension(); /** - * Returns the depth of this file name, within its file system. The depth - * of the root of a file system is 0. The depth of any other file is - * 1 + the depth of its parent. + * Returns the depth of this file name, within its file system. The depth of the root of a file system is 0. The + * depth of any other file is 1 + the depth of its parent. * * @return The depth of this file name. */ @@ -128,16 +120,14 @@ public interface FileName extends Comparable FileName getRoot(); /** - * Returns the file name of the parent of this file. The root of a - * file system has no parent. + * Returns the file name of the parent of this file. The root of a file system has no parent. * - * @return A {@link FileName} object representing the parent name. Returns - * null for the root of a file system. + * @return A {@link FileName} object representing the parent name. Returns null for the root of a file system. */ FileName getParent(); /** - * Resolves a name, relative to this file name. Equivalent to calling + * Resolves a name, relative to this file name. Equivalent to calling * {@code resolveName( path, NameScope.FILE_SYSTEM )}. * * @param name The name to resolve. @@ -147,16 +137,16 @@ public interface FileName extends Comparable // FileName resolveName(String name) throws FileSystemException; /** - * Resolves a name, relative to this file name. Refer to {@link NameScope} - * for a description of how names are resolved. + * Resolves a name, relative to this file name. Refer to {@link NameScope} for a description of how names are + * resolved. * - * @param name The name to resolve. + * @param name The name to resolve. * @param scope The scope to use when resolving the name. * @return A {@link FileName} object representing the resolved file name. * @throws FileSystemException If the name is invalid. */ // FileName resolveName(String name, NameScope scope) - // throws FileSystemException; + // throws FileSystemException; /** * Converts a file name to a relative name, relative to this file name. @@ -206,9 +196,8 @@ public interface FileName extends Comparable /** * Returns the requested or current type of this name. *

- * The "requested" type is the one determined during resolving the name. - * In this case the name is a {@link FileType#FOLDER} if it ends with an "/" else - * it will be a {@link FileType#FILE}. + * The "requested" type is the one determined during resolving the name. In this case the name is a + * {@link FileType#FOLDER} if it ends with an "/" else it will be a {@link FileType#FILE}. *

* Once attached it will be changed to reflect the real type of this resource. * diff --git a/core/src/main/java/org/apache/commons/vfs2/FileNotFolderException.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileNotFolderException.java similarity index 90% rename from core/src/main/java/org/apache/commons/vfs2/FileNotFolderException.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileNotFolderException.java index 48b806681f..a3fa00d4ef 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileNotFolderException.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileNotFolderException.java @@ -18,22 +18,20 @@ /** * Delivers a file-not-folder exception which happens when trying to issue {@link FileObject#getChildren()} on a file. + * * @since 2.0 */ -public class FileNotFolderException extends FileSystemException -{ +public class FileNotFolderException extends FileSystemException { /** * serialVersionUID format is YYYYMMDD for the date of the last binary change. */ private static final long serialVersionUID = 20101208L; - public FileNotFolderException(final Object info0) - { + public FileNotFolderException(final Object info0) { super("vfs.provider/list-children-not-folder.error", info0); } - public FileNotFolderException(final Object info0, final Throwable throwable) - { + public FileNotFolderException(final Object info0, final Throwable throwable) { super("vfs.provider/list-children-not-folder.error", info0, throwable); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileNotFoundException.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileNotFoundException.java similarity index 89% rename from core/src/main/java/org/apache/commons/vfs2/FileNotFoundException.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileNotFoundException.java index 04e5333e41..0cc6a7717e 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileNotFoundException.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileNotFoundException.java @@ -18,22 +18,20 @@ /** * delivers a file-not-found exception. + * * @since 2.0 */ -public class FileNotFoundException extends FileSystemException -{ +public class FileNotFoundException extends FileSystemException { /** * serialVersionUID format is YYYYMMDD for the date of the last binary change. */ private static final long serialVersionUID = 20101208L; - public FileNotFoundException(final Object info0) - { + public FileNotFoundException(final Object info0) { super("vfs.provider/read-not-file.error", info0); } - public FileNotFoundException(final Object info0, final Throwable throwable) - { + public FileNotFoundException(final Object info0, final Throwable throwable) { super("vfs.provider/read-not-file.error", info0, throwable); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java similarity index 63% rename from core/src/main/java/org/apache/commons/vfs2/FileObject.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java index 9c5124ff99..8eb0c350ff 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileObject.java @@ -23,16 +23,13 @@ import org.apache.commons.vfs2.operations.FileOperations; /** - * Represents a file, and is used to access the content and - * structure of the file. + * Represents a file, and is used to access the content and structure of the file. *

- * Files are arranged in a hierarchy. Each hierarchy forms a - * file system. A file system represents things like a local OS - * file system, a windows share, an HTTP server, or the contents of a Zip file. + * Files are arranged in a hierarchy. Each hierarchy forms a file system. A file system represents things like a + * local OS file system, a windows share, an HTTP server, or the contents of a Zip file. *

- * There are two types of files: Folders, which contain other files, - * and normal files, which contain data, or content. A folder may - * not have any content, and a normal file cannot contain other files. + * There are two types of files: Folders, which contain other files, and normal files, which contain data, + * or content. A folder may not have any content, and a normal file cannot contain other files. * *

File Naming

* @@ -40,22 +37,19 @@ * *

Reading and Writing a File

* - * Reading and writing a file, and all other operations on the file's - * content, is done using the {@link FileContent} object returned - * by {@link #getContent}. - + * Reading and writing a file, and all other operations on the file's content, is done using the + * {@link FileContent} object returned by {@link #getContent}. + * *

Creating and Deleting a File

* - * A file is created using either {@link #createFolder}, {@link #createFile}, - * or by writing to the file using one of the {@link FileContent} methods. + * A file is created using either {@link #createFolder}, {@link #createFile}, or by writing to the file using one of the + * {@link FileContent} methods. *

- * A file is deleted using {@link #delete}. Recursive deletion can be - * done using {@link #delete(FileSelector)}. + * A file is deleted using {@link #delete}. Recursive deletion can be done using {@link #delete(FileSelector)}. * *

Finding Files

* - * Other files in the same file system as this file can be found - * using: + * Other files in the same file system as this file can be found using: *
    *
  • {@link #findFiles} to find a set of matching descendants in in the same file system.
  • *
  • {@link #getChildren} and {@link #getChild} to find the children of this file.
  • @@ -72,15 +66,14 @@ * *

    Sorting Files

    * - * Files may be sorted using {@link java.util.Arrays#sort(Object[]) Arrays.sort()} - * and {@link java.util.Collections#sort(List) Collections.sort()}. + * Files may be sorted using {@link java.util.Arrays#sort(Object[]) Arrays.sort()} and + * {@link java.util.Collections#sort(List) Collections.sort()}. * * @see FileSystemManager * @see FileContent * @see FileName */ -public interface FileObject extends Comparable, Iterable, Closeable -{ +public interface FileObject extends Comparable, Iterable, Closeable { /** * Queries the file if it is possible to rename it to newfile. * @@ -90,9 +83,8 @@ public interface FileObject extends Comparable, Iterable boolean canRenameTo(FileObject newfile); /** - * Closes this file, and its content. This method is a hint to the - * implementation that it can release any resources associated with - * the file. + * Closes this file, and its content. This method is a hint to the implementation that it can release any resources + * associated with the file. *

    * The file object can continue to be used after this method is called. *

    @@ -106,67 +98,61 @@ public interface FileObject extends Comparable, Iterable /** * Copies another file, and all its descendants, to this file. *

    - * If this file does not exist, it is created. Its parent folder is also - * created, if necessary. If this file does exist, it is deleted first. + * If this file does not exist, it is created. Its parent folder is also created, if necessary. If this file does + * exist, it is deleted first. *

    *

    - * This method is not transactional. If it fails and throws an - * exception, this file will potentially only be partially copied. + * This method is not transactional. If it fails and throws an exception, this file will potentially only be + * partially copied. *

    * - * @param srcFile The source file to copy. + * @param srcFile The source file to copy. * @param selector The selector to use to select which files to copy. - * @throws FileSystemException If this file is read-only, or if the source file does not exist, - * or on error copying the file. + * @throws FileSystemException If this file is read-only, or if the source file does not exist, or on error copying + * the file. */ - void copyFrom(FileObject srcFile, FileSelector selector) - throws FileSystemException; + void copyFrom(FileObject srcFile, FileSelector selector) throws FileSystemException; /** - * Creates this file, if it does not exist. Also creates any ancestor - * folders which do not exist. This method does nothing if the file - * already exists and is a file. + * Creates this file, if it does not exist. Also creates any ancestor folders which do not exist. This method does + * nothing if the file already exists and is a file. * - * @throws FileSystemException If the file already exists with the wrong type, or the parent - * folder is read-only, or on error creating this file or one of - * its ancestors. + * @throws FileSystemException If the file already exists with the wrong type, or the parent folder is read-only, or + * on error creating this file or one of its ancestors. */ void createFile() throws FileSystemException; /** - * Creates this folder, if it does not exist. Also creates any ancestor - * folders which do not exist. This method does nothing if the folder - * already exists. + * Creates this folder, if it does not exist. Also creates any ancestor folders which do not exist. This method does + * nothing if the folder already exists. * - * @throws FileSystemException If the folder already exists with the wrong type, or the parent - * folder is read-only, or on error creating this folder or one of - * its ancestors. + * @throws FileSystemException If the folder already exists with the wrong type, or the parent folder is read-only, + * or on error creating this folder or one of its ancestors. */ void createFolder() throws FileSystemException; /** - * Deletes this file. Does nothing if this file does not exist of if it is a - * folder that has children. Does not delete any descendants of this file, - * use {@link #delete(FileSelector)} or {@link #deleteAll()} for that. + * Deletes this file. Does nothing if this file does not exist of if it is a folder that has children. Does not + * delete any descendants of this file, use {@link #delete(FileSelector)} or {@link #deleteAll()} for that. * * @return true if this object has been deleted - * @throws FileSystemException If this file is a non-empty folder, or if this file is read-only, - * or on error deleteing this file. + * @throws FileSystemException If this file is a non-empty folder, or if this file is read-only, or on error + * deleteing this file. */ boolean delete() throws FileSystemException; /** - * Deletes all descendants of this file that match a selector. Does - * nothing if this file does not exist. + * Deletes all descendants of this file that match a selector. Does nothing if this file does not exist. * - *

    This method is not transactional. If it fails and throws an - * exception, this file will potentially only be partially deleted. + *

    + * This method is not transactional. If it fails and throws an exception, this file will potentially only be + * partially deleted. *

    * * @param selector The selector to use to select which files to delete. * @return the number of deleted objects - * @throws FileSystemException If this file or one of its descendants is read-only, or on error - * deleting this file or one of its descendants. + * @throws FileSystemException If this file or one of its descendants is read-only, or on error deleting this file + * or one of its descendants. */ int delete(FileSelector selector) throws FileSystemException; @@ -192,52 +178,50 @@ void copyFrom(FileObject srcFile, FileSelector selector) * Finds the set of matching descendants of this file, in depthwise order. * * @param selector The selector to use to select matching files. - * @return The matching files. The files are returned in depthwise order - * (that is, a child appears in the list before its parent). + * @return The matching files. The files are returned in depthwise order (that is, a child appears in the list + * before its parent). * @throws FileSystemException if an error occurs. */ FileObject[] findFiles(FileSelector selector) throws FileSystemException; /** - * Finds the set of matching descendants of this file. - * - * @param selector the selector used to determine if the file should be selected - * @param depthwise controls the ordering in the list. e.g. deepest first - * @param selected container for selected files. list needs not to be empty. - * @throws FileSystemException if an error occurs. - */ + * Finds the set of matching descendants of this file. + * + * @param selector the selector used to determine if the file should be selected + * @param depthwise controls the ordering in the list. e.g. deepest first + * @param selected container for selected files. list needs not to be empty. + * @throws FileSystemException if an error occurs. + */ void findFiles(FileSelector selector, boolean depthwise, List selected) throws FileSystemException; /** - * Returns a child of this file. Note that this method returns {@code null} - * when the child does not exist. This differs from - * {@link #resolveFile(String, NameScope)} which never returns null. + * Returns a child of this file. Note that this method returns {@code null} when the child does not exist. This + * differs from {@link #resolveFile(String, NameScope)} which never returns null. * * @param name The name of the child. * @return The child, or null if there is no such child. - * @throws FileSystemException If this file does not exist, or is not a folder, or on error - * determining this file's children. + * @throws FileSystemException If this file does not exist, or is not a folder, or on error determining this file's + * children. */ FileObject getChild(String name) throws FileSystemException; /** * Lists the children of this file. * - * @return An array containing the children of this file. The array is - * unordered. If the file does not have any children, a zero-length - * array is returned. This method never returns null. - * @throws FileSystemException If this file does not exist, or is not a folder, or on error - * listing this file's children. + * @return An array containing the children of this file. The array is unordered. If the file does not have any + * children, a zero-length array is returned. This method never returns null. + * @throws FileSystemException If this file does not exist, or is not a folder, or on error listing this file's + * children. */ FileObject[] getChildren() throws FileSystemException; /** - * Returns this file's content. The {@link FileContent} returned by this - * method can be used to read and write the content of the file. + * Returns this file's content. The {@link FileContent} returned by this method can be used to read and write the + * content of the file. * - *

    This method can be called if the file does not exist, and - * the returned {@link FileContent} can be used to create the file - * by writing its content. + *

    + * This method can be called if the file does not exist, and the returned {@link FileContent} can be used to create + * the file by writing its content. *

    * * @return This file's content. @@ -268,15 +252,13 @@ void copyFrom(FileObject srcFile, FileSelector selector) /** * Returns the folder that contains this file. * - * @return The folder that contains this file. Returns null if this file is - * the root of a file system. + * @return The folder that contains this file. Returns null if this file is the root of a file system. * @throws FileSystemException On error finding the file's parent. */ FileObject getParent() throws FileSystemException; /** - * Returns the receiver as a URI String for public display, like, without a - * password. + * Returns the receiver as a URI String for public display, like, without a password. * * @return A URI String without a password, never {@code null}. */ @@ -285,7 +267,7 @@ void copyFrom(FileObject srcFile, FileSelector selector) /** * Returns this file's type. * - * @return One of the {@link FileType} constants. Never returns null. + * @return One of the {@link FileType} constants. Never returns null. * @throws FileSystemException On error determining the file's type. */ FileType getType() throws FileSystemException; @@ -374,11 +356,10 @@ void copyFrom(FileObject srcFile, FileSelector selector) *

    * * @param destFile the New filename. - * @throws FileSystemException If this file is read-only, or if the source file does not exist, - * or on error copying the file. + * @throws FileSystemException If this file is read-only, or if the source file does not exist, or on error copying + * the file. */ - void moveTo(FileObject destFile) - throws FileSystemException; + void moveTo(FileObject destFile) throws FileSystemException; /** * This will prepare the fileObject to get resynchronized with the underlying file system if required. @@ -388,11 +369,9 @@ void moveTo(FileObject destFile) void refresh() throws FileSystemException; /** - * Finds a file, relative to this file. Equivalent to calling - * {@code resolveFile( path, NameScope.FILE_SYSTEM )}. + * Finds a file, relative to this file. Equivalent to calling {@code resolveFile( path, NameScope.FILE_SYSTEM )}. * - * @param path The path of the file to locate. Can either be a relative - * path or an absolute path. + * @param path The path of the file to locate. Can either be a relative path or an absolute path. * @return The file. * @throws FileSystemException On error parsing the path, or on error finding the file. */ @@ -408,34 +387,26 @@ void moveTo(FileObject destFile) * @return The file. * @throws FileSystemException On error parsing the path, or on error finding the file. */ - FileObject resolveFile(String name, NameScope scope) - throws FileSystemException; + FileObject resolveFile(String name, NameScope scope) throws FileSystemException; /** * Sets the owner's (or everybody's) write permission. * - * @param executable - * True to allow read access, false to disallow. - * @param ownerOnly - * If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. + * @param executable True to allow read access, false to disallow. + * @param ownerOnly If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. * @return true if the operation succeeded. - * @throws FileSystemException - * On error determining if this file exists. + * @throws FileSystemException On error determining if this file exists. * @since 2.1 */ boolean setExecutable(boolean executable, boolean ownerOnly) throws FileSystemException; - /** * Sets the owner's (or everybody's) read permission. * - * @param readable - * True to allow read access, false to disallow - * @param ownerOnly - * If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. + * @param readable True to allow read access, false to disallow + * @param ownerOnly If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. * @return true if the operation succeeded - * @throws FileSystemException - * On error determining if this file exists. + * @throws FileSystemException On error determining if this file exists. * @since 2.1 */ boolean setReadable(boolean readable, boolean ownerOnly) throws FileSystemException; @@ -443,13 +414,10 @@ FileObject resolveFile(String name, NameScope scope) /** * Sets the owner's (or everybody's) write permission. * - * @param writable - * True to allow read access, false to disallow - * @param ownerOnly - * If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. + * @param writable True to allow read access, false to disallow + * @param ownerOnly If {@code true}, the permission applies only to the owner; otherwise, it applies to everybody. * @return true if the operation succeeded - * @throws FileSystemException - * On error determining if this file exists. + * @throws FileSystemException On error determining if this file exists. * @since 2.1 */ boolean setWritable(boolean writable, boolean ownerOnly) throws FileSystemException; diff --git a/core/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java similarity index 94% rename from core/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java index dcb6f9c0c3..9f72bc6a4d 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelectInfo.java @@ -17,27 +17,28 @@ package org.apache.commons.vfs2; /** - * Information about a file, that is used to select files during the - * traversal of a hierarchy. + * Information about a file, that is used to select files during the traversal of a hierarchy. *

    * TODO - Rename this interface, as it is used by both FileSelector and FileVisitor. */ -public interface FileSelectInfo -{ +public interface FileSelectInfo { /** * Returns the base folder of the traversal. + * * @return FileObject representing the base folder. */ FileObject getBaseFolder(); /** * Returns the file (or folder) to be considered. + * * @return The FileObject. */ FileObject getFile(); /** * Returns the depth of the file relative to the base folder. + * * @return The depth of the file relative to the base folder. */ int getDepth(); diff --git a/core/src/main/java/org/apache/commons/vfs2/FileSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelector.java similarity index 67% rename from core/src/main/java/org/apache/commons/vfs2/FileSelector.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelector.java index e6bdffc385..b6267354ce 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSelector.java @@ -21,32 +21,26 @@ * * @see Selectors */ -public interface FileSelector -{ +public interface FileSelector { /** - * Determines if a file or folder should be selected. This method is - * called in depthwise order (that is, it is called for the children - * of a folder before it is called for the folder itself). + * Determines if a file or folder should be selected. This method is called in depthwise order (that is, it is + * called for the children of a folder before it is called for the folder itself). * * @param fileInfo the file or folder to select. * @return true if the file should be selected. * @throws Exception if an error occurs. */ - boolean includeFile(FileSelectInfo fileInfo) - throws Exception; + boolean includeFile(FileSelectInfo fileInfo) throws Exception; /** - * Determines whether a folder should be traversed. If this method returns - * true, {@link #includeFile} is called for each of the children of - * the folder, and each of the child folders is recursively traversed. + * Determines whether a folder should be traversed. If this method returns true, {@link #includeFile} is called for + * each of the children of the folder, and each of the child folders is recursively traversed. *

    - * This method is called on a folder before {@link #includeFile} - * is called. + * This method is called on a folder before {@link #includeFile} is called. * * @param fileInfo the file or folder to select. * @return true if the folder should be traversed. * @throws Exception if an error occurs. */ - boolean traverseDescendents(FileSelectInfo fileInfo) - throws Exception; + boolean traverseDescendents(FileSelectInfo fileInfo) throws Exception; } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystem.java similarity index 68% rename from core/src/main/java/org/apache/commons/vfs2/FileSystem.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystem.java index 72069dd36b..62c995024c 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystem.java @@ -21,24 +21,25 @@ /** * A file system, made up of a hierarchy of files. */ -public interface FileSystem -{ +public interface FileSystem { /** * Returns the root file of this file system. + * * @return The root FileObject. * @throws FileSystemException if an error occurs. */ FileObject getRoot() throws FileSystemException; /** - * Returns the name of the root file of this file system. The root name always - * contains a path String of "/". + * Returns the name of the root file of this file system. The root name always contains a path String of "/". + * * @return the root FileName. */ FileName getRootName(); /** * The root URI passed as a file system option or obtained from the rootName. + * * @return The root URI. */ String getRootURI(); @@ -49,9 +50,8 @@ public interface FileSystem * TODO - Move this to another interface, so that set of capabilities can be queried. * * @param capability The capability to check for. - * @return true if this filesystem has the requested capability. - * Note that not all files in the file system may have the - * capability. + * @return true if this filesystem has the requested capability. Note that not all files in the file system may have + * the capability. */ boolean hasCapability(Capability capability); @@ -67,36 +67,32 @@ public interface FileSystem * Gets the value of an attribute of the file system. *

    * TODO - change to {@code Map getAttributes()} instead?
    - * TODO - define the standard attribute names, and define which attrs - * are guaranteed to be present. + * TODO - define the standard attribute names, and define which attrs are guaranteed to be present. * * @param attrName The name of the attribute. * @return The value of the attribute. - * @throws org.apache.commons.vfs2.FileSystemException - * If the file does not exist, or is being written, or if the - * attribute is unknown. + * @throws org.apache.commons.vfs2.FileSystemException If the file does not exist, or is being written, or if the + * attribute is unknown. * @see org.apache.commons.vfs2.FileContent#getAttribute */ Object getAttribute(String attrName) throws FileSystemException; /** - * Sets the value of an attribute of the file's content. Creates the - * file if it does not exist. + * Sets the value of an attribute of the file's content. Creates the file if it does not exist. * * @param attrName The name of the attribute. - * @param value The value of the attribute. - * @throws FileSystemException If the file is read-only, or is being read, or if the attribute - * is not supported, or on error setting the attribute. + * @param value The value of the attribute. + * @throws FileSystemException If the file is read-only, or is being read, or if the attribute is not supported, or + * on error setting the attribute. * @see FileContent#setAttribute */ - void setAttribute(String attrName, Object value) - throws FileSystemException; + void setAttribute(String attrName, Object value) throws FileSystemException; /** * Finds a file in this file system. * * @param name The name of the file. - * @return The file. Never returns null. + * @return The file. Never returns null. * @throws FileSystemException if an error occurs. */ FileObject resolveFile(FileName name) throws FileSystemException; @@ -104,8 +100,8 @@ void setAttribute(String attrName, Object value) /** * Finds a file in this file system. * - * @param name The name of the file. This must be an absolute path. - * @return The file. Never returns null. + * @param name The name of the file. This must be an absolute path. + * @return The file. Never returns null. * @throws FileSystemException if an error occurs. */ FileObject resolveFile(String name) throws FileSystemException; @@ -113,7 +109,7 @@ void setAttribute(String attrName, Object value) /** * Adds a listener on a file in this file system. * - * @param file The file to attach the listener to. + * @param file The file to attach the listener to. * @param listener The listener to add. */ void addListener(FileObject file, FileListener listener); @@ -121,24 +117,21 @@ void setAttribute(String attrName, Object value) /** * Removes a listener from a file in this file system. * - * @param file The file to remove the listener from. + * @param file The file to remove the listener from. * @param listener The listener to remove. */ void removeListener(FileObject file, FileListener listener); /** - * Adds a junction to this file system. A junction is a link that attaches - * the supplied file to a point in this file system, making it look like - * part of the file system. + * Adds a junction to this file system. A junction is a link that attaches the supplied file to a point in this file + * system, making it look like part of the file system. * * @param junctionPoint The point in this file system to add the junction. - * @param targetFile The file to link to. - * @throws FileSystemException If this file system does not support junctions, or the junction - * point or target file is invalid (the file system may not support - * nested junctions, for example). + * @param targetFile The file to link to. + * @throws FileSystemException If this file system does not support junctions, or the junction point or target file + * is invalid (the file system may not support nested junctions, for example). */ - void addJunction(String junctionPoint, FileObject targetFile) - throws FileSystemException; + void addJunction(String junctionPoint, FileObject targetFile) throws FileSystemException; /** * Removes a junction from this file system. @@ -149,33 +142,31 @@ void addJunction(String junctionPoint, FileObject targetFile) void removeJunction(String junctionPoint) throws FileSystemException; /** - * Creates a temporary local copy of a file and its descendants. If - * this file is already a local file, a copy is not made. + * Creates a temporary local copy of a file and its descendants. If this file is already a local file, a copy is not + * made. *

    - * Note that the local copy may include additonal files, that were - * not selected by the given selector. + * Note that the local copy may include additonal files, that were not selected by the given selector. *

    - * TODO - Add options to indicate whether the caller is happy to deal with - * extra files being present locally (eg if the file has been - * replicated previously), or whether the caller expects only - * the selected files to be present. + * TODO - Add options to indicate whether the caller is happy to deal with extra files being present locally (eg if + * the file has been replicated previously), or whether the caller expects only the selected files to be present. * - * @param file The file to replicate. + * @param file The file to replicate. * @param selector The selector to use to select the files to replicate. * @return The local copy of this file. * @throws FileSystemException If this file does not exist, or on error replicating the file. */ - File replicateFile(FileObject file, FileSelector selector) - throws FileSystemException; + File replicateFile(FileObject file, FileSelector selector) throws FileSystemException; /** * Returns the FileSystemOptions used to instantiate this filesystem. + * * @return The FileSystemOptions. */ FileSystemOptions getFileSystemOptions(); /** * Returns a reference to the FileSytemManager. + * * @return The FileSystemManager. */ FileSystemManager getFileSystemManager(); @@ -183,13 +174,11 @@ File replicateFile(FileObject file, FileSelector selector) /** * Returns the accuracy of the last modification time. *

    - * The local file provider is not very smart in figuring this out, for remote - * access to file systems the providers typically don't know the value of the underlying - * real file system. + * The local file provider is not very smart in figuring this out, for remote access to file systems the providers + * typically don't know the value of the underlying real file system. * - * @return the accuracy of the last modification time in milliseconds. A - * value of 0 means perfectly accurate, anything {@literal > 0} might be off - * by this value. For example, sftp has an accuracy of 1000 ms. + * @return the accuracy of the last modification time in milliseconds. A value of 0 means perfectly accurate, + * anything {@literal > 0} might be off by this value. For example, sftp has an accuracy of 1000 ms. */ double getLastModTimeAccuracy(); } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java similarity index 88% rename from core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java index 05966af6c8..e7a4e7a4ce 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java @@ -19,8 +19,7 @@ /** * Abstract class which has the right to fill FileSystemOptions. */ -public abstract class FileSystemConfigBuilder -{ +public abstract class FileSystemConfigBuilder { /** Default prefix to use when resolving system properties */ private static final String PREFIX = "vfs."; @@ -35,8 +34,7 @@ public abstract class FileSystemConfigBuilder * * @since 1.0 */ - protected FileSystemConfigBuilder() - { + protected FileSystemConfigBuilder() { this.prefix = PREFIX; } @@ -47,8 +45,7 @@ protected FileSystemConfigBuilder() * * @since 2.0 */ - protected FileSystemConfigBuilder(final String component) - { + protected FileSystemConfigBuilder(final String component) { this.prefix = PREFIX + component; } @@ -60,8 +57,7 @@ protected FileSystemConfigBuilder(final String component) * * @since 2.0 */ - public void setRootURI(final FileSystemOptions opts, final String rootURI) - { + public void setRootURI(final FileSystemOptions opts, final String rootURI) { setParam(opts, ROOTURI, rootURI); } @@ -73,8 +69,7 @@ public void setRootURI(final FileSystemOptions opts, final String rootURI) * * @since 2.0 */ - public String getRootURI(final FileSystemOptions opts) - { + public String getRootURI(final FileSystemOptions opts) { return getString(opts, ROOTURI); } @@ -87,8 +82,7 @@ public String getRootURI(final FileSystemOptions opts) * * @since 2.1 */ - protected void setParam(final FileSystemOptions opts, final String name, final boolean value) - { + protected void setParam(final FileSystemOptions opts, final String name, final boolean value) { setParam(opts, name, Boolean.valueOf(value)); } @@ -101,8 +95,7 @@ protected void setParam(final FileSystemOptions opts, final String name, final b * * @since 1.0 */ - protected void setParam(final FileSystemOptions opts, final String name, final Object value) - { + protected void setParam(final FileSystemOptions opts, final String name, final Object value) { opts.setOption(getConfigClass(), name, value); } @@ -115,10 +108,8 @@ protected void setParam(final FileSystemOptions opts, final String name, final O * * @since 1.0 */ - protected Object getParam(final FileSystemOptions opts, final String name) - { - if (opts == null) - { + protected Object getParam(final FileSystemOptions opts, final String name) { + if (opts == null) { return null; } @@ -134,8 +125,7 @@ protected Object getParam(final FileSystemOptions opts, final String name) * * @since 1.0 */ - protected boolean hasParam(final FileSystemOptions opts, final String name) - { + protected boolean hasParam(final FileSystemOptions opts, final String name) { return opts != null && opts.hasOption(getConfigClass(), name); } @@ -148,8 +138,7 @@ protected boolean hasParam(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected boolean hasObject(final FileSystemOptions opts, final String name) - { + protected boolean hasObject(final FileSystemOptions opts, final String name) { return hasParam(opts, name) || System.getProperties().containsKey(toPropertyKey(name)); } @@ -163,8 +152,7 @@ protected boolean hasObject(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected Boolean getBoolean(final FileSystemOptions opts, final String name) - { + protected Boolean getBoolean(final FileSystemOptions opts, final String name) { return getBoolean(opts, name, null); } @@ -179,8 +167,7 @@ protected Boolean getBoolean(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected boolean getBoolean(final FileSystemOptions opts, final String name, final boolean defaultValue) - { + protected boolean getBoolean(final FileSystemOptions opts, final String name, final boolean defaultValue) { return getBoolean(opts, name, Boolean.valueOf(defaultValue)).booleanValue(); } @@ -195,14 +182,11 @@ protected boolean getBoolean(final FileSystemOptions opts, final String name, fi * * @since 2.0 */ - protected Boolean getBoolean(final FileSystemOptions opts, final String name, final Boolean defaultValue) - { + protected Boolean getBoolean(final FileSystemOptions opts, final String name, final Boolean defaultValue) { Boolean value = (Boolean) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Boolean.valueOf(str); @@ -220,8 +204,7 @@ protected Boolean getBoolean(final FileSystemOptions opts, final String name, fi * * @since 2.0 */ - protected Byte getByte(final FileSystemOptions opts, final String name) - { + protected Byte getByte(final FileSystemOptions opts, final String name) { return getByte(opts, name, null); } @@ -236,8 +219,7 @@ protected Byte getByte(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected byte getByte(final FileSystemOptions opts, final String name, final byte defaultValue) - { + protected byte getByte(final FileSystemOptions opts, final String name, final byte defaultValue) { return getByte(opts, name, Byte.valueOf(defaultValue)).byteValue(); } @@ -251,14 +233,11 @@ protected byte getByte(final FileSystemOptions opts, final String name, final by * * @since 2.0 */ - protected Byte getByte(final FileSystemOptions opts, final String name, final Byte defaultValue) - { + protected Byte getByte(final FileSystemOptions opts, final String name, final Byte defaultValue) { Byte value = (Byte) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Byte.valueOf(str); @@ -276,8 +255,7 @@ protected Byte getByte(final FileSystemOptions opts, final String name, final By * * @since 2.0 */ - protected Character getCharacter(final FileSystemOptions opts, final String name) - { + protected Character getCharacter(final FileSystemOptions opts, final String name) { return getCharacter(opts, name, null); } @@ -292,8 +270,7 @@ protected Character getCharacter(final FileSystemOptions opts, final String name * * @since 2.0 */ - protected char getCharacter(final FileSystemOptions opts, final String name, final char defaultValue) - { + protected char getCharacter(final FileSystemOptions opts, final String name, final char defaultValue) { return getCharacter(opts, name, new Character(defaultValue)).charValue(); } @@ -307,14 +284,11 @@ protected char getCharacter(final FileSystemOptions opts, final String name, fin * * @since 2.0 */ - protected Character getCharacter(final FileSystemOptions opts, final String name, final Character defaultValue) - { + protected Character getCharacter(final FileSystemOptions opts, final String name, final Character defaultValue) { Character value = (Character) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null || str.length() <= 0) - { + if (str == null || str.length() <= 0) { return defaultValue; } value = new Character(str.charAt(0)); @@ -332,8 +306,7 @@ protected Character getCharacter(final FileSystemOptions opts, final String name * * @since 2.0 */ - protected Double getDouble(final FileSystemOptions opts, final String name) - { + protected Double getDouble(final FileSystemOptions opts, final String name) { return getDouble(opts, name, null); } @@ -348,8 +321,7 @@ protected Double getDouble(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected double getDouble(final FileSystemOptions opts, final String name, final double defaultValue) - { + protected double getDouble(final FileSystemOptions opts, final String name, final double defaultValue) { return getDouble(opts, name, new Double(defaultValue)).doubleValue(); } @@ -363,14 +335,11 @@ protected double getDouble(final FileSystemOptions opts, final String name, fina * * @since 2.0 */ - protected Double getDouble(final FileSystemOptions opts, final String name, final Double defaultValue) - { + protected Double getDouble(final FileSystemOptions opts, final String name, final Double defaultValue) { Double value = (Double) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null || str.length() <= 0) - { + if (str == null || str.length() <= 0) { return defaultValue; } value = Double.valueOf(str); @@ -384,15 +353,14 @@ protected Double getDouble(final FileSystemOptions opts, final String name, fina * @param enumeration type * @param enumClass class of enumeration type * @param opts file system options to work with - * @param name the option name * + * @param name the option name * * @return the option in {@code opts} or system properties, otherwise null * @see #getEnum(Class, FileSystemOptions, String, Enum) * @throws IllegalArgumentException if option value is not a known enumeration. * * @since 2.1 */ - protected > E getEnum(final Class enumClass, final FileSystemOptions opts, final String name) - { + protected > E getEnum(final Class enumClass, final FileSystemOptions opts, final String name) { return this.getEnum(enumClass, opts, name, null); } @@ -410,16 +378,13 @@ protected > E getEnum(final Class enumClass, final FileSyst * * @since 2.1 */ - protected > E getEnum(final Class enumClass, final FileSystemOptions opts, - final String name, final E defaultValue) - { + protected > E getEnum(final Class enumClass, final FileSystemOptions opts, final String name, + final E defaultValue) { @SuppressWarnings("unchecked") E value = (E) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Enum.valueOf(enumClass, str); @@ -438,8 +403,7 @@ protected > E getEnum(final Class enumClass, final FileSyst * * @since 2.0 */ - protected Float getFloat(final FileSystemOptions opts, final String name) - { + protected Float getFloat(final FileSystemOptions opts, final String name) { return getFloat(opts, name, null); } @@ -455,8 +419,7 @@ protected Float getFloat(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected float getFloat(final FileSystemOptions opts, final String name, final float defaultValue) - { + protected float getFloat(final FileSystemOptions opts, final String name, final float defaultValue) { return getFloat(opts, name, new Float(defaultValue)).floatValue(); } @@ -471,14 +434,11 @@ protected float getFloat(final FileSystemOptions opts, final String name, final * * @since 2.0 */ - protected Float getFloat(final FileSystemOptions opts, final String name, final Float defaultValue) - { + protected Float getFloat(final FileSystemOptions opts, final String name, final Float defaultValue) { Float value = (Float) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null || str.length() <= 0) - { + if (str == null || str.length() <= 0) { return defaultValue; } value = Float.valueOf(str); @@ -497,8 +457,7 @@ protected Float getFloat(final FileSystemOptions opts, final String name, final * * @since 2.0 */ - protected Integer getInteger(final FileSystemOptions opts, final String name) - { + protected Integer getInteger(final FileSystemOptions opts, final String name) { return getInteger(opts, name, null); } @@ -514,8 +473,7 @@ protected Integer getInteger(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected int getInteger(final FileSystemOptions opts, final String name, final int defaultValue) - { + protected int getInteger(final FileSystemOptions opts, final String name, final int defaultValue) { return getInteger(opts, name, Integer.valueOf(defaultValue)).intValue(); } @@ -530,14 +488,11 @@ protected int getInteger(final FileSystemOptions opts, final String name, final * * @since 2.0 */ - protected Integer getInteger(final FileSystemOptions opts, final String name, final Integer defaultValue) - { + protected Integer getInteger(final FileSystemOptions opts, final String name, final Integer defaultValue) { Integer value = (Integer) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Integer.valueOf(str); @@ -556,8 +511,7 @@ protected Integer getInteger(final FileSystemOptions opts, final String name, fi * * @since 2.0 */ - protected Long getLong(final FileSystemOptions opts, final String name) - { + protected Long getLong(final FileSystemOptions opts, final String name) { return getLong(opts, name, null); } @@ -573,8 +527,7 @@ protected Long getLong(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected long getLong(final FileSystemOptions opts, final String name, final long defaultValue) - { + protected long getLong(final FileSystemOptions opts, final String name, final long defaultValue) { return getLong(opts, name, Long.valueOf(defaultValue)).longValue(); } @@ -589,14 +542,11 @@ protected long getLong(final FileSystemOptions opts, final String name, final lo * * @since 2.0 */ - protected Long getLong(final FileSystemOptions opts, final String name, final Long defaultValue) - { + protected Long getLong(final FileSystemOptions opts, final String name, final Long defaultValue) { Long value = (Long) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Long.valueOf(str); @@ -615,8 +565,7 @@ protected Long getLong(final FileSystemOptions opts, final String name, final Lo * * @since 2.0 */ - protected Short getShort(final FileSystemOptions opts, final String name) - { + protected Short getShort(final FileSystemOptions opts, final String name) { return getShort(opts, name, null); } @@ -632,8 +581,7 @@ protected Short getShort(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected short getShort(final FileSystemOptions opts, final String name, final short defaultValue) - { + protected short getShort(final FileSystemOptions opts, final String name, final short defaultValue) { return getShort(opts, name, Short.valueOf(defaultValue)).shortValue(); } @@ -648,14 +596,11 @@ protected short getShort(final FileSystemOptions opts, final String name, final * * @since 2.0 */ - protected Short getShort(final FileSystemOptions opts, final String name, final Short defaultValue) - { + protected Short getShort(final FileSystemOptions opts, final String name, final Short defaultValue) { Short value = (Short) getParam(opts, name); - if (value == null) - { + if (value == null) { final String str = getProperty(name); - if (str == null) - { + if (str == null) { return defaultValue; } value = Short.valueOf(str); @@ -673,8 +618,7 @@ protected Short getShort(final FileSystemOptions opts, final String name, final * * @since 2.0 */ - protected String getString(final FileSystemOptions opts, final String name) - { + protected String getString(final FileSystemOptions opts, final String name) { return getString(opts, name, null); } @@ -688,14 +632,11 @@ protected String getString(final FileSystemOptions opts, final String name) * * @since 2.0 */ - protected String getString(final FileSystemOptions opts, final String name, final String defaultValue) - { + protected String getString(final FileSystemOptions opts, final String name, final String defaultValue) { String value = (String) getParam(opts, name); - if (value == null) - { + if (value == null) { value = getProperty(name); - if (value == null) - { + if (value == null) { return defaultValue; } } @@ -719,8 +660,7 @@ protected String getString(final FileSystemOptions opts, final String name, fina * * @since 2.1 */ - private String toPropertyKey(final String name) - { + private String toPropertyKey(final String name) { return this.prefix + name; } @@ -732,8 +672,7 @@ private String toPropertyKey(final String name) * * @since 2.1 */ - private String getProperty(final String name) - { + private String getProperty(final String name) { return System.getProperty(toPropertyKey(name)); } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileSystemException.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java similarity index 70% rename from core/src/main/java/org/apache/commons/vfs2/FileSystemException.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java index b1ee6f11ea..f90b408579 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileSystemException.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemException.java @@ -25,9 +25,7 @@ /** * Thrown for file system errors. */ -public class FileSystemException - extends IOException -{ +public class FileSystemException extends IOException { /** * serialVersionUID format is YYYYMMDD for the date of the last binary change. */ @@ -49,34 +47,29 @@ public class FileSystemException * * @param code the error code of the message. */ - public FileSystemException(final String code) - { + public FileSystemException(final String code) { this(code, null, (Object[]) null); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. + * @param code the error code of the message. * @param info0 one context information. */ - public FileSystemException(final String code, final Object info0) - { - this(code, null, new Object[]{info0}); + public FileSystemException(final String code, final Object info0) { + this(code, null, new Object[] { info0 }); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. - * @param info0 one context information. + * @param code the error code of the message. + * @param info0 one context information. * @param throwable the cause. */ - public FileSystemException(final String code, - final Object info0, - final Throwable throwable) - { - this(code, throwable, new Object[]{info0}); + public FileSystemException(final String code, final Object info0, final Throwable throwable) { + this(code, throwable, new Object[] { info0 }); } /** @@ -85,8 +78,7 @@ public FileSystemException(final String code, * @param code the error code of the message. * @param info array of complementary info (context). */ - public FileSystemException(final String code, final Object... info) - { + public FileSystemException(final String code, final Object... info) { this(code, null, info); } @@ -96,54 +88,42 @@ public FileSystemException(final String code, final Object... info) * @param code the error code of the message. * @param throwable the original cause */ - public FileSystemException(final String code, final Throwable throwable) - { + public FileSystemException(final String code, final Throwable throwable) { this(code, throwable, (Object[]) null); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. - * @param info array of complementary info (context). + * @param code the error code of the message. + * @param info array of complementary info (context). * @param throwable the cause. * @deprecated Use instead {@link #FileSystemException(String, Throwable, Object[])}. Will be removed in 3.0. */ @Deprecated - public FileSystemException(final String code, - final Object[] info, - final Throwable throwable) - { + public FileSystemException(final String code, final Object[] info, final Throwable throwable) { this(code, throwable, info); } /** * Constructs exception with the specified detail message. * - * @param code the error code of the message. - * @param info array of complementary info (context). + * @param code the error code of the message. + * @param info array of complementary info (context). * @param throwable the cause. */ - public FileSystemException(final String code, - final Throwable throwable, - final Object... info) - { + public FileSystemException(final String code, final Throwable throwable, final Object... info) { super(code, throwable); - if (info == null) - { + if (info == null) { this.info = new String[0]; - } - else - { + } else { this.info = new String[info.length]; - for (int i = 0; i < info.length; i++) - { + for (int i = 0; i < info.length; i++) { String value = String.valueOf(info[i]); // mask passwords (VFS-169) final Matcher urlMatcher = URL_PATTERN.matcher(value); - if (urlMatcher.find()) - { + if (urlMatcher.find()) { final Matcher pwdMatcher = PASSWORD_PATTERN.matcher(value); value = pwdMatcher.replaceFirst(":***@"); } @@ -157,40 +137,35 @@ public FileSystemException(final String code, * * @param throwable the root cause to wrap. */ - public FileSystemException(final Throwable throwable) - { + public FileSystemException(final Throwable throwable) { this(throwable.getMessage(), throwable, (Object[]) null); } /** * Retrieves message from bundle. + * * @return The exception message. */ @Override - public String getMessage() - { + public String getMessage() { return Messages.getString(super.getMessage(), (Object[]) getInfo()); } /** - * Retrieves error code of the exception. - * Could be used as key for internationalization. + * Retrieves error code of the exception. Could be used as key for internationalization. * * @return the code. */ - public String getCode() - { + public String getCode() { return super.getMessage(); } /** - * Retrieves array of complementary info (context). - * Could be used as parameter for internationalization. + * Retrieves array of complementary info (context). Could be used as parameter for internationalization. * * @return the context info. */ - public String[] getInfo() - { + public String[] getInfo() { return info; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileSystemManager.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java similarity index 68% rename from core/src/main/java/org/apache/commons/vfs2/FileSystemManager.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java index fa15b70533..8cc0e4b51d 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileSystemManager.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemManager.java @@ -27,37 +27,28 @@ import org.apache.commons.vfs2.operations.FileOperationProvider; /** - * A FileSystemManager manages a set of file systems. This interface is - * used to locate a {@link FileObject} by name from one of those file systems. + * A FileSystemManager manages a set of file systems. This interface is used to locate a {@link FileObject} by name from + * one of those file systems. *

    - * To locate a {@link FileObject}, use one of the {@code resolveFile()} - * methods. + * To locate a {@link FileObject}, use one of the {@code resolveFile()} methods. * *

    File Naming

    * * A file system manager can recognise several types of file names: *
      - *
    • Absolute URI. These must start with a scheme, such as - * {@code file:} or {@code ftp:}, followed by a scheme dependent - * file name. Some examples: {@code file:/c:/somefile} or - * {@code ftp://somewhere.org/somefile}.
    • - *
    • Absolute local file name. For example, - * {@code /home/someuser/a-file} or {@code c:\dir\somefile.html}. - * Elements in the name can be separated using any of the following - * characters: {@code /}, {@code \}, or the native file separator - * character. For example, the following file names are the same: - * {@code c:\somedir\somefile.xml} and {@code c:/somedir/somefile.xml}.
    • - *
    • Relative path. For example: {@code ../somefile} or - * {@code somedir/file.txt}. The file system manager resolves relative - * paths against its base file. Elements in the relative path can be - * separated using {@code /}, {@code \}, or file system specific - * separator characters. Relative paths may also contain {@code ..} and - * {@code .} elements. See {@link FileObject#resolveFile} for more - * details.
    • + *
    • Absolute URI. These must start with a scheme, such as {@code file:} or {@code ftp:}, followed by a scheme + * dependent file name. Some examples: {@code file:/c:/somefile} or {@code ftp://somewhere.org/somefile}.
    • + *
    • Absolute local file name. For example, {@code /home/someuser/a-file} or {@code c:\dir\somefile.html}. Elements in + * the name can be separated using any of the following characters: {@code /}, {@code \}, or the native file separator + * character. For example, the following file names are the same: {@code c:\somedir\somefile.xml} and + * {@code c:/somedir/somefile.xml}.
    • + *
    • Relative path. For example: {@code ../somefile} or {@code somedir/file.txt}. The file system manager resolves + * relative paths against its base file. Elements in the relative path can be separated using {@code /}, + * {@code \}, or file system specific separator characters. Relative paths may also contain {@code ..} and {@code .} + * elements. See {@link FileObject#resolveFile} for more details.
    • *
    */ -public interface FileSystemManager -{ +public interface FileSystemManager { /** * Returns the base file used to resolve relative paths. * @@ -67,59 +58,51 @@ public interface FileSystemManager FileObject getBaseFile() throws FileSystemException; /** - * Locates a file by name. Equivalent to calling - * {@code resolveFile(getBaseFile(), name)}. + * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. * * @param name The name of the file. - * @return The file. Never returns null. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ FileObject resolveFile(String name) throws FileSystemException; /** - * Locates a file by name. Equivalent to calling - * {@code resolveFile(getBaseFile(), name)}. - * - * @param name The name of the file. - * @param fileSystemOptions The FileSystemOptions used for FileSystem creation. - * All files that are later resolved relative to the - * returned {@code FileObject} share the options. - * @return The file. Never returns null. + * Locates a file by name. Equivalent to calling {@code resolveFile(getBaseFile(), name)}. + * + * @param name The name of the file. + * @param fileSystemOptions The FileSystemOptions used for FileSystem creation. All files that are later resolved + * relative to the returned {@code FileObject} share the options. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ - FileObject resolveFile(String name, FileSystemOptions fileSystemOptions) - throws FileSystemException; + FileObject resolveFile(String name, FileSystemOptions fileSystemOptions) throws FileSystemException; /** - * Locates a file by name. The name is resolved as described - * above. That is, the name can be either - * an absolute URI, an absolute file name, or a relative path to - * be resolved against {@code baseFile}. + * Locates a file by name. The name is resolved as described above. That is, the name can be + * either an absolute URI, an absolute file name, or a relative path to be resolved against {@code baseFile}. *

    * Note that the file does not have to exist when this method is called. * - * @param baseFile The base file to use to resolve relative paths. - * May be null if the name is an absolute file name. - * @param name The name of the file. - * @return The file. Never returns null. + * @param baseFile The base file to use to resolve relative paths. May be null if the name is an absolute file name. + * @param name The name of the file. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ FileObject resolveFile(FileObject baseFile, String name) throws FileSystemException; /** - * Locates a file by name. See {@link #resolveFile(FileObject, String)} - * for details. + * Locates a file by name. See {@link #resolveFile(FileObject, String)} for details. * - * @param baseFile The base file to use to resolve relative paths. - * Must not be {@code null}, not even if the name is absolute. - * @param name The name of the file. - * @return The file. Never returns null. + * @param baseFile The base file to use to resolve relative paths. Must not be {@code null}, not even if the + * name is absolute. + * @param name The name of the file. + * @return The file. Never returns null. * @throws FileSystemException On error parsing the file name. */ FileObject resolveFile(File baseFile, String name) throws FileSystemException; /** - * Resolves a name, relative to this file name. Equivalent to calling + * Resolves a name, relative to this file name. Equivalent to calling * {@code resolveName( path, NameScope.FILE_SYSTEM )}. * * @param root the base filename @@ -130,40 +113,37 @@ FileObject resolveFile(String name, FileSystemOptions fileSystemOptions) FileName resolveName(FileName root, String name) throws FileSystemException; /** - * Resolves a name, relative to the "root" file name. Refer to {@link NameScope} - * for a description of how names are resolved. + * Resolves a name, relative to the "root" file name. Refer to {@link NameScope} for a description of how names are + * resolved. * * @param root the base filename - * @param name The name to resolve. + * @param name The name to resolve. * @param scope The {@link NameScope} to use when resolving the name. * @return A {@link FileName} object representing the resolved file name. * @throws FileSystemException If the name is invalid. */ - FileName resolveName(FileName root, String name, NameScope scope) - throws FileSystemException; + FileName resolveName(FileName root, String name, NameScope scope) throws FileSystemException; /** * Converts a local file into a {@link FileObject}. * * @param file The file to convert. - * @return The {@link FileObject} that represents the local file. Never - * returns null. + * @return The {@link FileObject} that represents the local file. Never returns null. * @throws FileSystemException On error converting the file. */ FileObject toFileObject(File file) throws FileSystemException; /** - * Creates a layered file system. A layered file system is a file system - * that is created from the contents of a file, such as a zip or tar file. + * Creates a layered file system. A layered file system is a file system that is created from the contents of a + * file, such as a zip or tar file. * - * @param provider The name of the file system provider to use. This name - * is the same as the scheme used in URI to identify the provider. - * @param file The file to use to create the file system. + * @param provider The name of the file system provider to use. This name is the same as the scheme used in URI to + * identify the provider. + * @param file The file to use to create the file system. * @return The root file of the new file system. * @throws FileSystemException On error creating the file system. */ - FileObject createFileSystem(String provider, FileObject file) - throws FileSystemException; + FileObject createFileSystem(String provider, FileObject file) throws FileSystemException; /** * Closes the given filesystem. @@ -175,8 +155,8 @@ FileObject createFileSystem(String provider, FileObject file) void closeFileSystem(FileSystem filesystem); /** - * Creates a layered file system. A layered file system is a file system - * that is created from the contents of a file, such as a zip or tar file. + * Creates a layered file system. A layered file system is a file system that is created from the contents of a + * file, such as a zip or tar file. * * @param file The file to use to create the file system. * @return The root file of the new file system. @@ -185,18 +165,16 @@ FileObject createFileSystem(String provider, FileObject file) FileObject createFileSystem(FileObject file) throws FileSystemException; /** - * Creates an empty virtual file system. Can be populated by adding - * junctions to it. + * Creates an empty virtual file system. Can be populated by adding junctions to it. * - * @param rootUri The root URI to use for the new file system. Can be null. + * @param rootUri The root URI to use for the new file system. Can be null. * @return The root file of the new file system. * @throws FileSystemException if an error occurs creating the VirtualFileSystem. */ FileObject createVirtualFileSystem(String rootUri) throws FileSystemException; /** - * Creates a virtual file system. The file system will contain a junction - * at the fs root to the supplied root file. + * Creates a virtual file system. The file system will contain a junction at the fs root to the supplied root file. * * @param rootFile The root file to backs the file system. * @return The root of the new file system. @@ -205,8 +183,7 @@ FileObject createFileSystem(String provider, FileObject file) FileObject createVirtualFileSystem(FileObject rootFile) throws FileSystemException; /** - * Returns a streamhandler factory to enable URL lookup using this - * FileSystemManager. + * Returns a stream handler factory to enable URL lookup using this FileSystemManager. * * @return the URLStreamHandlerFactory. */ @@ -222,7 +199,7 @@ FileObject createFileSystem(String provider, FileObject file) boolean canCreateFileSystem(FileObject file) throws FileSystemException; /** - * Get the cache used to cache fileobjects. + * Get the cache used to cache file objects. * * @return The FilesCache. */ @@ -243,8 +220,7 @@ FileObject createFileSystem(String provider, FileObject file) Class getFileObjectDecorator(); /** - * The constructor associated to the fileObjectDecorator. - * We cache it here for performance reasons. + * The constructor associated to the fileObjectDecorator. We cache it here for performance reasons. * * @return the Constructor associated with the FileObjectDecorator. */ @@ -310,16 +286,14 @@ FileObject createFileSystem(String provider, FileObject file) /** * Adds the specified FileOperationProvider for the specified scheme. *

    - * Several FileOperationProvider's might be registered for the same scheme. - * For example, for {@code "file"} scheme we can register {@code SvnWsOperationProvider} and - * {@code CvsOperationProvider.} + * Several FileOperationProvider's might be registered for the same scheme. For example, for {@code "file"} scheme + * we can register {@code SvnWsOperationProvider} and {@code CvsOperationProvider.} * * @param scheme The scheme assoicated with this provider. * @param operationProvider The FileOperationProvider to add. * @throws FileSystemException if an error occurs. */ - void addOperationProvider(String scheme, FileOperationProvider operationProvider) - throws FileSystemException; + void addOperationProvider(String scheme, FileOperationProvider operationProvider) throws FileSystemException; /** * @see FileSystemManager#addOperationProvider(String, org.apache.commons.vfs2.operations.FileOperationProvider) @@ -328,17 +302,15 @@ void addOperationProvider(String scheme, FileOperationProvider operationProvider * @param operationProvider The FileOperationProvider to add. * @throws FileSystemException if an error occurs. */ - void addOperationProvider(String[] schemes, FileOperationProvider operationProvider) - throws FileSystemException; - + void addOperationProvider(String[] schemes, FileOperationProvider operationProvider) throws FileSystemException; /** * Get Providers for file operations. * * @param scheme the scheme for wich we want to get the list af registered providers. * - * @return the registered FileOperationProviders for the specified scheme. - * If there were no providers registered for the scheme, it returns null. + * @return the registered FileOperationProviders for the specified scheme. If there were no providers registered for + * the scheme, it returns null. * * @throws FileSystemException if an error occurs. */ @@ -348,8 +320,7 @@ void addOperationProvider(String[] schemes, FileOperationProvider operationProvi * Resolves a URI into a {@link FileObject}. * * @param uri The URI to convert. - * @return The {@link FileObject} that represents the URI. Never - * returns null. + * @return The {@link FileObject} that represents the URI. Never returns null. * @throws FileSystemException On error converting the file. * @since 2.1 */ @@ -359,8 +330,7 @@ void addOperationProvider(String[] schemes, FileOperationProvider operationProvi * Resolves a URL into a {@link FileObject}. * * @param url The URL to convert. - * @return The {@link FileObject} that represents the URL. Never - * returns null. + * @return The {@link FileObject} that represents the URL. Never returns null. * @throws FileSystemException On error converting the file. * @since 2.1 */ diff --git a/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java similarity index 76% rename from core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java index 84ec534e74..6fec1bab27 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java @@ -42,29 +42,25 @@ * @see org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder * */ -public final class FileSystemOptions implements Cloneable -{ +public final class FileSystemOptions implements Cloneable { /** The options */ private final Map options; /** * Creates a new instance. */ - public FileSystemOptions() - { + public FileSystemOptions() { this(new TreeMap()); } - protected FileSystemOptions(final Map options) - { + protected FileSystemOptions(final Map options) { this.options = options; } /** * Keys in the options Map. */ - private static final class FileSystemOptionKey implements Comparable - { + private static final class FileSystemOptionKey implements Comparable { /** Constant used to create hashcode */ private static final int HASH = 29; @@ -76,43 +72,35 @@ private static final class FileSystemOptionKey implements Comparable fileSystemClass, final String name) - { + private FileSystemOptionKey(final Class fileSystemClass, final String name) { this.fileSystemClass = fileSystemClass; this.name = name; } @Override - public int compareTo(final FileSystemOptionKey o) - { + public int compareTo(final FileSystemOptionKey o) { final int ret = fileSystemClass.getName().compareTo(o.fileSystemClass.getName()); - if (ret != 0) - { + if (ret != 0) { return ret; } return name.compareTo(o.name); } @Override - public boolean equals(final Object o) - { - if (this == o) - { + public boolean equals(final Object o) { + if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) - { + if (o == null || getClass() != o.getClass()) { return false; } final FileSystemOptionKey that = (FileSystemOptionKey) o; - if (!fileSystemClass.equals(that.fileSystemClass)) - { + if (!fileSystemClass.equals(that.fileSystemClass)) { return false; } - if (!name.equals(that.name)) - { + if (!name.equals(that.name)) { return false; } @@ -120,8 +108,7 @@ public boolean equals(final Object o) } @Override - public int hashCode() - { + public int hashCode() { int result; result = fileSystemClass.hashCode(); result = HASH * result + name.hashCode(); @@ -129,80 +116,67 @@ public int hashCode() } @Override - public String toString() - { - return fileSystemClass.getName()+"."+name; + public String toString() { + return fileSystemClass.getName() + "." + name; } } - void setOption(final Class fileSystemClass, final String name, final Object value) - { + void setOption(final Class fileSystemClass, final String name, final Object value) { options.put(new FileSystemOptionKey(fileSystemClass, name), value); } - Object getOption(final Class fileSystemClass, final String name) - { + Object getOption(final Class fileSystemClass, final String name) { final FileSystemOptionKey key = new FileSystemOptionKey(fileSystemClass, name); return options.get(key); } - boolean hasOption(final Class fileSystemClass, final String name) - { + boolean hasOption(final Class fileSystemClass, final String name) { final FileSystemOptionKey key = new FileSystemOptionKey(fileSystemClass, name); return options.containsKey(key); } - public int compareTo(final FileSystemOptions other) - { - if (this == other) - { + public int compareTo(final FileSystemOptions other) { + if (this == other) { // the same instance return 0; } final int propsSz = options == null ? 0 : options.size(); final int propsFkSz = other.options == null ? 0 : other.options.size(); - if (propsSz < propsFkSz) - { + if (propsSz < propsFkSz) { return -1; } - if (propsSz > propsFkSz) - { + if (propsSz > propsFkSz) { return 1; } - if (propsSz == 0) - { + if (propsSz == 0) { // props empty return 0; } // ensure proper sequence of options - final SortedMap myOptions = - options instanceof SortedMap - ? (SortedMap)options - : new TreeMap<>(options); - final SortedMap theirOptions = - other.options instanceof SortedMap - ? (SortedMap)other.options - : new TreeMap<>(other.options); + final SortedMap myOptions = options instanceof SortedMap + ? (SortedMap) options + : new TreeMap<>(options); + final SortedMap theirOptions = other.options instanceof SortedMap + ? (SortedMap) other.options + : new TreeMap<>(other.options); final Iterator optKeysIter = myOptions.keySet().iterator(); final Iterator otherKeysIter = theirOptions.keySet().iterator(); - while(optKeysIter.hasNext()) { - int comp = optKeysIter.next().compareTo(otherKeysIter.next()); + while (optKeysIter.hasNext()) { + final int comp = optKeysIter.next().compareTo(otherKeysIter.next()); if (comp != 0) { return comp; } } - Object[] array = new Object[propsSz]; + final Object[] array = new Object[propsSz]; final int hash = Arrays.deepHashCode(myOptions.values().toArray(array)); final int hashFk = Arrays.deepHashCode(theirOptions.values().toArray(array)); - if (hash < hashFk) - { + if (hash < hashFk) { return -1; } - if (hash > hashFk) - { + if (hash > hashFk) { return 1; } @@ -211,17 +185,15 @@ public int compareTo(final FileSystemOptions other) } @Override - public int hashCode() - { + public int hashCode() { final int prime = 31; int result = 1; if (options == null) { result = prime * result; } else { - final SortedMap myOptions = - options instanceof SortedMap - ? (SortedMap)options - : new TreeMap<>(options); + final SortedMap myOptions = options instanceof SortedMap + ? (SortedMap) options + : new TreeMap<>(options); result = prime * result + myOptions.keySet().hashCode(); result = prime * result + Arrays.deepHashCode(myOptions.values().toArray(new Object[options.size()])); } @@ -229,8 +201,7 @@ public int hashCode() } @Override - public boolean equals(Object obj) - { + public boolean equals(final Object obj) { if (this == obj) { return true; } @@ -240,25 +211,22 @@ public boolean equals(Object obj) if (getClass() != obj.getClass()) { return false; } - FileSystemOptions other = (FileSystemOptions)obj; + final FileSystemOptions other = (FileSystemOptions) obj; return compareTo(other) == 0; } - /** * {@inheritDoc} * * @since 2.0 */ @Override - public Object clone() - { + public Object clone() { return new FileSystemOptions(new TreeMap<>(options)); } @Override - public String toString() - { + public String toString() { return options.toString(); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileType.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileType.java similarity index 74% rename from core/src/main/java/org/apache/commons/vfs2/FileType.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileType.java index 922d23e48a..45373cf467 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileType.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileType.java @@ -19,29 +19,24 @@ /** * An enumerated type that represents a file's type. */ -public enum FileType -{ +public enum FileType { /** - * A folder. May contain other files, and have attributes, but does not - * have any data content. + * A folder. May contain other files, and have attributes, but does not have any data content. */ FOLDER("folder", true, false, true), /** - * A regular file. May have data content and attributes, but cannot - * contain other files. + * A regular file. May have data content and attributes, but cannot contain other files. */ FILE("file", false, true, true), /** - * A file or folder. May have data content and attributes, and can - * contain other files. + * A file or folder. May have data content and attributes, and can contain other files. */ FILE_OR_FOLDER("fileOrFolder", true, true, true), /** - * A file that does not exist. May not have data content, attributes, - * or contain other files. + * A file that does not exist. May not have data content, attributes, or contain other files. */ IMAGINARY("imaginary", false, false, false); @@ -57,11 +52,7 @@ public enum FileType /** true if the FileType has attributes */ private final boolean hasAttrs; - private FileType(final String name, - final boolean hasChildren, - final boolean hasContent, - final boolean hasAttrs) - { + private FileType(final String name, final boolean hasChildren, final boolean hasContent, final boolean hasAttrs) { this.name = name; this.hasChildren = hasChildren; this.hasContent = hasContent; @@ -70,47 +61,47 @@ private FileType(final String name, /** * Returns the name of this type. + * * @return The name of this type. */ @Override - public String toString() - { + public String toString() { return name; } /** * Returns the name of this type. + * * @return The name of the type. */ - public String getName() - { + public String getName() { return name; } /** * Returns true if files of this type may contain other files. + * * @return true if files can contain other files. */ - public boolean hasChildren() - { + public boolean hasChildren() { return hasChildren; } /** * Returns true if files of this type may have data content. + * * @return true if files can have content. */ - public boolean hasContent() - { + public boolean hasContent() { return hasContent; } /** * Returns true if files of this type may have attributes. + * * @return true if files can have attributes */ - public boolean hasAttributes() - { + public boolean hasAttributes() { return hasAttrs; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java similarity index 93% rename from core/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java index d4bcba492e..b185fbdd12 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeHasNoContentException.java @@ -19,22 +19,20 @@ /** * delivers a file-not-folder exception which happens when trying to issue * {@link org.apache.commons.vfs2.FileObject#getChildren()} on a file. + * * @since 2.0 */ -public class FileTypeHasNoContentException extends FileSystemException -{ +public class FileTypeHasNoContentException extends FileSystemException { /** * serialVersionUID format is YYYYMMDD for the date of the last binary change. */ private static final long serialVersionUID = 20101208L; - public FileTypeHasNoContentException(final Object info0) - { + public FileTypeHasNoContentException(final Object info0) { super("vfs.provider/read-not-file.error", info0); } - public FileTypeHasNoContentException(final Object info0, final Throwable throwable) - { + public FileTypeHasNoContentException(final Object info0, final Throwable throwable) { super("vfs.provider/read-not-file.error", info0, throwable); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java similarity index 85% rename from core/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java index 25585899a4..dd74ca4285 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java @@ -19,44 +19,39 @@ /** * A {@link FileSelector} that selects files of a particular type. */ -public class FileTypeSelector - implements FileSelector -{ +public class FileTypeSelector implements FileSelector { /** The FileType */ private final FileType type; /** * Creates a new selector for the given file type. * - * @param type - * The file type to select + * @param type The file type to select */ - public FileTypeSelector(final FileType type) - { + public FileTypeSelector(final FileType type) { this.type = type; } /** * Determines if a file or folder should be selected. + * * @param fileInfo The file selection information. * @return true if the file or folder should be selected. * @throws FileSystemException if an error occurs */ @Override - public boolean includeFile(final FileSelectInfo fileInfo) - throws FileSystemException - { + public boolean includeFile(final FileSelectInfo fileInfo) throws FileSystemException { return fileInfo.getFile().getType() == type; } /** * Determines whether a folder should be traversed. + * * @param fileInfo The file selection information. * @return true if the file or folder should be traversed. */ @Override - public boolean traverseDescendents(final FileSelectInfo fileInfo) - { + public boolean traverseDescendents(final FileSelectInfo fileInfo) { return true; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/FileUtil.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java similarity index 81% rename from core/src/main/java/org/apache/commons/vfs2/FileUtil.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java index 5b38745e78..d0aa50cb31 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FileUtil.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java @@ -23,11 +23,9 @@ /** * Utility methods for dealing with FileObjects. */ -public final class FileUtil -{ +public final class FileUtil { - private FileUtil() - { + private FileUtil() { } /** @@ -37,24 +35,18 @@ private FileUtil() * @return The content as a byte array. * @throws IOException if the file content cannot be accessed. */ - public static byte[] getContent(final FileObject file) - throws IOException - { + public static byte[] getContent(final FileObject file) throws IOException { final FileContent content = file.getContent(); final int size = (int) content.getSize(); final byte[] buf = new byte[size]; final InputStream in = content.getInputStream(); - try - { + try { int read = 0; - for (int pos = 0; pos < size && read >= 0; pos += read) - { + for (int pos = 0; pos < size && read >= 0; pos += read) { read = in.read(buf, pos, size - pos); } - } - finally - { + } finally { in.close(); } @@ -63,30 +55,26 @@ public static byte[] getContent(final FileObject file) /** * Writes the content of a file to an OutputStream. + * * @param file The FileObject to write. * @param output The OutputStream to write to. * @throws IOException if an error occurs writing the file. * @see FileContent#write(OutputStream) */ - public static void writeContent(final FileObject file, - final OutputStream output) - throws IOException - { + public static void writeContent(final FileObject file, final OutputStream output) throws IOException { file.getContent().write(output); } /** * Copies the content from a source file to a destination file. + * * @param srcFile The source FileObject. * @param destFile The target FileObject * @throws IOException If an error occurs copying the file. * @see FileContent#write(FileContent) * @see FileContent#write(FileObject) */ - public static void copyContent(final FileObject srcFile, - final FileObject destFile) - throws IOException - { + public static void copyContent(final FileObject srcFile, final FileObject destFile) throws IOException { srcFile.getContent().write(destFile); } diff --git a/core/src/main/java/org/apache/commons/vfs2/FilesCache.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FilesCache.java similarity index 93% rename from core/src/main/java/org/apache/commons/vfs2/FilesCache.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/FilesCache.java index 113cead69d..335a19a89d 100644 --- a/core/src/main/java/org/apache/commons/vfs2/FilesCache.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FilesCache.java @@ -16,12 +16,10 @@ */ package org.apache.commons.vfs2; - /** * The fileCache interface. Implementations of this interface are expected to be thread safe. */ -public interface FilesCache -{ +public interface FilesCache { /** * Adds a FileObject to the cache. * @@ -42,7 +40,7 @@ public interface FilesCache * * @param filesystem The FileSystem. * @param name the name - * @return the fileobject or null if file is not cached + * @return the file object or null if file is not cached */ FileObject getFile(final FileSystem filesystem, final FileName name); @@ -62,13 +60,12 @@ public interface FilesCache * Removes a file from cache. * * @param filesystem filesystem - * @param name filename + * @param name filename */ void removeFile(final FileSystem filesystem, final FileName name); /** - * If the cache uses timestamps it could use this method to handle - * updates of them. + * If the cache uses timestamps it could use this method to handle updates of them. * * @param file filename */ diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/InvertIncludeFileSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/InvertIncludeFileSelector.java new file mode 100644 index 0000000000..d0ffb240ff --- /dev/null +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/InvertIncludeFileSelector.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.vfs2; + +import java.util.Objects; + +/** + * Inverts file inclusion of a delegate FileSelector, folder traversal is delegated. + * + * @since 2.2 + */ +public class InvertIncludeFileSelector implements FileSelector { + + public InvertIncludeFileSelector(final FileSelector delegateFileSelector) { + this.delegateFileSelector = Objects.requireNonNull(delegateFileSelector, "delegateFileSelector"); + } + + private final FileSelector delegateFileSelector; + + /** + * Inverts the result of calling {@link #includeFile(FileSelectInfo)} on the delegate. + */ + @Override + public boolean includeFile(final FileSelectInfo fileInfo) throws Exception { + return !delegateFileSelector.includeFile(fileInfo); + } + + /** + * Calls {@link #traverseDescendents(FileSelectInfo)} on the delegate. + */ + @Override + public boolean traverseDescendents(final FileSelectInfo fileInfo) throws Exception { + return delegateFileSelector.traverseDescendents(fileInfo); + } + +} diff --git a/core/src/main/java/org/apache/commons/vfs2/NameScope.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java similarity index 58% rename from core/src/main/java/org/apache/commons/vfs2/NameScope.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java index 8b43e53a6e..f97c3a2ff2 100644 --- a/core/src/main/java/org/apache/commons/vfs2/NameScope.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java @@ -17,74 +17,64 @@ package org.apache.commons.vfs2; /** - * An enumerated type for file name scope, used when resolving a name relative - * to a file. + * An enumerated type for file name scope, used when resolving a name relative to a file. */ -public enum NameScope -{ +public enum NameScope { /** - * Resolve against the children of the base file. The name is resolved - * as described by {@link #FILE_SYSTEM}. However, an exception is - * thrown if the resolved file is not a direct child of the base file. + * Resolve against the children of the base file. The name is resolved as described by {@link #FILE_SYSTEM}. + * However, an exception is thrown if the resolved file is not a direct child of the base file. */ CHILD("child"), /** - * Resolve against the descendants of the base file. The name is resolved - * as described by {@link #FILE_SYSTEM}. However, an exception is thrown - * if the resolved file is not a descendent of the base file. + * Resolve against the descendants of the base file. The name is resolved as described by {@link #FILE_SYSTEM}. + * However, an exception is thrown if the resolved file is not a descendent of the base file. */ DESCENDENT("descendent"), /** - * Resolve against the descendants of the base file. The name is resolved - * as described by {@link #FILE_SYSTEM}. However, an exception is thrown - * if the resolved file is not a descendent of the base file, or the base - * files itself. + * Resolve against the descendants of the base file. The name is resolved as described by {@link #FILE_SYSTEM}. + * However, an exception is thrown if the resolved file is not a descendent of the base file, or the base files + * itself. */ DESCENDENT_OR_SELF("descendent_or_self"), /** * Resolve against files in the same file system as the base file. *

    - * If the supplied name is an absolute path, then it is resolved - * relative to the root of the file system that the base file belongs to. - * If a relative name is supplied, then it is resolved relative to the base - * file. + * If the supplied name is an absolute path, then it is resolved relative to the root of the file system that the + * base file belongs to. If a relative name is supplied, then it is resolved relative to the base file. *

    - * The path may use any mix of {@code /}, {@code \}, or file - * system specific separators to separate elements in the path. It may - * also contain {@code .} and {@code ..} elements. + * The path may use any mix of {@code /}, {@code \}, or file system specific separators to separate elements in the + * path. It may also contain {@code .} and {@code ..} elements. *

    - * A path is considered absolute if it starts with a separator character, - * and relative if it does not. + * A path is considered absolute if it starts with a separator character, and relative if it does not. */ FILE_SYSTEM("filesystem"); /** The name */ private final String realName; - private NameScope(final String name) - { + private NameScope(final String name) { this.realName = name; } /** * Returns the name of the scope. + * * @return The name of the scope. */ @Override - public String toString() - { + public String toString() { return realName; } /** * Returns the name of the scope. + * * @return The name of the scope. */ - public String getName() - { + public String getName() { return realName; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java similarity index 57% rename from core/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java index b78d4bbce6..2e58ba5076 100644 --- a/core/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java @@ -16,15 +16,20 @@ */ package org.apache.commons.vfs2; +import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * A {@link FileSelector} that selects based on regular expressions matched against base filename. + * A {@link FileSelector} that selects based on regular expressions. + *

    + * The regular expression specified in one of the constructors is + * {@linkplain Matcher#matches() matched} against {@link FileName#getPath()} + * of all candidate files. If you want to match only against the base filename, + * make sure to prefix the pattern with {@code ".*\\/"}. * * @since 2.1 */ -public class PatternFileSelector implements FileSelector -{ +public class PatternFileSelector implements FileSelector { /** * The extensions to select. @@ -33,71 +38,71 @@ public class PatternFileSelector implements FileSelector /** * Creates a new selector for the given pattern. + *

    + * See {@link PatternFileSelector} for a specification how the pattern is matched. * - * @param pattern - * The regular expressed used by this selector. + * @param pattern The regular expressed used by this selector. */ - public PatternFileSelector(final Pattern pattern) - { + public PatternFileSelector(final Pattern pattern) { this.pattern = pattern; } /** * Creates a new selector for the given pattern. + *

    + * See {@link PatternFileSelector} for a specification how the pattern is matched. * - * @param regex - * The regular expressed used by this selector. + * @param regex The regular expressed used by this selector. + * + * @see Pattern#compile(String, int) */ - public PatternFileSelector(final String regex) - { + public PatternFileSelector(final String regex) { this(Pattern.compile(regex)); } /** * Creates a new selector for the given Pattern and flags. + *

    + * See {@link PatternFileSelector} for a specification how the pattern is matched. * - * @param regex - * The expression to be compiled - * - * @param flags - * Match flags, a bit mask. + * @param regex The expression to be compiled + * @param flags Match flags, a bit mask. * * @see Pattern#compile(String, int) */ - public PatternFileSelector(final String regex, final int flags) - { + public PatternFileSelector(final String regex, final int flags) { this(Pattern.compile(regex, flags)); } /** * Determines if a file or folder should be selected. + *

    + * See {@link PatternFileSelector} for a specification how the pattern is matched. * - * @param fileInfo - * The file selection information. + * @param fileInfo The file selection information. * @return true if the file should be selected, false otherwise. */ @Override - public boolean includeFile(final FileSelectInfo fileInfo) - { + public boolean includeFile(final FileSelectInfo fileInfo) { return this.pattern.matcher(fileInfo.getFile().getName().getPath()).matches(); } @Override - public String toString() - { + public String toString() { return this.pattern.toString(); } /** * Determines whether a folder should be traversed. + *

    + * This implementation always returns true to make sure all + * leafs are inspected. * - * @param fileInfo - * The file selection information. + * @param fileInfo The file selection information. * @return true if descendants should be traversed, false otherwise. */ @Override - public boolean traverseDescendents(final FileSelectInfo fileInfo) - { + public boolean traverseDescendents(final FileSelectInfo fileInfo) { return true; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java similarity index 83% rename from core/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java index b56013659e..ab124830e1 100644 --- a/core/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java @@ -24,8 +24,7 @@ /** * Provides random access over content. */ -public interface RandomAccessContent extends DataOutput, DataInput -{ +public interface RandomAccessContent extends DataOutput, DataInput { /** * Closes this random access file stream and releases any system resources associated with the stream. *

    @@ -35,8 +34,7 @@ public interface RandomAccessContent extends DataOutput, DataInput * If this file has an associated channel then the channel is closed as well. *

    * - * @throws IOException - * if an I/O error occurs. + * @throws IOException if an I/O error occurs. */ void close() throws IOException; @@ -44,8 +42,7 @@ public interface RandomAccessContent extends DataOutput, DataInput * Returns the current offset in this file. * * @return the offset from the beginning of the file, in bytes, at which the next read or write occurs. - * @throws IOException - * if an I/O error occurs. + * @throws IOException if an I/O error occurs. */ long getFilePointer() throws IOException; @@ -56,8 +53,7 @@ public interface RandomAccessContent extends DataOutput, DataInput *

    * * @return the InputStream. - * @throws IOException - * if an I/O error occurs. + * @throws IOException if an I/O error occurs. */ InputStream getInputStream() throws IOException; @@ -65,8 +61,7 @@ public interface RandomAccessContent extends DataOutput, DataInput * Returns the length of this file. * * @return the length of this file, measured in bytes. - * @throws IOException - * if an I/O error occurs. + * @throws IOException if an I/O error occurs. */ long length() throws IOException; @@ -82,11 +77,9 @@ public interface RandomAccessContent extends DataOutput, DataInput * {@link #seek(long)} *

    * - * @param pos - * the offset position, measured in bytes from the beginning of the file, at which to set the file + * @param pos the offset position, measured in bytes from the beginning of the file, at which to set the file * pointer. - * @throws IOException - * if {@code pos} is less than {@code 0} or if an I/O error occurs. + * @throws IOException if {@code pos} is less than {@code 0} or if an I/O error occurs. */ void seek(long pos) throws IOException; @@ -101,10 +94,8 @@ public interface RandomAccessContent extends DataOutput, DataInput * If the the {@code newLength} argument is greater than {@link #length()}, the content grows with undefined data. *

    * - * @param newLength - * The desired content length - * @throws IOException - * If an I/O error occurs + * @param newLength The desired content length + * @throws IOException If an I/O error occurs * @since 2.1 */ void setLength(long newLength) throws IOException; diff --git a/core/src/main/java/org/apache/commons/vfs2/Resources.properties b/commons-vfs2/src/main/java/org/apache/commons/vfs2/Resources.properties similarity index 99% rename from core/src/main/java/org/apache/commons/vfs2/Resources.properties rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/Resources.properties index 34270b961f..768c12bc39 100644 --- a/core/src/main/java/org/apache/commons/vfs2/Resources.properties +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/Resources.properties @@ -157,7 +157,7 @@ vfs.impl/delete-temp.warn=Could not clean up temporary file "{0}". vfs.impl/init-replicator.error=Could not initialise file replicator. vfs.impl/already-inited.error=Manager already inited, cant change the configuration now. vfs.impl/invalid-decorator.error="{0}" is not a valid decorator. It has to extend "DecoratedFileObject" and must provide a single argument constructor which takes a "FileObject" -vfs.impl/temp-dir.info=Using "{0}" as temporary files store. +vfs.impl/temp-dir.debug=Using "{0}" as temporary files store. # StandardFileSystemManager vfs.impl/find-config-file.error=Could not find VFS configuration resource "{0}". diff --git a/core/src/main/java/org/apache/commons/vfs2/Selectors.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/Selectors.java similarity index 90% rename from core/src/main/java/org/apache/commons/vfs2/Selectors.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/Selectors.java index 1d539fc05a..7e6570d023 100644 --- a/core/src/main/java/org/apache/commons/vfs2/Selectors.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/Selectors.java @@ -19,28 +19,25 @@ /** * Several standard file selectors. */ -public final class Selectors -{ +public final class Selectors { /** * A {@link FileSelector} that selects only the base file/folder. */ public static final FileSelector SELECT_SELF = new FileDepthSelector(); /** - * A {@link FileSelector} that selects the base file/folder and its - * direct children. + * A {@link FileSelector} that selects the base file/folder and its direct children. */ public static final FileSelector SELECT_SELF_AND_CHILDREN = new FileDepthSelector(0, 1); /** - * A {@link FileSelector} that selects only the direct children - * of the base folder. + * A {@link FileSelector} that selects only the direct children of the base folder. */ public static final FileSelector SELECT_CHILDREN = new FileDepthSelector(1); /** - * A {@link FileSelector} that selects all the descendants of the - * base folder, but does not select the base folder itself. + * A {@link FileSelector} that selects all the descendants of the base folder, but does not select the base folder + * itself. */ public static final FileSelector EXCLUDE_SELF = new FileDepthSelector(1, Integer.MAX_VALUE); @@ -55,15 +52,13 @@ public final class Selectors public static final FileSelector SELECT_FOLDERS = new FileTypeSelector(FileType.FOLDER); /** - * A {@link FileSelector} that selects the base file/folder, plus all - * its descendants. + * A {@link FileSelector} that selects the base file/folder, plus all its descendants. */ public static final FileSelector SELECT_ALL = new AllFileSelector(); /** * Prevent the class from being instantiated. */ - private Selectors() - { + private Selectors() { } } diff --git a/core/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java similarity index 78% rename from core/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java index eeb2d48665..0eab8f6b02 100644 --- a/core/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java @@ -23,13 +23,11 @@ /** * Contains various authentication data. */ -public class UserAuthenticationData -{ +public class UserAuthenticationData { /** * Represents a user authentication item. */ - public static class Type implements Comparable - { + public static class Type implements Comparable { /** The type name */ private final String type; @@ -38,27 +36,22 @@ public static class Type implements Comparable * * @param type the type */ - public Type(final String type) - { + public Type(final String type) { this.type = type; } @Override - public boolean equals(final Object o) - { - if (this == o) - { + public boolean equals(final Object o) { + if (this == o) { return true; } - if (o == null || getClass() != o.getClass()) - { + if (o == null || getClass() != o.getClass()) { return false; } final Type type1 = (Type) o; - if (type != null ? !type.equals(type1.type) : type1.type != null) - { + if (type != null ? !type.equals(type1.type) : type1.type != null) { return false; } @@ -66,28 +59,25 @@ public boolean equals(final Object o) } @Override - public int compareTo(final Type o) - { + public int compareTo(final Type o) { return type.compareTo(o.type); } /** * @return The hash code. * @since 2.0 - * */ + */ @Override - public int hashCode() - { + public int hashCode() { return type != null ? type.hashCode() : 0; } /** * @return The type. * @since 2.0 - * */ + */ @Override - public String toString() - { + public String toString() { return type; } } @@ -107,48 +97,43 @@ public String toString() /** * Creates a new uninitialized instance. */ - public UserAuthenticationData() - { + public UserAuthenticationData() { // do nothing } /** * Sets a data to this collection. + * * @param type The Type to add * @param data The data associated with the Type */ - public void setData(final Type type, final char[] data) - { + public void setData(final Type type, final char[] data) { authenticationData.put(type, data); } /** * Gets a data from the collection. + * * @param type The Type to retrieve. * @return a character array containing the data associated with the type. */ - public char[] getData(final Type type) - { + public char[] getData(final Type type) { return authenticationData.get(type); } /** * Deletes all data stored within this authenticator. */ - public void cleanup() - { + public void cleanup() { // step 1: nullify character buffers final Iterator iterAuthenticationData = authenticationData.values().iterator(); - while (iterAuthenticationData.hasNext()) - { + while (iterAuthenticationData.hasNext()) { final char[] data = iterAuthenticationData.next(); - if (data == null || data.length < 0) - { + if (data == null || data.length < 0) { continue; } - for (int i = 0; i < data.length; i++) - { + for (int i = 0; i < data.length; i++) { data[i] = 0; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java similarity index 82% rename from core/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java index 9885986178..ec83d58fbb 100644 --- a/core/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java @@ -17,14 +17,14 @@ package org.apache.commons.vfs2; /** - * The user authenticator is used to query credentials from the user. Since a UserAuthenticator - * is provided with the {@link FileSystemOptions} to a {@link FileSystem} it should also implement - * reasonable equals and hashCode functions if the FileSystem should be shared. + * The user authenticator is used to query credentials from the user. Since a UserAuthenticator is provided with the + * {@link FileSystemOptions} to a {@link FileSystem} it should also implement reasonable equals and hashCode functions + * if the FileSystem should be shared. */ -public interface UserAuthenticator -{ +public interface UserAuthenticator { /** * Queries the given type from the user. + * * @param types An array containing the user's credentials * @return The UserAuthenticationData. */ diff --git a/core/src/main/java/org/apache/commons/vfs2/VFS.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java similarity index 73% rename from core/src/main/java/org/apache/commons/vfs2/VFS.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java index 4a061051bb..8c09086aca 100644 --- a/core/src/main/java/org/apache/commons/vfs2/VFS.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java @@ -20,35 +20,28 @@ import java.lang.reflect.Method; /** - * The main entry point for the VFS. Used to create {@link FileSystemManager} - * instances. + * The main entry point for the VFS. Used to create {@link FileSystemManager} instances. */ -public final class VFS -{ +public final class VFS { /** The URI style */ private static Boolean uriStyle; /** The FileSystemManager */ private static FileSystemManager instance; - private VFS() - { + private VFS() { } /** * Returns the default {@link FileSystemManager} instance. *

    - * Warning, if you close this instance you may affect all current - * and future users of this manager singleton. + * Warning, if you close this instance you may affect all current and future users of this manager singleton. * * @return The FileSystemManager. * @throws FileSystemException if an error occurs creating the manager. */ - public static synchronized FileSystemManager getManager() - throws FileSystemException - { - if (instance == null) - { + public static synchronized FileSystemManager getManager() throws FileSystemException { + if (instance == null) { instance = createManager("org.apache.commons.vfs2.impl.StandardFileSystemManager"); } return instance; @@ -56,61 +49,54 @@ public static synchronized FileSystemManager getManager() /** * Creates a file system manager instance. + * * @param managerClassName The specific manager impelmentation class name. * @return The FileSystemManager. * @throws FileSystemException if an error occurs creating the manager. */ - private static FileSystemManager createManager(final String managerClassName) - throws FileSystemException - { - try - { + private static FileSystemManager createManager(final String managerClassName) throws FileSystemException { + try { // Create instance final Class mgrClass = Class.forName(managerClassName); final FileSystemManager mgr = (FileSystemManager) mgrClass.newInstance(); - try - { + try { // Initialize final Method initMethod = mgrClass.getMethod("init", (Class[]) null); initMethod.invoke(mgr, (Object[]) null); - } - catch (final NoSuchMethodException ignored) - { + } catch (final NoSuchMethodException ignored) { /* Ignore; don't initialize. */ } return mgr; - } - catch (final InvocationTargetException e) - { - throw new FileSystemException("vfs/create-manager.error", - managerClassName, - e.getTargetException()); - } - catch (final Exception e) - { - throw new FileSystemException("vfs/create-manager.error", - managerClassName, - e); + } catch (final InvocationTargetException e) { + throw new FileSystemException("vfs/create-manager.error", managerClassName, e.getTargetException()); + } catch (final Exception e) { + throw new FileSystemException("vfs/create-manager.error", managerClassName, e); } } - public static boolean isUriStyle() - { - if (uriStyle == null) - { + public static boolean isUriStyle() { + if (uriStyle == null) { uriStyle = Boolean.FALSE; } return uriStyle.booleanValue(); } - public static void setUriStyle(final boolean uriStyle) - { - if (VFS.uriStyle != null && VFS.uriStyle.booleanValue() != uriStyle) - { + public static void setUriStyle(final boolean uriStyle) { + if (VFS.uriStyle != null && VFS.uriStyle.booleanValue() != uriStyle) { throw new IllegalStateException("VFS.uriStyle was already set differently."); } VFS.uriStyle = Boolean.valueOf(uriStyle); } + + /** + * Sets the file system manager + * + * @param manager the file system manager + * @since 2.2 + */ + public static void setManager(final FileSystemManager manager) { + VFS.instance = manager; + } } diff --git a/core/src/main/java/org/apache/commons/vfs2/VfsLog.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VfsLog.java similarity index 75% rename from core/src/main/java/org/apache/commons/vfs2/VfsLog.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/VfsLog.java index 4149e58a11..8c14e50e16 100644 --- a/core/src/main/java/org/apache/commons/vfs2/VfsLog.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VfsLog.java @@ -19,198 +19,165 @@ import org.apache.commons.logging.Log; /** - * This class is to keep the old logging behaviour (for ant-task) and to be able to - * correctly use commons-logging.
    + * This class is to keep the old logging behaviour (for ant-task) and to be able to correctly use commons-logging.
    * I hope i could remove it sometimes. */ -public final class VfsLog -{ +public final class VfsLog { // static utility class - private VfsLog() - { + private VfsLog() { } /** * warning. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. * @param t The exception, if any. */ - public static void warn(final Log vfslog, final Log commonslog, final String message, final Throwable t) - { - if (vfslog != null) - { + public static void warn(final Log vfslog, final Log commonslog, final String message, final Throwable t) { + if (vfslog != null) { vfslog.warn(message, t); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.warn(message, t); } } /** * warning. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. */ - public static void warn(final Log vfslog, final Log commonslog, final String message) - { - if (vfslog != null) - { + public static void warn(final Log vfslog, final Log commonslog, final String message) { + if (vfslog != null) { vfslog.warn(message); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.warn(message); } } /** * debug. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. */ - public static void debug(final Log vfslog, final Log commonslog, final String message) - { - if (vfslog != null) - { + public static void debug(final Log vfslog, final Log commonslog, final String message) { + if (vfslog != null) { vfslog.debug(message); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.debug(message); } } /** * debug. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. * @param t The exception, if any. */ - public static void debug(final Log vfslog, final Log commonslog, final String message, final Throwable t) - { - if (vfslog != null) - { + public static void debug(final Log vfslog, final Log commonslog, final String message, final Throwable t) { + if (vfslog != null) { vfslog.debug(message, t); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.debug(message, t); } } /** * info. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. * @param t The exception, if any. */ - public static void info(final Log vfslog, final Log commonslog, final String message, final Throwable t) - { - if (vfslog != null) - { + public static void info(final Log vfslog, final Log commonslog, final String message, final Throwable t) { + if (vfslog != null) { vfslog.info(message, t); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.info(message, t); } } /** * info. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. */ - public static void info(final Log vfslog, final Log commonslog, final String message) - { - if (vfslog != null) - { + public static void info(final Log vfslog, final Log commonslog, final String message) { + if (vfslog != null) { vfslog.info(message); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.info(message); } } /** * error. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. * @param t The exception, if any. */ - public static void error(final Log vfslog, final Log commonslog, final String message, final Throwable t) - { - if (vfslog != null) - { + public static void error(final Log vfslog, final Log commonslog, final String message, final Throwable t) { + if (vfslog != null) { vfslog.error(message, t); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.error(message, t); } } /** * error. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. */ - public static void error(final Log vfslog, final Log commonslog, final String message) - { - if (vfslog != null) - { + public static void error(final Log vfslog, final Log commonslog, final String message) { + if (vfslog != null) { vfslog.error(message); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.error(message); } } /** * fatal. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. * @param t The exception, if any. */ - public static void fatal(final Log vfslog, final Log commonslog, final String message, final Throwable t) - { - if (vfslog != null) - { + public static void fatal(final Log vfslog, final Log commonslog, final String message, final Throwable t) { + if (vfslog != null) { vfslog.fatal(message, t); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.fatal(message, t); } } /** * fatal. + * * @param vfslog The base component Logger to use. * @param commonslog The class specific Logger * @param message The message to log. */ - public static void fatal(final Log vfslog, final Log commonslog, final String message) - { - if (vfslog != null) - { + public static void fatal(final Log vfslog, final Log commonslog, final String message) { + if (vfslog != null) { vfslog.fatal(message); - } - else if (commonslog != null) - { + } else if (commonslog != null) { commonslog.fatal(message); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java similarity index 70% rename from core/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java index f142db9eec..1f97d3f102 100644 --- a/core/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java @@ -25,8 +25,7 @@ /** * Provides always the same credentials data passed in with the constructor. */ -public class StaticUserAuthenticator implements UserAuthenticator, Comparable -{ +public class StaticUserAuthenticator implements UserAuthenticator, Comparable { private static final Log LOG = LogFactory.getLog(StaticUserAuthenticator.class); /** The user name */ @@ -38,38 +37,27 @@ public class StaticUserAuthenticator implements UserAuthenticator, Comparable - * This implementation caches every file with no expire or limit. - * All files and filesystems are hard reachable references. This implementation - * holds a list of filesystem specific {@linkplain ConcurrentHashMap ConcurrentHashMaps} in - * the main cache map. + * This implementation caches every file with no expire or limit. All files and filesystems are hard reachable + * references. This implementation holds a list of filesystem specific {@linkplain ConcurrentHashMap ConcurrentHashMaps} + * in the main cache map. *

    - * Cached {@linkplain FileObject FileObjects} as well as {@linkplain FileSystem FileSystems} - * are only removed when {@link #clear(FileSystem)} is called (i.e. on filesystem close). - * When the used {@link org.apache.commons.vfs2.FileSystemManager FileSystemManager} is closed, - * it will also {@linkplain #close() close} this cache (which frees all entries). + * Cached {@linkplain FileObject FileObjects} as well as {@linkplain FileSystem FileSystems} are only removed when + * {@link #clear(FileSystem)} is called (i.e. on filesystem close). When the used + * {@link org.apache.commons.vfs2.FileSystemManager FileSystemManager} is closed, it will also {@linkplain #close() + * close} this cache (which frees all entries). *

    * Despite its name, this is not the fallback implementation used by - * {@link org.apache.commons.vfs2.impl.DefaultFileSystemManager#init() DefaultFileSystemManager#init()} - * anymore. + * {@link org.apache.commons.vfs2.impl.DefaultFileSystemManager#init() DefaultFileSystemManager#init()} anymore. */ -public class DefaultFilesCache extends AbstractFilesCache -{ +public class DefaultFilesCache extends AbstractFilesCache { /** The FileSystem cache. Keeps one Map for each FileSystem. */ - private final ConcurrentMap> filesystemCache = - new ConcurrentHashMap<>(10); + private final ConcurrentMap> filesystemCache = new ConcurrentHashMap<>( + 10); @Override - public void putFile(final FileObject file) - { + public void putFile(final FileObject file) { final Map files = getOrCreateFilesystemCache(file.getFileSystem()); files.put(file.getName(), file); } @Override - public boolean putFileIfAbsent(final FileObject file) - { + public boolean putFileIfAbsent(final FileObject file) { final ConcurrentMap files = getOrCreateFilesystemCache(file.getFileSystem()); return files.putIfAbsent(file.getName(), file) == null; } @Override - public FileObject getFile(final FileSystem filesystem, final FileName name) - { + public FileObject getFile(final FileSystem filesystem, final FileName name) { // avoid creating filesystem entry for empty filesystem cache: final Map files = filesystemCache.get(filesystem); - if (files == null) - { + if (files == null) { // cache for filesystem is not known => file is not cached: return null; } @@ -76,22 +69,18 @@ public FileObject getFile(final FileSystem filesystem, final FileName name) } @Override - public void clear(final FileSystem filesystem) - { + public void clear(final FileSystem filesystem) { // avoid keeping a reference to the FileSystem (key) object final Map files = filesystemCache.remove(filesystem); - if (files != null) - { + if (files != null) { files.clear(); // help GC } } - protected ConcurrentMap getOrCreateFilesystemCache(final FileSystem filesystem) - { + protected ConcurrentMap getOrCreateFilesystemCache(final FileSystem filesystem) { ConcurrentMap files = filesystemCache.get(filesystem); // we loop to make sure we never return null even when concurrent clean is called - while (files == null) - { + while (files == null) { filesystemCache.putIfAbsent(filesystem, new ConcurrentHashMap(200, 0.75f, 8)); files = filesystemCache.get(filesystem); } @@ -100,20 +89,17 @@ protected ConcurrentMap getOrCreateFilesystemCache(final F } @Override - public void close() - { + public void close() { super.close(); filesystemCache.clear(); } @Override - public void removeFile(final FileSystem filesystem, final FileName name) - { + public void removeFile(final FileSystem filesystem, final FileName name) { // avoid creating filesystem entry for empty filesystem cache: final Map files = filesystemCache.get(filesystem); - if (files != null) - { + if (files != null) { files.remove(name); // This would be too racey: // if (files.empty()) filesystemCache.remove(filessystem); diff --git a/core/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java similarity index 86% rename from core/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java index d9cdaa49c0..5e68d4f903 100644 --- a/core/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java @@ -24,8 +24,7 @@ *

    * It compares the fileSystem (by hashCode) and the filename. */ -class FileSystemAndNameKey implements Comparable -{ +class FileSystemAndNameKey implements Comparable { /** The FileSystem */ private final FileSystem fileSystem; @@ -35,8 +34,7 @@ class FileSystemAndNameKey implements Comparable /** hashcode to identify this object */ private final int fileSystemId; - FileSystemAndNameKey(final FileSystem fileSystem, final FileName fileName) - { + FileSystemAndNameKey(final FileSystem fileSystem, final FileName fileName) { this.fileSystem = fileSystem; this.fileSystemId = System.identityHashCode(fileSystem); @@ -44,27 +42,22 @@ class FileSystemAndNameKey implements Comparable } @Override - public int compareTo(final FileSystemAndNameKey other) - { - if (fileSystemId < other.fileSystemId) - { + public int compareTo(final FileSystemAndNameKey other) { + if (fileSystemId < other.fileSystemId) { return -1; } - if (fileSystemId > other.fileSystemId) - { + if (fileSystemId > other.fileSystemId) { return 1; } return fileName.compareTo(other.fileName); } - FileSystem getFileSystem() - { + FileSystem getFileSystem() { return fileSystem; } - FileName getFileName() - { + FileName getFileName() { return fileName; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java similarity index 78% rename from core/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java index e5bb556b0d..6c0d58c253 100644 --- a/core/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java @@ -39,8 +39,7 @@ *

    * The default constructor uses a LRU size of 100 per filesystem. */ -public class LRUFilesCache extends AbstractFilesCache -{ +public class LRUFilesCache extends AbstractFilesCache { /** The default LRU size */ private static final int DEFAULT_LRU_SIZE = 100; @@ -48,8 +47,7 @@ public class LRUFilesCache extends AbstractFilesCache private static final Log log = LogFactory.getLog(LRUFilesCache.class); /** The FileSystem cache */ - private final ConcurrentMap> filesystemCache = - new ConcurrentHashMap<>(10); + private final ConcurrentMap> filesystemCache = new ConcurrentHashMap<>(10); /** The size of the cache */ private final int lruSize; @@ -61,8 +59,7 @@ public class LRUFilesCache extends AbstractFilesCache /** * The file cache */ - private class MyLRUMap extends LRUMap - { + private class MyLRUMap extends LRUMap { /** * serialVersionUID format is YYYYMMDD for the date of the last binary change. */ @@ -71,46 +68,37 @@ private class MyLRUMap extends LRUMap /** The FileSystem */ private final FileSystem filesystem; - public MyLRUMap(final FileSystem filesystem, final int size) - { + public MyLRUMap(final FileSystem filesystem, final int size) { super(size, true); this.filesystem = filesystem; } @Override - protected boolean removeLRU(final AbstractLinkedMap.LinkEntry linkEntry) - { - synchronized (LRUFilesCache.this) - { + protected boolean removeLRU(final AbstractLinkedMap.LinkEntry linkEntry) { + synchronized (LRUFilesCache.this) { final FileObject file = linkEntry.getValue(); // System.err.println(">>> " + size() + " check removeLRU:" + linkEntry.getKey().toString()); - if (file.isAttached() || file.isContentOpen()) - { + if (file.isAttached() || file.isContentOpen()) { // do not allow open or attached files to be removed // System.err.println(">>> " + size() + " VETO removeLRU:" + - // linkEntry.getKey().toString() + " (" + file.isAttached() + "/" + - // file.isContentOpen() + ")"); + // linkEntry.getKey().toString() + " (" + file.isAttached() + "/" + + // file.isContentOpen() + ")"); return false; } // System.err.println(">>> " + size() + " removeLRU:" + linkEntry.getKey().toString()); - if (super.removeLRU(linkEntry)) - { - try - { + if (super.removeLRU(linkEntry)) { + try { // force detach file.close(); - } - catch (final FileSystemException e) - { + } catch (final FileSystemException e) { VfsLog.warn(getLogger(), log, Messages.getString("vfs.impl/LRUFilesCache-remove-ex.warn"), e); } final Map files = filesystemCache.get(filesystem); - if (files.size() < 1) - { + if (files.size() < 1) { filesystemCache.remove(filesystem); } @@ -125,8 +113,7 @@ protected boolean removeLRU(final AbstractLinkedMap.LinkEntry files = getOrCreateFilesystemCache(file.getFileSystem()); writeLock.lock(); - try - { + try { files.put(file.getName(), file); - } - finally - { + } finally { writeLock.unlock(); } } - @Override - public boolean putFileIfAbsent(final FileObject file) - { + public boolean putFileIfAbsent(final FileObject file) { final Map files = getOrCreateFilesystemCache(file.getFileSystem()); writeLock.lock(); - try - { + try { final FileName name = file.getName(); - if (files.containsKey(name)) - { + if (files.containsKey(name)) { return false; } files.put(name, file); return true; - } - finally - { + } finally { writeLock.unlock(); } } @Override - public FileObject getFile(final FileSystem filesystem, final FileName name) - { + public FileObject getFile(final FileSystem filesystem, final FileName name) { final Map files = getOrCreateFilesystemCache(filesystem); readLock.lock(); - try - { + try { return files.get(name); - } - finally - { + } finally { readLock.unlock(); } } @Override - public void clear(final FileSystem filesystem) - { + public void clear(final FileSystem filesystem) { final Map files = getOrCreateFilesystemCache(filesystem); writeLock.lock(); - try - { + try { files.clear(); filesystemCache.remove(filesystem); - } - finally - { + } finally { writeLock.unlock(); } } - protected Map getOrCreateFilesystemCache(final FileSystem filesystem) - { + protected Map getOrCreateFilesystemCache(final FileSystem filesystem) { Map files = filesystemCache.get(filesystem); - if (files == null) - { + if (files == null) { files = new MyLRUMap(filesystem, lruSize); filesystemCache.putIfAbsent(filesystem, files); } @@ -227,36 +193,29 @@ protected Map getOrCreateFilesystemCache(final FileSystem } @Override - public void close() - { + public void close() { super.close(); filesystemCache.clear(); } @Override - public void removeFile(final FileSystem filesystem, final FileName name) - { + public void removeFile(final FileSystem filesystem, final FileName name) { final Map files = getOrCreateFilesystemCache(filesystem); writeLock.lock(); - try - { + try { files.remove(name); - if (files.size() < 1) - { + if (files.size() < 1) { filesystemCache.remove(filesystem); } - } - finally - { + } finally { writeLock.unlock(); } } @Override - public void touchFile(final FileObject file) - { + public void touchFile(final FileObject file) { // this moves the file back on top getFile(file.getFileSystem(), file.getName()); } diff --git a/core/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java similarity index 78% rename from core/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java index 8f3146ee91..f6d9b496ad 100644 --- a/core/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java @@ -25,35 +25,29 @@ *

    * This implementation never ever caches a single file. *

    - * Notice: if you use resolveFile(uri) multiple times with the same path, the system will always - * create a new instance. Changes on one instance of this file are not seen by the others. + * Notice: if you use resolveFile(uri) multiple times with the same path, the system will always create a new + * instance. Changes on one instance of this file are not seen by the others. */ -public class NullFilesCache extends AbstractFilesCache -{ +public class NullFilesCache extends AbstractFilesCache { @Override - public void putFile(final FileObject file) - { + public void putFile(final FileObject file) { } @Override - public boolean putFileIfAbsent(final FileObject file) - { + public boolean putFileIfAbsent(final FileObject file) { return false; } @Override - public FileObject getFile(final FileSystem filesystem, final FileName name) - { + public FileObject getFile(final FileSystem filesystem, final FileName name) { return null; } @Override - public void clear(final FileSystem filesystem) - { + public void clear(final FileSystem filesystem) { } @Override - public void removeFile(final FileSystem filesystem, final FileName name) - { + public void removeFile(final FileSystem filesystem, final FileName name) { } } diff --git a/core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java similarity index 77% rename from core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java index c7bed07823..3570798c59 100644 --- a/core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java @@ -29,171 +29,146 @@ /** * This decorator refreshes the fileObject data on every call. */ -public class OnCallRefreshFileObject extends DecoratedFileObject -{ - public OnCallRefreshFileObject(final FileObject fileObject) - { +public class OnCallRefreshFileObject extends DecoratedFileObject { + public OnCallRefreshFileObject(final FileObject fileObject) { super(fileObject); } @Override - public void close() throws FileSystemException - { + public void close() throws FileSystemException { refresh(); super.close(); } @Override - public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException - { + public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException { refresh(); super.copyFrom(srcFile, selector); } @Override - public void createFile() throws FileSystemException - { + public void createFile() throws FileSystemException { refresh(); super.createFile(); } @Override - public void createFolder() throws FileSystemException - { + public void createFolder() throws FileSystemException { refresh(); super.createFolder(); } @Override - public boolean delete() throws FileSystemException - { + public boolean delete() throws FileSystemException { refresh(); return super.delete(); } @Override - public int delete(final FileSelector selector) throws FileSystemException - { + public int delete(final FileSelector selector) throws FileSystemException { refresh(); return super.delete(selector); } @Override - public boolean exists() throws FileSystemException - { + public boolean exists() throws FileSystemException { refresh(); return super.exists(); } @Override public void findFiles(final FileSelector selector, final boolean depthwise, final List selected) - throws FileSystemException - { + throws FileSystemException { refresh(); super.findFiles(selector, depthwise, selected); } @Override - public FileObject[] findFiles(final FileSelector selector) throws FileSystemException - { + public FileObject[] findFiles(final FileSelector selector) throws FileSystemException { refresh(); return super.findFiles(selector); } @Override - public FileObject getChild(final String name) throws FileSystemException - { + public FileObject getChild(final String name) throws FileSystemException { refresh(); return super.getChild(name); } @Override - public FileObject[] getChildren() throws FileSystemException - { + public FileObject[] getChildren() throws FileSystemException { refresh(); return super.getChildren(); } @Override - public FileContent getContent() throws FileSystemException - { + public FileContent getContent() throws FileSystemException { refresh(); return super.getContent(); } @Override - public FileType getType() throws FileSystemException - { + public FileType getType() throws FileSystemException { refresh(); return super.getType(); } @Override - public boolean isExecutable() throws FileSystemException - { + public boolean isExecutable() throws FileSystemException { refresh(); return super.isExecutable(); } @Override - public boolean isHidden() throws FileSystemException - { + public boolean isHidden() throws FileSystemException { refresh(); return super.isHidden(); } @Override - public boolean isReadable() throws FileSystemException - { + public boolean isReadable() throws FileSystemException { refresh(); return super.isReadable(); } @Override - public boolean isWriteable() throws FileSystemException - { + public boolean isWriteable() throws FileSystemException { refresh(); return super.isWriteable(); } @Override - public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException - { + public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException { refresh(); return super.setExecutable(executable, ownerOnly); } @Override - public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException - { + public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException { refresh(); return super.setReadable(readable, ownerOnly); } @Override - public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException - { + public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException { refresh(); return super.setWritable(writable, ownerOnly); } @Override - public void moveTo(final FileObject destFile) throws FileSystemException - { + public void moveTo(final FileObject destFile) throws FileSystemException { refresh(); super.moveTo(destFile); } @Override - public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException - { + public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException { refresh(); return super.resolveFile(name, scope); } @Override - public FileObject resolveFile(final String path) throws FileSystemException - { + public FileObject resolveFile(final String path) throws FileSystemException { refresh(); return super.resolveFile(path); } diff --git a/core/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java similarity index 68% rename from core/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java index 71ec4f4348..f8ca6c0251 100644 --- a/core/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java @@ -36,77 +36,59 @@ import org.apache.commons.vfs2.util.Messages; /** - * This implementation caches every file as long as it is strongly reachable by - * the java vm. As soon as the vm needs memory - every softly reachable file - * will be discarded. + * This implementation caches every file as long as it is strongly reachable by the java vm. As soon as the vm needs + * memory - every softly reachable file will be discarded. * * @see SoftReference */ -public class SoftRefFilesCache extends AbstractFilesCache -{ +public class SoftRefFilesCache extends AbstractFilesCache { private static final int TIMEOUT = 1000; private static final Log log = LogFactory.getLog(SoftRefFilesCache.class); - private final ConcurrentMap>> fileSystemCache = - new ConcurrentHashMap<>(); - private final Map, FileSystemAndNameKey> refReverseMap = - new HashMap<>(100); + private final ConcurrentMap>> fileSystemCache = new ConcurrentHashMap<>(); + private final Map, FileSystemAndNameKey> refReverseMap = new HashMap<>(100); private final ReferenceQueue refQueue = new ReferenceQueue<>(); private volatile SoftRefReleaseThread softRefReleaseThread = null; // @GuardedBy("lock") private final Lock lock = new ReentrantLock(); - /** - * This thread will listen on the ReferenceQueue and remove the entry in the - * filescache as soon as the vm removes the reference + * This thread will listen on the ReferenceQueue and remove the entry in the filescache as soon as the vm removes + * the reference */ - private final class SoftRefReleaseThread extends Thread - { + private final class SoftRefReleaseThread extends Thread { private volatile boolean requestEnd; // used for inter-thread communication - private SoftRefReleaseThread() - { + private SoftRefReleaseThread() { setName(SoftRefReleaseThread.class.getName()); setDaemon(true); } @Override - public void run() - { - loop: while (!requestEnd && !Thread.currentThread().isInterrupted()) - { - try - { + public void run() { + loop: while (!requestEnd && !Thread.currentThread().isInterrupted()) { + try { final Reference ref = refQueue.remove(TIMEOUT); - if (ref == null) - { + if (ref == null) { continue; } lock.lock(); - try - { + try { final FileSystemAndNameKey key = refReverseMap.get(ref); - if (key != null && removeFile(key)) - { + if (key != null && removeFile(key)) { close(key.getFileSystem()); } - } - finally - { + } finally { lock.unlock(); } - } - catch (final InterruptedException e) - { - if (!requestEnd) - { + } catch (final InterruptedException e) { + if (!requestEnd) { VfsLog.warn(getLogger(), log, - Messages.getString("vfs.impl/SoftRefReleaseThread-interrupt.info")); + Messages.getString("vfs.impl/SoftRefReleaseThread-interrupt.info")); } break loop; } @@ -114,36 +96,28 @@ public void run() } } - public SoftRefFilesCache() - { + public SoftRefFilesCache() { } - private void startThread() - { + private void startThread() { // Double Checked Locking is allowed when volatile - if (softRefReleaseThread != null) - { + if (softRefReleaseThread != null) { return; } - synchronized (lock) - { - if (softRefReleaseThread == null) - { + synchronized (lock) { + if (softRefReleaseThread == null) { softRefReleaseThread = new SoftRefReleaseThread(); softRefReleaseThread.start(); } } } - private void endThread() - { - synchronized (lock) - { + private void endThread() { + synchronized (lock) { final SoftRefReleaseThread thread = softRefReleaseThread; softRefReleaseThread = null; - if (thread != null) - { + if (thread != null) { thread.requestEnd = true; thread.interrupt(); } @@ -151,10 +125,8 @@ private void endThread() } @Override - public void putFile(final FileObject fileObject) - { - if (log.isDebugEnabled()) - { + public void putFile(final FileObject fileObject) { + if (log.isDebugEnabled()) { log.debug("putFile: " + this.getSafeName(fileObject)); } @@ -164,36 +136,28 @@ public void putFile(final FileObject fileObject) final FileSystemAndNameKey key = new FileSystemAndNameKey(fileObject.getFileSystem(), fileObject.getName()); lock.lock(); - try - { + try { final Reference old = files.put(fileObject.getName(), ref); - if (old != null) - { + if (old != null) { refReverseMap.remove(old); } refReverseMap.put(ref, key); - } - finally - { + } finally { lock.unlock(); } } - private String getSafeName(final FileName fileName) - { + private String getSafeName(final FileName fileName) { return fileName.getFriendlyURI(); } - private String getSafeName(final FileObject fileObject) - { + private String getSafeName(final FileObject fileObject) { return this.getSafeName(fileObject.getName()); } @Override - public boolean putFileIfAbsent(final FileObject fileObject) - { - if (log.isDebugEnabled()) - { + public boolean putFileIfAbsent(final FileObject fileObject) { + if (log.isDebugEnabled()) { log.debug("putFile: " + this.getSafeName(fileObject)); } @@ -203,179 +167,142 @@ public boolean putFileIfAbsent(final FileObject fileObject) final FileSystemAndNameKey key = new FileSystemAndNameKey(fileObject.getFileSystem(), fileObject.getName()); lock.lock(); - try - { - if (files.containsKey(fileObject.getName()) && files.get(fileObject.getName()).get() != null) - { + try { + if (files.containsKey(fileObject.getName()) && files.get(fileObject.getName()).get() != null) { return false; } final Reference old = files.put(fileObject.getName(), ref); - if (old != null) - { + if (old != null) { refReverseMap.remove(old); } refReverseMap.put(ref, key); return true; - } - finally - { + } finally { lock.unlock(); } } - protected Reference createReference(final FileObject file, final ReferenceQueue refqueue) - { + protected Reference createReference(final FileObject file, final ReferenceQueue refqueue) { return new SoftReference<>(file, refqueue); } @Override - public FileObject getFile(final FileSystem fileSystem, final FileName fileName) - { + public FileObject getFile(final FileSystem fileSystem, final FileName fileName) { final Map> files = getOrCreateFilesystemCache(fileSystem); lock.lock(); - try - { + try { final Reference ref = files.get(fileName); - if (ref == null) - { + if (ref == null) { return null; } final FileObject fo = ref.get(); - if (fo == null) - { + if (fo == null) { removeFile(fileSystem, fileName); } return fo; - } - finally - { + } finally { lock.unlock(); } } @Override - public void clear(final FileSystem fileSystem) - { + public void clear(final FileSystem fileSystem) { final Map> files = getOrCreateFilesystemCache(fileSystem); lock.lock(); - try - { + try { final Iterator iterKeys = refReverseMap.values().iterator(); - while (iterKeys.hasNext()) - { + while (iterKeys.hasNext()) { final FileSystemAndNameKey key = iterKeys.next(); - if (key.getFileSystem() == fileSystem) - { + if (key.getFileSystem() == fileSystem) { iterKeys.remove(); files.remove(key.getFileName()); } } - if (files.size() < 1) - { + if (files.size() < 1) { close(fileSystem); } - } - finally - { + } finally { lock.unlock(); } } /** * Called while the lock is held + * * @param fileSystem The file system to close. */ - private void close(final FileSystem fileSystem) - { - if (log.isDebugEnabled()) - { + private void close(final FileSystem fileSystem) { + if (log.isDebugEnabled()) { log.debug("close fs: " + fileSystem.getRootName()); } fileSystemCache.remove(fileSystem); - if (fileSystemCache.size() < 1) - { + if (fileSystemCache.size() < 1) { endThread(); } - /* This is not thread-safe as another thread might be opening the file system - ((DefaultFileSystemManager) getContext().getFileSystemManager()) - ._closeFileSystem(filesystem); + /* + * This is not thread-safe as another thread might be opening the file system ((DefaultFileSystemManager) + * getContext().getFileSystemManager()) ._closeFileSystem(filesystem); */ } @Override - public void close() - { + public void close() { super.close(); endThread(); lock.lock(); - try - { + try { fileSystemCache.clear(); refReverseMap.clear(); - } - finally - { + } finally { lock.unlock(); } } @Override - public void removeFile(final FileSystem fileSystem, final FileName fileName) - { - if (removeFile(new FileSystemAndNameKey(fileSystem, fileName))) - { + public void removeFile(final FileSystem fileSystem, final FileName fileName) { + if (removeFile(new FileSystemAndNameKey(fileSystem, fileName))) { close(fileSystem); } } - private boolean removeFile(final FileSystemAndNameKey key) - { - if (log.isDebugEnabled()) - { + private boolean removeFile(final FileSystemAndNameKey key) { + if (log.isDebugEnabled()) { log.debug("removeFile: " + this.getSafeName(key.getFileName())); } final Map files = getOrCreateFilesystemCache(key.getFileSystem()); lock.lock(); - try - { + try { final Object ref = files.remove(key.getFileName()); - if (ref != null) - { + if (ref != null) { refReverseMap.remove(ref); } return files.size() < 1; - } - finally - { + } finally { lock.unlock(); } } - protected Map> getOrCreateFilesystemCache(final FileSystem fileSystem) - { - if (fileSystemCache.size() < 1) - { + protected Map> getOrCreateFilesystemCache(final FileSystem fileSystem) { + if (fileSystemCache.size() < 1) { startThread(); } Map> files; - do - { + do { files = fileSystemCache.get(fileSystem); - if (files != null) - { + if (files != null) { break; } files = new HashMap<>(); diff --git a/core/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java similarity index 77% rename from core/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java index 4cd7b71ef1..8acf7db5b8 100644 --- a/core/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java @@ -23,18 +23,15 @@ import org.apache.commons.vfs2.FileObject; /** - * This implementation caches every file as long as it is strongly reachable by - * the java vm. As soon as the object is no longer reachable it will be discarded. - * In contrast to the SoftRefFilesCache this implementation might free resources faster - * as it don't wait until a memory limitation. + * This implementation caches every file as long as it is strongly reachable by the java vm. As soon as the object is no + * longer reachable it will be discarded. In contrast to the SoftRefFilesCache this implementation might free resources + * faster as it don't wait until a memory limitation. * * @see java.lang.ref.WeakReference */ -public class WeakRefFilesCache extends SoftRefFilesCache -{ +public class WeakRefFilesCache extends SoftRefFilesCache { @Override - protected Reference createReference(final FileObject file, final ReferenceQueue refqueue) - { + protected Reference createReference(final FileObject file, final ReferenceQueue refqueue) { return new WeakReference<>(file, refqueue); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/cache/package.html b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/package.html similarity index 100% rename from core/src/main/java/org/apache/commons/vfs2/cache/package.html rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/package.html diff --git a/core/src/main/java/org/apache/commons/vfs2/events/AbstractFileChangeEvent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/AbstractFileChangeEvent.java similarity index 94% rename from core/src/main/java/org/apache/commons/vfs2/events/AbstractFileChangeEvent.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/events/AbstractFileChangeEvent.java index ce4a9ae5ee..5c9605dd30 100644 --- a/core/src/main/java/org/apache/commons/vfs2/events/AbstractFileChangeEvent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/AbstractFileChangeEvent.java @@ -23,10 +23,8 @@ /** * A change event that knows how to notify a listener. */ -public abstract class AbstractFileChangeEvent extends FileChangeEvent -{ - public AbstractFileChangeEvent(final FileObject file) - { +public abstract class AbstractFileChangeEvent extends FileChangeEvent { + public AbstractFileChangeEvent(final FileObject file) { super(file); } diff --git a/core/src/main/java/org/apache/commons/vfs2/events/ChangedEvent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/ChangedEvent.java similarity index 89% rename from core/src/main/java/org/apache/commons/vfs2/events/ChangedEvent.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/events/ChangedEvent.java index 5be75f0ab8..fada37218a 100644 --- a/core/src/main/java/org/apache/commons/vfs2/events/ChangedEvent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/ChangedEvent.java @@ -22,16 +22,13 @@ /** * File changed event. */ -public class ChangedEvent extends AbstractFileChangeEvent -{ - public ChangedEvent(final FileObject file) - { +public class ChangedEvent extends AbstractFileChangeEvent { + public ChangedEvent(final FileObject file) { super(file); } @Override - public void notify(final FileListener listener) throws Exception - { + public void notify(final FileListener listener) throws Exception { listener.fileChanged(this); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/events/CreateEvent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/CreateEvent.java similarity index 90% rename from core/src/main/java/org/apache/commons/vfs2/events/CreateEvent.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/events/CreateEvent.java index 26f35ec2f0..f747b87861 100644 --- a/core/src/main/java/org/apache/commons/vfs2/events/CreateEvent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/CreateEvent.java @@ -22,16 +22,13 @@ /** * File creation event. */ -public class CreateEvent extends AbstractFileChangeEvent -{ - public CreateEvent(final FileObject file) - { +public class CreateEvent extends AbstractFileChangeEvent { + public CreateEvent(final FileObject file) { super(file); } @Override - public void notify(final FileListener listener) throws Exception - { + public void notify(final FileListener listener) throws Exception { listener.fileCreated(this); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/events/DeleteEvent.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/DeleteEvent.java similarity index 90% rename from core/src/main/java/org/apache/commons/vfs2/events/DeleteEvent.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/events/DeleteEvent.java index de4e775f47..9e82b19594 100644 --- a/core/src/main/java/org/apache/commons/vfs2/events/DeleteEvent.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/DeleteEvent.java @@ -22,16 +22,13 @@ /** * File deletion event. */ -public class DeleteEvent extends AbstractFileChangeEvent -{ - public DeleteEvent(final FileObject file) - { +public class DeleteEvent extends AbstractFileChangeEvent { + public DeleteEvent(final FileObject file) { super(file); } @Override - public void notify(final FileListener listener) throws Exception - { + public void notify(final FileListener listener) throws Exception { listener.fileDeleted(this); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/events/package.html b/commons-vfs2/src/main/java/org/apache/commons/vfs2/events/package.html similarity index 100% rename from core/src/main/java/org/apache/commons/vfs2/events/package.html rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/events/package.html diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java similarity index 72% rename from core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java index 07ef301055..7d1721f6ea 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java @@ -33,255 +33,212 @@ /** * Base class to build a fileObject decoration. */ -public class DecoratedFileObject implements FileObject -{ +public class DecoratedFileObject implements FileObject { private final FileObject decoratedFileObject; - public DecoratedFileObject(final FileObject decoratedFileObject) - { + public DecoratedFileObject(final FileObject decoratedFileObject) { super(); this.decoratedFileObject = decoratedFileObject; } @Override - public boolean canRenameTo(final FileObject newfile) - { + public boolean canRenameTo(final FileObject newfile) { return decoratedFileObject.canRenameTo(newfile); } @Override - public void close() throws FileSystemException - { + public void close() throws FileSystemException { decoratedFileObject.close(); } @Override - public int compareTo(final FileObject fo) - { + public int compareTo(final FileObject fo) { return decoratedFileObject.compareTo(fo); } @Override - public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException - { + public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException { decoratedFileObject.copyFrom(srcFile, selector); } @Override - public void createFile() throws FileSystemException - { + public void createFile() throws FileSystemException { decoratedFileObject.createFile(); } @Override - public void createFolder() throws FileSystemException - { + public void createFolder() throws FileSystemException { decoratedFileObject.createFolder(); } @Override - public boolean delete() throws FileSystemException - { + public boolean delete() throws FileSystemException { return decoratedFileObject.delete(); } @Override - public int delete(final FileSelector selector) throws FileSystemException - { + public int delete(final FileSelector selector) throws FileSystemException { return decoratedFileObject.delete(selector); } @Override - public int deleteAll() throws FileSystemException - { + public int deleteAll() throws FileSystemException { return decoratedFileObject.deleteAll(); } @Override - public boolean exists() throws FileSystemException - { + public boolean exists() throws FileSystemException { return decoratedFileObject.exists(); } @Override - public FileObject[] findFiles(final FileSelector selector) throws FileSystemException - { + public FileObject[] findFiles(final FileSelector selector) throws FileSystemException { return decoratedFileObject.findFiles(selector); } @Override public void findFiles(final FileSelector selector, final boolean depthwise, final List selected) - throws FileSystemException - { + throws FileSystemException { decoratedFileObject.findFiles(selector, depthwise, selected); } @Override - public FileObject getChild(final String name) throws FileSystemException - { + public FileObject getChild(final String name) throws FileSystemException { return decoratedFileObject.getChild(name); } @Override - public FileObject[] getChildren() throws FileSystemException - { + public FileObject[] getChildren() throws FileSystemException { return decoratedFileObject.getChildren(); } @Override - public FileContent getContent() throws FileSystemException - { + public FileContent getContent() throws FileSystemException { return decoratedFileObject.getContent(); } - public FileObject getDecoratedFileObject() - { + public FileObject getDecoratedFileObject() { return decoratedFileObject; } @Override - public FileOperations getFileOperations() throws FileSystemException - { + public FileOperations getFileOperations() throws FileSystemException { return decoratedFileObject.getFileOperations(); } @Override - public FileSystem getFileSystem() - { + public FileSystem getFileSystem() { return decoratedFileObject.getFileSystem(); } @Override - public String getPublicURIString() - { + public String getPublicURIString() { return decoratedFileObject.getPublicURIString(); } @Override - public FileName getName() - { + public FileName getName() { return decoratedFileObject.getName(); } @Override - public FileObject getParent() throws FileSystemException - { + public FileObject getParent() throws FileSystemException { return decoratedFileObject.getParent(); } @Override - public FileType getType() throws FileSystemException - { + public FileType getType() throws FileSystemException { return decoratedFileObject.getType(); } @Override - public URL getURL() throws FileSystemException - { + public URL getURL() throws FileSystemException { return decoratedFileObject.getURL(); } @Override - public boolean isAttached() - { + public boolean isAttached() { return decoratedFileObject.isAttached(); } @Override - public boolean isContentOpen() - { + public boolean isContentOpen() { return decoratedFileObject.isContentOpen(); } @Override - public boolean isExecutable() throws FileSystemException - { + public boolean isExecutable() throws FileSystemException { return decoratedFileObject.isExecutable(); } @Override - public boolean isFile() throws FileSystemException - { + public boolean isFile() throws FileSystemException { return decoratedFileObject.isFile(); } @Override - public boolean isFolder() throws FileSystemException - { + public boolean isFolder() throws FileSystemException { return decoratedFileObject.isFolder(); } @Override - public boolean isHidden() throws FileSystemException - { + public boolean isHidden() throws FileSystemException { return decoratedFileObject.isHidden(); } @Override - public boolean isReadable() throws FileSystemException - { + public boolean isReadable() throws FileSystemException { return decoratedFileObject.isReadable(); } @Override - public boolean isWriteable() throws FileSystemException - { + public boolean isWriteable() throws FileSystemException { return decoratedFileObject.isWriteable(); } @Override - public Iterator iterator() - { + public Iterator iterator() { return decoratedFileObject.iterator(); } @Override - public void moveTo(final FileObject destFile) throws FileSystemException - { + public void moveTo(final FileObject destFile) throws FileSystemException { decoratedFileObject.moveTo(destFile); } @Override - public void refresh() throws FileSystemException - { + public void refresh() throws FileSystemException { decoratedFileObject.refresh(); } @Override - public FileObject resolveFile(final String path) throws FileSystemException - { + public FileObject resolveFile(final String path) throws FileSystemException { return decoratedFileObject.resolveFile(path); } @Override - public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException - { + public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException { return decoratedFileObject.resolveFile(name, scope); } @Override - public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException - { + public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException { return decoratedFileObject.setExecutable(executable, ownerOnly); } @Override - public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException - { + public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException { return decoratedFileObject.setReadable(readable, ownerOnly); } @Override - public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException - { + public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException { return decoratedFileObject.setWritable(writable, ownerOnly); } @Override - public String toString() - { + public String toString() { return decoratedFileObject.toString(); } - } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java similarity index 87% rename from core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java index 7b5aded912..51621c687e 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileContentInfo.java @@ -21,26 +21,22 @@ /** * The default file content information. */ -public class DefaultFileContentInfo implements FileContentInfo -{ +public class DefaultFileContentInfo implements FileContentInfo { private final String contentType; private final String contentEncoding; - public DefaultFileContentInfo(final String contentType, final String contentEncoding) - { + public DefaultFileContentInfo(final String contentType, final String contentEncoding) { this.contentType = contentType; this.contentEncoding = contentEncoding; } @Override - public String getContentType() - { + public String getContentType() { return contentType; } @Override - public String getContentEncoding() - { + public String getContentEncoding() { return contentEncoding; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java similarity index 65% rename from core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java index 28007af11c..e8b0f47b63 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java @@ -32,48 +32,42 @@ /** * A polling {@link FileMonitor} implementation. *

    - * The DefaultFileMonitor is a Thread based polling file system monitor with a 1 - * second delay. + * The DefaultFileMonitor is a Thread based polling file system monitor with a 1 second delay. * *

    Design:

    * - * There is a Map of monitors known as FileMonitorAgents. With the thread running, - * each FileMonitorAgent object is asked to "check" on the file it is - * responsible for. To do this check, the cache is cleared. + * There is a Map of monitors known as FileMonitorAgents. With the thread running, each FileMonitorAgent object is asked + * to "check" on the file it is responsible for. To do this check, the cache is cleared. *
      - *
    • If the file existed before the refresh and it no longer exists, a delete - * event is fired.
    • - *
    • If the file existed before the refresh and it still exists, check the - * last modified timestamp to see if that has changed.
    • + *
    • If the file existed before the refresh and it no longer exists, a delete event is fired.
    • + *
    • If the file existed before the refresh and it still exists, check the last modified timestamp to see if that has + * changed.
    • *
    • If it has, fire a change event.
    • *
    - * With each file delete, the FileMonitorAgent of the parent is asked to - * re-build its - * list of children, so that they can be accurately checked when there are new - * children. + * With each file delete, the FileMonitorAgent of the parent is asked to re-build its list of children, so that they can + * be accurately checked when there are new children. *

    - * New files are detected during each "check" as each file does a check for new - * children. - * If new children are found, create events are fired recursively if recursive - * descent is enabled. + * New files are detected during each "check" as each file does a check for new children. If new children are found, + * create events are fired recursively if recursive descent is enabled. *

    - * For performance reasons, added a delay that increases as the number of files - * monitored - * increases. The default is a delay of 1 second for every 1000 files processed. + * For performance reasons, added a delay that increases as the number of files monitored increases. The default is a + * delay of 1 second for every 1000 files processed. * - *

    Example usage:

    + * 

    Example usage:

    + * + *
      * FileSystemManager fsManager = VFS.getManager();
      * FileObject listendir = fsManager.resolveFile("/home/username/monitored/");
      *
      * DefaultFileMonitor fm = new DefaultFileMonitor(new CustomFileListener());
      * fm.setRecursive(true);
      * fm.addFile(listendir);
    - * fm.start();
    - * (where CustomFileListener is a class that implements the FileListener - * interface.) + * fm.start(); + *
    + * + * (where CustomFileListener is a class that implements the FileListener interface.) */ -public class DefaultFileMonitor implements Runnable, FileMonitor -{ +public class DefaultFileMonitor implements Runnable, FileMonitor { private static final Log LOG = LogFactory.getLog(DefaultFileMonitor.class); private static final long DEFAULT_DELAY = 1000; @@ -125,99 +119,83 @@ public class DefaultFileMonitor implements Runnable, FileMonitor */ private final FileListener listener; - public DefaultFileMonitor(final FileListener listener) - { + public DefaultFileMonitor(final FileListener listener) { this.listener = listener; } /** * Access method to get the recursive setting when adding files for monitoring. + * * @return true if monitoring is enabled for children. */ - public boolean isRecursive() - { + public boolean isRecursive() { return this.recursive; } /** * Access method to set the recursive setting when adding files for monitoring. + * * @param newRecursive true if monitoring should be enabled for children. */ - public void setRecursive(final boolean newRecursive) - { + public void setRecursive(final boolean newRecursive) { this.recursive = newRecursive; } /** - * Access method to get the current FileListener object notified when there - * are changes with the files added. + * Access method to get the current FileListener object notified when there are changes with the files added. + * * @return The FileListener. */ - FileListener getFileListener() - { + FileListener getFileListener() { return this.listener; } /** * Adds a file to be monitored. + * * @param file The FileObject to monitor. */ @Override - public void addFile(final FileObject file) - { + public void addFile(final FileObject file) { doAddFile(file); - try - { + try { // add all direct children too - if (file.getType().hasChildren()) - { + if (file.getType().hasChildren()) { // Traverse the children final FileObject[] children = file.getChildren(); - for (final FileObject element : children) - { + for (final FileObject element : children) { doAddFile(element); } } - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } /** * Adds a file to be monitored. + * * @param file The FileObject to add. */ - private void doAddFile(final FileObject file) - { - synchronized (this.monitorMap) - { - if (this.monitorMap.get(file.getName()) == null) - { - this.monitorMap.put(file.getName(), new FileMonitorAgent(this, - file)); - - try - { - if (this.listener != null) - { + private void doAddFile(final FileObject file) { + synchronized (this.monitorMap) { + if (this.monitorMap.get(file.getName()) == null) { + this.monitorMap.put(file.getName(), new FileMonitorAgent(this, file)); + + try { + if (this.listener != null) { file.getFileSystem().addListener(file, this.listener); } - if (file.getType().hasChildren() && this.recursive) - { + if (file.getType().hasChildren() && this.recursive) { // Traverse the children final FileObject[] children = file.getChildren(); - for (final FileObject element : children) - { + for (final FileObject element : children) { this.addFile(element); // Add depth first } } - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } @@ -227,34 +205,26 @@ private void doAddFile(final FileObject file) /** * Removes a file from being monitored. + * * @param file The FileObject to remove from monitoring. */ @Override - public void removeFile(final FileObject file) - { - synchronized (this.monitorMap) - { + public void removeFile(final FileObject file) { + synchronized (this.monitorMap) { final FileName fn = file.getName(); - if (this.monitorMap.get(fn) != null) - { + if (this.monitorMap.get(fn) != null) { FileObject parent; - try - { + try { parent = file.getParent(); - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { parent = null; } this.monitorMap.remove(fn); - if (parent != null) - { // Not the root - final FileMonitorAgent parentAgent = - this.monitorMap.get(parent.getName()); - if (parentAgent != null) - { + if (parent != null) { // Not the root + final FileMonitorAgent parentAgent = this.monitorMap.get(parent.getName()); + if (parentAgent != null) { parentAgent.resetChildrenList(); } } @@ -264,74 +234,67 @@ public void removeFile(final FileObject file) /** * Queues a file for removal from being monitored. + * * @param file The FileObject to be removed from being monitored. */ - protected void queueRemoveFile(final FileObject file) - { + protected void queueRemoveFile(final FileObject file) { this.deleteStack.push(file); } /** * Get the delay between runs. + * * @return The delay period. */ - public long getDelay() - { + public long getDelay() { return delay; } /** * Set the delay between runs. + * * @param delay The delay period. */ - public void setDelay(final long delay) - { - if (delay > 0) - { + public void setDelay(final long delay) { + if (delay > 0) { this.delay = delay; - } - else - { + } else { this.delay = DEFAULT_DELAY; } } /** * get the number of files to check per run. + * * @return The number of files to check per iteration. */ - public int getChecksPerRun() - { + public int getChecksPerRun() { return checksPerRun; } /** - * set the number of files to check per run. - * a additional delay will be added if there are more files to check + * set the number of files to check per run. a additional delay will be added if there are more files to check * * @param checksPerRun a value less than 1 will disable this feature */ - public void setChecksPerRun(final int checksPerRun) - { + public void setChecksPerRun(final int checksPerRun) { this.checksPerRun = checksPerRun; } /** * Queues a file for addition to be monitored. + * * @param file The FileObject to add. */ - protected void queueAddFile(final FileObject file) - { + protected void queueAddFile(final FileObject file) { this.addStack.push(file); } /** * Starts monitoring the files that have been added. */ - public void start() - { - if (this.monitorThread == null) - { + public void start() { + if (this.monitorThread == null) { this.monitorThread = new Thread(this); this.monitorThread.setDaemon(true); this.monitorThread.setPriority(Thread.MIN_PRIORITY); @@ -342,8 +305,7 @@ public void start() /** * Stops monitoring the files that have been added. */ - public void stop() - { + public void stop() { this.shouldRun = false; } @@ -351,65 +313,47 @@ public void stop() * Asks the agent for each file being monitored to check its file for changes. */ @Override - public void run() - { - mainloop: - while (!monitorThread.isInterrupted() && this.shouldRun) - { + public void run() { + mainloop: while (!monitorThread.isInterrupted() && this.shouldRun) { // For each entry in the map Object[] fileNames; - synchronized (this.monitorMap) - { + synchronized (this.monitorMap) { fileNames = this.monitorMap.keySet().toArray(); } - for (int iterFileNames = 0; iterFileNames < fileNames.length; - iterFileNames++) - { + for (int iterFileNames = 0; iterFileNames < fileNames.length; iterFileNames++) { final FileName fileName = (FileName) fileNames[iterFileNames]; FileMonitorAgent agent; - synchronized (this.monitorMap) - { + synchronized (this.monitorMap) { agent = this.monitorMap.get(fileName); } - if (agent != null) - { + if (agent != null) { agent.check(); } - if (getChecksPerRun() > 0 && (iterFileNames + 1) % getChecksPerRun() == 0) - { - try - { + if (getChecksPerRun() > 0 && (iterFileNames + 1) % getChecksPerRun() == 0) { + try { Thread.sleep(getDelay()); - } - catch (final InterruptedException e) - { + } catch (final InterruptedException e) { // Woke up. } } - if (monitorThread.isInterrupted() || !this.shouldRun) - { + if (monitorThread.isInterrupted() || !this.shouldRun) { continue mainloop; } } - while (!this.addStack.empty()) - { + while (!this.addStack.empty()) { this.addFile(this.addStack.pop()); } - while (!this.deleteStack.empty()) - { + while (!this.deleteStack.empty()) { this.removeFile(this.deleteStack.pop()); } - try - { + try { Thread.sleep(getDelay()); - } - catch (final InterruptedException e) - { + } catch (final InterruptedException e) { continue; } } @@ -420,8 +364,7 @@ public void run() /** * File monitor agent. */ - private static final class FileMonitorAgent - { + private static final class FileMonitorAgent { private final FileObject file; private final DefaultFileMonitor fm; @@ -429,142 +372,103 @@ private static final class FileMonitorAgent private long timestamp; private Map children; - private FileMonitorAgent(final DefaultFileMonitor fm, final FileObject file) - { + private FileMonitorAgent(final DefaultFileMonitor fm, final FileObject file) { this.fm = fm; this.file = file; this.refresh(); this.resetChildrenList(); - try - { + try { this.exists = this.file.exists(); - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { this.exists = false; this.timestamp = -1; } - if (this.exists) - { - try - { + if (this.exists) { + try { this.timestamp = this.file.getContent().getLastModifiedTime(); - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { this.timestamp = -1; } } } - private void resetChildrenList() - { - try - { - if (this.file.getType().hasChildren()) - { + private void resetChildrenList() { + try { + if (this.file.getType().hasChildren()) { this.children = new HashMap<>(); final FileObject[] childrenList = this.file.getChildren(); - for (final FileObject element : childrenList) - { - this.children.put(element.getName(), new - Object()); // null? + for (final FileObject element : childrenList) { + this.children.put(element.getName(), new Object()); // null? } } - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { this.children = null; } } - /** * Clear the cache and re-request the file object */ - private void refresh() - { - try - { + private void refresh() { + try { this.file.refresh(); - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } - /** - * Recursively fires create events for all children if recursive descent is - * enabled. Otherwise the create event is only fired for the initial - * FileObject. + * Recursively fires create events for all children if recursive descent is enabled. Otherwise the create event + * is only fired for the initial FileObject. + * * @param child The child to add. */ - private void fireAllCreate(final FileObject child) - { + private void fireAllCreate(final FileObject child) { // Add listener so that it can be triggered - if (this.fm.getFileListener() != null) - { + if (this.fm.getFileListener() != null) { child.getFileSystem().addListener(child, this.fm.getFileListener()); } ((AbstractFileSystem) child.getFileSystem()).fireFileCreated(child); // Remove it because a listener is added in the queueAddFile - if (this.fm.getFileListener() != null) - { - child.getFileSystem().removeListener(child, - this.fm.getFileListener()); + if (this.fm.getFileListener() != null) { + child.getFileSystem().removeListener(child, this.fm.getFileListener()); } this.fm.queueAddFile(child); // Add - try - { - if (this.fm.isRecursive() && child.getType().hasChildren()) - { + try { + if (this.fm.isRecursive() && child.getType().hasChildren()) { final FileObject[] newChildren = child.getChildren(); - for (final FileObject element : newChildren) - { + for (final FileObject element : newChildren) { fireAllCreate(element); } } - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } /** - * Only checks for new children. If children are removed, they'll - * eventually be checked. + * Only checks for new children. If children are removed, they'll eventually be checked. */ - private void checkForNewChildren() - { - try - { - if (this.file.getType().hasChildren()) - { + private void checkForNewChildren() { + try { + if (this.file.getType().hasChildren()) { final FileObject[] newChildren = this.file.getChildren(); - if (this.children != null) - { + if (this.children != null) { // See which new children are not listed in the current children map. final Map newChildrenMap = new HashMap<>(); final Stack missingChildren = new Stack<>(); - for (int i = 0; i < newChildren.length; i++) - { - newChildrenMap.put(newChildren[i].getName(), new - Object()); // null ? + for (int i = 0; i < newChildren.length; i++) { + newChildrenMap.put(newChildren[i].getName(), new Object()); // null ? // If the child's not there - if - (!this.children.containsKey(newChildren[i].getName())) - { + if (!this.children.containsKey(newChildren[i].getName())) { missingChildren.push(newChildren[i]); } } @@ -572,103 +476,77 @@ private void checkForNewChildren() this.children = newChildrenMap; // If there were missing children - if (!missingChildren.empty()) - { + if (!missingChildren.empty()) { - while (!missingChildren.empty()) - { + while (!missingChildren.empty()) { final FileObject child = missingChildren.pop(); this.fireAllCreate(child); } } - } - else - { + } else { // First set of children - Break out the cigars - if (newChildren.length > 0) - { + if (newChildren.length > 0) { this.children = new HashMap<>(); } - for (final FileObject element : newChildren) - { - this.children.put(element.getName(), new - Object()); // null? + for (final FileObject element : newChildren) { + this.children.put(element.getName(), new Object()); // null? this.fireAllCreate(element); } } } - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } - private void check() - { + private void check() { this.refresh(); - try - { + try { // If the file existed and now doesn't - if (this.exists && !this.file.exists()) - { + if (this.exists && !this.file.exists()) { this.exists = this.file.exists(); this.timestamp = -1; // Fire delete event - ((AbstractFileSystem) - this.file.getFileSystem()).fireFileDeleted(this.file); + ((AbstractFileSystem) this.file.getFileSystem()).fireFileDeleted(this.file); // Remove listener in case file is re-created. Don't want to fire twice. - if (this.fm.getFileListener() != null) - { - this.file.getFileSystem().removeListener(this.file, - this.fm.getFileListener()); + if (this.fm.getFileListener() != null) { + this.file.getFileSystem().removeListener(this.file, this.fm.getFileListener()); } // Remove from map this.fm.queueRemoveFile(this.file); - } - else if (this.exists && this.file.exists()) - { + } else if (this.exists && this.file.exists()) { // Check the timestamp to see if it has been modified - if (this.timestamp != this.file.getContent().getLastModifiedTime()) - { + if (this.timestamp != this.file.getContent().getLastModifiedTime()) { this.timestamp = this.file.getContent().getLastModifiedTime(); // Fire change event // Don't fire if it's a folder because new file children // and deleted files in a folder have their own event triggered. - if (!this.file.getType().hasChildren()) - { - ((AbstractFileSystem) - this.file.getFileSystem()).fireFileChanged(this.file); + if (!this.file.getType().hasChildren()) { + ((AbstractFileSystem) this.file.getFileSystem()).fireFileChanged(this.file); } } - } - else if (!this.exists && this.file.exists()) - { + } else if (!this.exists && this.file.exists()) { this.exists = this.file.exists(); this.timestamp = this.file.getContent().getLastModifiedTime(); // Don't fire if it's a folder because new file children // and deleted files in a folder have their own event triggered. - if (!this.file.getType().hasChildren()) - { - ((AbstractFileSystem) - this.file.getFileSystem()).fireFileCreated(this.file); + if (!this.file.getType().hasChildren()) { + ((AbstractFileSystem) this.file.getFileSystem()).fireFileCreated(this.file); } } this.checkForNewChildren(); - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { LOG.error(fse.getLocalizedMessage(), fse); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java similarity index 79% rename from core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java index 9c6db9bd98..43f5f20ad6 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileReplicator.java @@ -35,27 +35,21 @@ /** * A simple file replicator and temporary file store. */ -public class DefaultFileReplicator - extends AbstractVfsComponent - implements FileReplicator, TemporaryFileStore -{ +public class DefaultFileReplicator extends AbstractVfsComponent implements FileReplicator, TemporaryFileStore { private static final Log log = LogFactory.getLog(DefaultFileReplicator.class); private static final int MASK = 0xffff; private static final Random random = new Random(); - private static final char[] TMP_RESERVED_CHARS = new char[] - { - '?', '/', '\\', ' ', '&', '"', '\'', '*', '#', ';', ':', '<', '>', '|' - }; + private static final char[] TMP_RESERVED_CHARS = new char[] { '?', '/', '\\', ' ', '&', '"', '\'', '*', '#', ';', + ':', '<', '>', '|' }; private final ArrayList copies = new ArrayList<>(); private long filecount; private File tempDir; private boolean tempDirMessageLogged; - public DefaultFileReplicator() - { + public DefaultFileReplicator() { } /** @@ -63,15 +57,12 @@ public DefaultFileReplicator() * * @param tempDir The temporary directory. */ - public DefaultFileReplicator(final File tempDir) - { + public DefaultFileReplicator(final File tempDir) { this.tempDir = tempDir; } - protected void addFile(final Object file) - { - synchronized (copies) - { + protected void addFile(final Object file) { + synchronized (copies) { copies.add(file); } } @@ -84,12 +75,10 @@ protected void addFile(final Object file) * @throws FileSystemException if an error occurs. */ @Override - public File allocateFile(final String baseName) throws FileSystemException - { + public File allocateFile(final String baseName) throws FileSystemException { // Create a unique-ish file name final String basename = createFilename(baseName); - synchronized (this) - { + synchronized (this) { filecount++; } @@ -100,28 +89,23 @@ public File allocateFile(final String baseName) throws FileSystemException * Closes the replicator, deleting all temporary files. */ @Override - public void close() - { + public void close() { // Delete the temporary files - synchronized (copies) - { - while (copies.size() > 0) - { + synchronized (copies) { + while (copies.size() > 0) { final File file = (File) removeFile(); deleteFile(file); } } // Clean up the temp directory, if it is empty - if (tempDir != null && tempDir.exists() && tempDir.list().length == 0) - { + if (tempDir != null && tempDir.exists() && tempDir.list().length == 0) { tempDir.delete(); tempDir = null; } } - protected File createAndAddFile(final File parent, final String basename) throws FileSystemException - { + protected File createAndAddFile(final File parent, final String basename) throws FileSystemException { final File file = createFile(tempDir, basename); // Keep track to delete later @@ -138,8 +122,7 @@ protected File createAndAddFile(final File parent, final String basename) throws * @return The File that was created. * @throws FileSystemException if an error occurs creating the file. */ - protected File createFile(final File parent, final String name) throws FileSystemException - { + protected File createFile(final File parent, final String name) throws FileSystemException { return new File(parent, UriParser.decode(name)); } @@ -149,8 +132,7 @@ protected File createFile(final File parent, final String name) throws FileSyste * @param baseName The base to prepend to the file name being created. * @return the name of the File. */ - protected String createFilename(final String baseName) - { + protected String createFilename(final String baseName) { // BUG29007 // return baseName + "_" + getFilecount() + ".tmp"; @@ -165,22 +147,17 @@ protected String createFilename(final String baseName) * * @param file The File to delete. */ - protected void deleteFile(final File file) - { - try - { + protected void deleteFile(final File file) { + try { final FileObject fileObject = getContext().toFileObject(file); fileObject.deleteAll(); - } - catch (final FileSystemException e) - { - final String message = Messages.getString("vfs.impl/delete-temp.warn", new Object[]{file.getName()}); + } catch (final FileSystemException e) { + final String message = Messages.getString("vfs.impl/delete-temp.warn", file.getName()); VfsLog.warn(getLogger(), log, message, e); } } - protected long getFilecount() - { + protected long getFilecount() { return filecount; } @@ -190,10 +167,8 @@ protected long getFilecount() * @throws FileSystemException if an error occurs. */ @Override - public void init() throws FileSystemException - { - if (tempDir == null) - { + public void init() throws FileSystemException { + if (tempDir == null) { final String baseTmpDir = System.getProperty("java.io.tmpdir"); tempDir = new File(baseTmpDir, "vfs_cache").getAbsoluteFile(); @@ -201,10 +176,9 @@ public void init() throws FileSystemException filecount = random.nextInt() & MASK; - if (!tempDirMessageLogged) - { - final String message = Messages.getString("vfs.impl/temp-dir.info", new Object[]{tempDir}); - VfsLog.info(getLogger(), log, message); + if (!tempDirMessageLogged) { + final String message = Messages.getString("vfs.impl/temp-dir.debug", tempDir); + VfsLog.debug(getLogger(), log, message); tempDirMessageLogged = true; } @@ -217,10 +191,8 @@ public void init() throws FileSystemException * * @return the File that was removed. */ - protected Object removeFile() - { - synchronized (copies) - { + protected Object removeFile() { + synchronized (copies) { return copies.remove(0); } } @@ -230,10 +202,8 @@ protected Object removeFile() * * @param file The File to remove. */ - protected void removeFile(final Object file) - { - synchronized (copies) - { + protected void removeFile(final Object file) { + synchronized (copies) { copies.remove(file); } } @@ -247,10 +217,7 @@ protected void removeFile(final Object file) * @throws FileSystemException if an error occurs copying the file. */ @Override - public File replicateFile(final FileObject srcFile, - final FileSelector selector) - throws FileSystemException - { + public File replicateFile(final FileObject srcFile, final FileSelector selector) throws FileSystemException { final String basename = srcFile.getName().getBaseName(); final File file = allocateFile(basename); diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemConfigBuilder.java similarity index 91% rename from core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemConfigBuilder.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemConfigBuilder.java index 0ee795087f..f6db28e43e 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemConfigBuilder.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemConfigBuilder.java @@ -25,8 +25,7 @@ /** * Default options usable for all file systems. */ -public class DefaultFileSystemConfigBuilder extends FileSystemConfigBuilder -{ +public class DefaultFileSystemConfigBuilder extends FileSystemConfigBuilder { /** The default FileSystemConfigBuilder */ private static final DefaultFileSystemConfigBuilder BUILDER = new DefaultFileSystemConfigBuilder(); @@ -35,20 +34,19 @@ public class DefaultFileSystemConfigBuilder extends FileSystemConfigBuilder * * @return the singleton builder. */ - public static DefaultFileSystemConfigBuilder getInstance() - { + public static DefaultFileSystemConfigBuilder getInstance() { return BUILDER; } /** * Sets the user authenticator to get authentication informations. + * * @param opts The FileSystemOptions. * @param userAuthenticator The UserAuthenticator. * @throws FileSystemException if an error occurs setting the UserAuthenticator. */ public void setUserAuthenticator(final FileSystemOptions opts, final UserAuthenticator userAuthenticator) - throws FileSystemException - { + throws FileSystemException { setParam(opts, "userAuthenticator", userAuthenticator); } @@ -57,21 +55,18 @@ public void setUserAuthenticator(final FileSystemOptions opts, final UserAuthent * @param opts The FileSystemOptions. * @return The UserAuthenticator. */ - public UserAuthenticator getUserAuthenticator(final FileSystemOptions opts) - { + public UserAuthenticator getUserAuthenticator(final FileSystemOptions opts) { return (UserAuthenticator) getParam(opts, "userAuthenticator"); } /** * Dummy class that implements FileSystem. */ - abstract static class DefaultFileSystem implements FileSystem - { + abstract static class DefaultFileSystem implements FileSystem { } @Override - protected Class getConfigClass() - { + protected Class getConfigClass() { return DefaultFileSystem.class; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java similarity index 75% rename from core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java index 166da43551..3ee31cc20b 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java @@ -60,8 +60,7 @@ /** * The default file system manager implementation. */ -public class DefaultFileSystemManager implements FileSystemManager -{ +public class DefaultFileSystemManager implements FileSystemManager { /** * Mapping from URI scheme to FileProvider. */ @@ -80,15 +79,13 @@ public class DefaultFileSystemManager implements FileSystemManager /** * Operations providers added to this manager. */ - private final Map> operationProviders = - new HashMap<>(); + private final Map> operationProviders = new HashMap<>(); /** * Mappings of file types. */ private final FileTypeMap typeMap = new FileTypeMap(); - /** * The provider for local files. */ @@ -153,60 +150,44 @@ public class DefaultFileSystemManager implements FileSystemManager */ private boolean init; - /** * Returns the logger used by this manager. + * * @return the Logger. */ - protected Log getLogger() - { + protected Log getLogger() { return log; } /** * Registers a file system provider. *

    - * The manager takes care of all lifecycle management. - * A provider may be registered multiple times. - * The first {@link LocalFileProvider} added will be - * remembered for {@link #getLocalFileProvider()}. + * The manager takes care of all lifecycle management. A provider may be registered multiple times. The first + * {@link LocalFileProvider} added will be remembered for {@link #getLocalFileProvider()}. * - * @param urlScheme - * The scheme the provider will handle. - * @param provider - * The provider. + * @param urlScheme The scheme the provider will handle. + * @param provider The provider. * @throws FileSystemException if an error occurs adding the provider. */ - public void addProvider(final String urlScheme, final FileProvider provider) - throws FileSystemException - { - addProvider(new String[] {urlScheme}, provider); + public void addProvider(final String urlScheme, final FileProvider provider) throws FileSystemException { + addProvider(new String[] { urlScheme }, provider); } /** * Registers a file system provider. *

    - * The manager takes care of all lifecycle management. - * A provider may be registered multiple times. - * The first {@link LocalFileProvider} added will be - * remembered for {@link #getLocalFileProvider()}. + * The manager takes care of all lifecycle management. A provider may be registered multiple times. The first + * {@link LocalFileProvider} added will be remembered for {@link #getLocalFileProvider()}. * - * @param urlSchemes - * The schemes the provider will handle. - * @param provider - * The provider. + * @param urlSchemes The schemes the provider will handle. + * @param provider The provider. * @throws FileSystemException if an error occurs adding the provider. */ - public void addProvider(final String[] urlSchemes, - final FileProvider provider) throws FileSystemException - { + public void addProvider(final String[] urlSchemes, final FileProvider provider) throws FileSystemException { // fail duplicate schemes - for (final String scheme : urlSchemes) - { - if (providers.containsKey(scheme)) - { - throw new FileSystemException( - "vfs.impl/multiple-providers-for-scheme.error", scheme); + for (final String scheme : urlSchemes) { + if (providers.containsKey(scheme)) { + throw new FileSystemException("vfs.impl/multiple-providers-for-scheme.error", scheme); } } @@ -214,13 +195,11 @@ public void addProvider(final String[] urlSchemes, setupComponent(provider); // Add to map - for (final String scheme : urlSchemes) - { + for (final String scheme : urlSchemes) { providers.put(scheme, provider); } - if (provider instanceof LocalFileProvider && localFileProvider == null) - { + if (provider instanceof LocalFileProvider && localFileProvider == null) { localFileProvider = (LocalFileProvider) provider; } } @@ -232,8 +211,7 @@ public void addProvider(final String[] urlSchemes, * @return true if a provider is configured for this scheme, false otherwise. */ @Override - public boolean hasProvider(final String scheme) - { + public boolean hasProvider(final String scheme) { return providers.containsKey(scheme); } @@ -243,8 +221,7 @@ public boolean hasProvider(final String scheme) * @param extension The file name extension. * @param scheme The scheme to use for files with this extension. */ - public void addExtensionMap(final String extension, final String scheme) - { + public void addExtensionMap(final String extension, final String scheme) { typeMap.addExtension(extension, scheme); } @@ -254,31 +231,29 @@ public void addExtensionMap(final String extension, final String scheme) * @param mimeType The mime type. * @param scheme The scheme to use for files with this mime type. */ - public void addMimeTypeMap(final String mimeType, final String scheme) - { + public void addMimeTypeMap(final String mimeType, final String scheme) { typeMap.addMimeType(mimeType, scheme); } /** - * Sets the default provider. This is the provider that will handle URI with - * unknown schemes. The manager takes care of all lifecycle management. + * Sets the default provider. This is the provider that will handle URI with unknown schemes. The manager takes care + * of all lifecycle management. + * * @param provider The FileProvider. * @throws FileSystemException if an error occurs setting the provider. */ - public void setDefaultProvider(final FileProvider provider) - throws FileSystemException - { + public void setDefaultProvider(final FileProvider provider) throws FileSystemException { setupComponent(provider); defaultProvider = provider; } /** * Returns the filesCache implementation used to cache files. + * * @return The FilesCache. */ @Override - public FilesCache getFilesCache() - { + public FilesCache getFilesCache() { return filesCache; } @@ -287,17 +262,13 @@ public FilesCache getFilesCache() *

    * Can only be set before the FileSystemManager is initialized. *

    - * The manager takes care of the lifecycle. If none is set, a default is picked - * in {@link #init()}. + * The manager takes care of the lifecycle. If none is set, a default is picked in {@link #init()}. * * @param filesCache The FilesCache. * @throws FileSystemException if an error occurs setting the cache.. */ - public void setFilesCache(final FilesCache filesCache) - throws FileSystemException - { - if (init) - { + public void setFilesCache(final FilesCache filesCache) throws FileSystemException { + if (init) { throw new FileSystemException("vfs.impl/already-inited.error"); } @@ -312,14 +283,10 @@ public void setFilesCache(final FilesCache filesCache) * The default is {@link CacheStrategy#ON_RESOLVE} * * @param fileCacheStrategy The CacheStrategy to use. - * @throws FileSystemException - * if this is not possible. e.g. it is already set. - */ - public void setCacheStrategy(final CacheStrategy fileCacheStrategy) - throws FileSystemException - { - if (init) - { + * @throws FileSystemException if this is not possible. e.g. it is already set. + */ + public void setCacheStrategy(final CacheStrategy fileCacheStrategy) throws FileSystemException { + if (init) { throw new FileSystemException("vfs.impl/already-inited.error"); } @@ -328,32 +295,31 @@ public void setCacheStrategy(final CacheStrategy fileCacheStrategy) /** * Get the cache strategy used. + * * @return The CacheStrategy. */ @Override - public CacheStrategy getCacheStrategy() - { + public CacheStrategy getCacheStrategy() { return fileCacheStrategy; } /** * Get the file object decorator used. + * * @return The decorator. */ @Override - public Class getFileObjectDecorator() - { + public Class getFileObjectDecorator() { return fileObjectDecorator; } /** - * The constructor associated to the fileObjectDecorator. - * We cache it here for performance reasons. + * The constructor associated to the fileObjectDecorator. We cache it here for performance reasons. + * * @return The decorator's Constructor. */ @Override - public Constructor getFileObjectDecoratorConst() - { + public Constructor getFileObjectDecoratorConst() { return fileObjectDecoratorConst; } @@ -362,27 +328,21 @@ public Constructor getFileObjectDecoratorConst() *

    * Can only be set before the FileSystemManager is initialized. * - * @param fileObjectDecorator must be inherted from {@link DecoratedFileObject} a has to provide a - * constructor with a single {@link FileObject} as argument + * @param fileObjectDecorator must be inherted from {@link DecoratedFileObject} a has to provide a constructor with + * a single {@link FileObject} as argument * @throws FileSystemException if an error occurs setting the decorator. */ - public void setFileObjectDecorator(final Class fileObjectDecorator) throws FileSystemException - { - if (init) - { + public void setFileObjectDecorator(final Class fileObjectDecorator) throws FileSystemException { + if (init) { throw new FileSystemException("vfs.impl/already-inited.error"); } - if (!DecoratedFileObject.class.isAssignableFrom(fileObjectDecorator)) - { + if (!DecoratedFileObject.class.isAssignableFrom(fileObjectDecorator)) { throw new FileSystemException("vfs.impl/invalid-decorator.error", fileObjectDecorator.getName()); } - try - { - fileObjectDecoratorConst = fileObjectDecorator.getConstructor(new Class[]{FileObject.class}); - } - catch (final NoSuchMethodException e) - { + try { + fileObjectDecoratorConst = fileObjectDecorator.getConstructor(new Class[] { FileObject.class }); + } catch (final NoSuchMethodException e) { throw new FileSystemException("vfs.impl/invalid-decorator.error", fileObjectDecorator.getName(), e); } @@ -390,19 +350,17 @@ public void setFileObjectDecorator(final Class fileObjectDecorator) throws Fi } /** - * get the fileContentInfoFactory used to determine the infos of a file - * content. + * get the fileContentInfoFactory used to determine the infos of a file content. + * * @return The FileContentInfoFactory. */ @Override - public FileContentInfoFactory getFileContentInfoFactory() - { + public FileContentInfoFactory getFileContentInfoFactory() { return fileContentInfoFactory; } /** - * set the fileContentInfoFactory used to determine the infos of a file - * content. + * set the fileContentInfoFactory used to determine the infos of a file content. *

    * Can only be set before the FileSystemManager is initialized. * @@ -410,10 +368,8 @@ public FileContentInfoFactory getFileContentInfoFactory() * @throws FileSystemException if an error occurs setting the FileContentInfoFactory. */ public void setFileContentInfoFactory(final FileContentInfoFactory fileContentInfoFactory) - throws FileSystemException - { - if (init) - { + throws FileSystemException { + if (init) { throw new FileSystemException("vfs.impl/already-inited.error"); } @@ -428,9 +384,7 @@ public void setFileContentInfoFactory(final FileContentInfoFactory fileContentIn * @param replicator The FileReplicator. * @throws FileSystemException if an error occurs setting the replicator. */ - public void setReplicator(final FileReplicator replicator) - throws FileSystemException - { + public void setReplicator(final FileReplicator replicator) throws FileSystemException { setupComponent(replicator); fileReplicator = replicator; } @@ -443,9 +397,7 @@ public void setReplicator(final FileReplicator replicator) * @param tempFileStore The temporary FileStore. * @throws FileSystemException if an error occurs adding the file store. */ - public void setTemporaryFileStore(final TemporaryFileStore tempFileStore) - throws FileSystemException - { + public void setTemporaryFileStore(final TemporaryFileStore tempFileStore) throws FileSystemException { setupComponent(tempFileStore); this.tempFileStore = tempFileStore; } @@ -458,8 +410,7 @@ public void setTemporaryFileStore(final TemporaryFileStore tempFileStore) * @param log The Logger to use. */ @Override - public void setLogger(final Log log) - { + public void setLogger(final Log log) { this.log = log; } @@ -469,13 +420,9 @@ public void setLogger(final Log log) * @param component The component to setup. * @throws FileSystemException if an error occurs. */ - private void setupComponent(final Object component) - throws FileSystemException - { - if (!components.contains(component)) - { - if (component instanceof VfsComponent) - { + private void setupComponent(final Object component) throws FileSystemException { + if (!components.contains(component)) { + if (component instanceof VfsComponent) { final VfsComponent vfsComponent = (VfsComponent) component; vfsComponent.setLogger(getLogger()); vfsComponent.setContext(context); @@ -490,12 +437,9 @@ private void setupComponent(final Object component) * * @param component The component to close. */ - private void closeComponent(final Object component) - { - if (component != null && components.contains(component)) - { - if (component instanceof VfsComponent) - { + private void closeComponent(final Object component) { + if (component != null && components.contains(component)) { + if (component instanceof VfsComponent) { final VfsComponent vfsComponent = (VfsComponent) component; vfsComponent.close(); } @@ -509,10 +453,8 @@ private void closeComponent(final Object component) * @return The file replicator. Never returns null. * @throws FileSystemException if there is no FileReplicator. */ - public FileReplicator getReplicator() throws FileSystemException - { - if (fileReplicator == null) - { + public FileReplicator getReplicator() throws FileSystemException { + if (fileReplicator == null) { throw new FileSystemException("vfs.impl/no-replicator.error"); } return fileReplicator; @@ -524,11 +466,8 @@ public FileReplicator getReplicator() throws FileSystemException * @return The file store. Never returns null. * @throws FileSystemException if there is no TemporaryFileStore. */ - public TemporaryFileStore getTemporaryFileStore() - throws FileSystemException - { - if (tempFileStore == null) - { + public TemporaryFileStore getTemporaryFileStore() throws FileSystemException { + if (tempFileStore == null) { throw new FileSystemException("vfs.impl/no-temp-file-store.error"); } return tempFileStore; @@ -537,8 +476,7 @@ public TemporaryFileStore getTemporaryFileStore() /** * Initializes this manager. *

    - * If no value for the following properties was specified, it will - * use the following defaults: + * If no value for the following properties was specified, it will use the following defaults: *

      *
    • fileContentInfoFactory = new FileContentInfoFilenameFactory()
    • *
    • filesCache = new SoftRefFilesCache()
    • @@ -547,20 +485,16 @@ public TemporaryFileStore getTemporaryFileStore() * * @throws FileSystemException if an error occurs during initialization. */ - public void init() throws FileSystemException - { - if (fileContentInfoFactory == null) - { + public void init() throws FileSystemException { + if (fileContentInfoFactory == null) { fileContentInfoFactory = new FileContentInfoFilenameFactory(); } - if (filesCache == null) - { + if (filesCache == null) { // filesCache = new DefaultFilesCache(); filesCache = new SoftRefFilesCache(); } - if (fileCacheStrategy == null) - { + if (fileCacheStrategy == null) { fileCacheStrategy = CacheStrategy.ON_RESOLVE; } setupComponent(filesCache); @@ -574,16 +508,13 @@ public void init() throws FileSystemException /** * Closes the manager. *

      - * This will close all providers (all files), it will also close - * all managed components including temporary files, replicator, - * file cache and file operations. + * This will close all providers (all files), it will also close all managed components including temporary files, + * replicator, file cache and file operations. *

      * The manager is in uninitialized state after this method. */ - public void close() - { - if (!init) - { + public void close() { + if (!init) { return; } @@ -592,8 +523,7 @@ public void close() // are closed here // Close the file system providers. - for (final FileProvider provider : providers.values()) - { + for (final FileProvider provider : providers.values()) { closeComponent(provider); } // unregister all @@ -607,10 +537,8 @@ public void close() closeComponent(defaultProvider); // FileOperations are components, too - for (final List opproviders : operationProviders.values()) - { - for (final FileOperationProvider p : opproviders) - { + for (final List opproviders : operationProviders.values()) { + for (final FileOperationProvider p : opproviders) { closeComponent(p); } } @@ -621,8 +549,7 @@ public void close() typeMap.clear(); // should not happen, but make debugging easier: - if (!components.isEmpty()) - { + if (!components.isEmpty()) { log.warn("DefaultFilesystemManager.close: not all components are closed: " + components.toString()); } components.clear(); @@ -649,16 +576,13 @@ public void close() /** * Free all resources used by unused filesystems created by this manager. */ - public void freeUnusedResources() - { - if (!init) - { + public void freeUnusedResources() { + if (!init) { return; } // Close the providers. - for (final FileProvider fileProvider : providers.values()) - { + for (final FileProvider fileProvider : providers.values()) { final AbstractFileProvider provider = (AbstractFileProvider) fileProvider; provider.freeUnusedResources(); } @@ -667,50 +591,50 @@ public void freeUnusedResources() /** * Sets the base file to use when resolving relative URI. + * * @param baseFile The new base FileObject. * @throws FileSystemException if an error occurs. */ - public void setBaseFile(final FileObject baseFile) - throws FileSystemException - { + public void setBaseFile(final FileObject baseFile) throws FileSystemException { this.baseFile = baseFile; } /** * Sets the base file to use when resolving relative URI. + * * @param baseFile The new base FileObject. * @throws FileSystemException if an error occurs. */ - public void setBaseFile(final File baseFile) throws FileSystemException - { + public void setBaseFile(final File baseFile) throws FileSystemException { this.baseFile = getLocalFileProvider().findLocalFile(baseFile); } /** * Returns the base file used to resolve relative URI. + * * @return The FileObject that represents the base file. * @throws FileSystemException if an error occurs. */ @Override - public FileObject getBaseFile() throws FileSystemException - { + public FileObject getBaseFile() throws FileSystemException { return baseFile; } /** * Locates a file by URI. + * * @param uri The URI of the file to locate. * @return The FileObject for the located file. * @throws FileSystemException if the file cannot be located or an error occurs. */ @Override - public FileObject resolveFile(final String uri) throws FileSystemException - { + public FileObject resolveFile(final String uri) throws FileSystemException { return resolveFile(getBaseFile(), uri); } /** * Locate a file by URI, use the FileSystemOptions for file-system creation. + * * @param uri The URI of the file to locate. * @param fileSystemOptions The options for the FileSystem. * @return The FileObject for the located file. @@ -718,10 +642,8 @@ public FileObject resolveFile(final String uri) throws FileSystemException */ @Override - public FileObject resolveFile(final String uri, - final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + public FileObject resolveFile(final String uri, final FileSystemOptions fileSystemOptions) + throws FileSystemException { // return resolveFile(baseFile, uri, fileSystemOptions); return resolveFile(getBaseFile(), uri, fileSystemOptions); } @@ -729,8 +651,7 @@ public FileObject resolveFile(final String uri, /** * Resolves a URI, relative to base file. *

      - * Uses the {@linkplain #getLocalFileProvider() local file provider} to - * locate the system file. + * Uses the {@linkplain #getLocalFileProvider() local file provider} to locate the system file. * * @param baseFile The base File to use to locate the file. * @param uri The URI of the file to locate. @@ -738,32 +659,27 @@ public FileObject resolveFile(final String uri, * @throws FileSystemException if the file cannot be located or an error occurs. */ @Override - public FileObject resolveFile(final File baseFile, final String uri) - throws FileSystemException - { - final FileObject baseFileObj = getLocalFileProvider().findLocalFile( - baseFile); + public FileObject resolveFile(final File baseFile, final String uri) throws FileSystemException { + final FileObject baseFileObj = getLocalFileProvider().findLocalFile(baseFile); return resolveFile(baseFileObj, uri); } /** * Resolves a URI, relative to a base file. + * * @param baseFile The base FileOjbect to use to locate the file. * @param uri The URI of the file to locate. * @return The FileObject for the located file. * @throws FileSystemException if the file cannot be located or an error occurs. */ @Override - public FileObject resolveFile(final FileObject baseFile, final String uri) - throws FileSystemException - { - return resolveFile(baseFile, uri, baseFile == null ? null : baseFile - .getFileSystem().getFileSystemOptions()); + public FileObject resolveFile(final FileObject baseFile, final String uri) throws FileSystemException { + return resolveFile(baseFile, uri, baseFile == null ? null : baseFile.getFileSystem().getFileSystemOptions()); } /** - * Resolves a URI, relative to a base file with specified FileSystem - * configuration. + * Resolves a URI, relative to a base file with specified FileSystem configuration. + * * @param baseFile The base file. * @param uri The file name. May be a fully qualified or relative path or a url. * @param fileSystemOptions Options to pass to the file system. @@ -771,61 +687,47 @@ public FileObject resolveFile(final FileObject baseFile, final String uri) * @throws FileSystemException if an error occurs accessing the file. */ public FileObject resolveFile(final FileObject baseFile, final String uri, - final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + final FileSystemOptions fileSystemOptions) throws FileSystemException { final FileObject realBaseFile; - if (baseFile != null && VFS.isUriStyle() - && baseFile.getName().isFile()) - { + if (baseFile != null && VFS.isUriStyle() && baseFile.getName().isFile()) { realBaseFile = baseFile.getParent(); - } - else - { + } else { realBaseFile = baseFile; } // TODO: use resolveName and use this name to resolve the fileObject UriParser.checkUriEncoding(uri); - if (uri == null) - { + if (uri == null) { throw new IllegalArgumentException(); } // Extract the scheme final String scheme = UriParser.extractScheme(uri); - if (scheme != null) - { + if (scheme != null) { // An absolute URI - locate the provider final FileProvider provider = providers.get(scheme); - if (provider != null) - { + if (provider != null) { return provider.findFile(realBaseFile, uri, fileSystemOptions); } // Otherwise, assume a local file } // Handle absolute file names - if (localFileProvider != null - && localFileProvider.isAbsoluteLocalName(uri)) - { + if (localFileProvider != null && localFileProvider.isAbsoluteLocalName(uri)) { return localFileProvider.findLocalFile(uri); } - if (scheme != null) - { + if (scheme != null) { // An unknown scheme - hand it to the default provider - if (defaultProvider == null) - { + if (defaultProvider == null) { throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme, uri); } return defaultProvider.findFile(realBaseFile, uri, fileSystemOptions); } // Assume a relative name - use the supplied base file - if (realBaseFile == null) - { + if (realBaseFile == null) { throw new FileSystemException("vfs.impl/find-rel-file.error", uri); } @@ -833,19 +735,17 @@ public FileObject resolveFile(final FileObject baseFile, final String uri, } /** - * Resolves a name, relative to the file. If the supplied name is an - * absolute path, then it is resolved relative to the root of the file - * system that the file belongs to. If a relative name is supplied, then it - * is resolved relative to this file name. + * Resolves a name, relative to the file. If the supplied name is an absolute path, then it is resolved relative to + * the root of the file system that the file belongs to. If a relative name is supplied, then it is resolved + * relative to this file name. + * * @param root The base FileName. * @param path The path to the file relative to the base FileName or an absolute path. * @return The constructed FileName. * @throws FileSystemException if an error occurs constructing the FileName. */ @Override - public FileName resolveName(final FileName root, final String path) - throws FileSystemException - { + public FileName resolveName(final FileName root, final String path) throws FileSystemException { return resolveName(root, path, NameScope.FILE_SYSTEM); } @@ -859,16 +759,15 @@ public FileName resolveName(final FileName root, final String path) * @throws FileSystemException if an error occurs. */ @Override - public FileName resolveName(final FileName base, final String name, - final NameScope scope) throws FileSystemException - { + public FileName resolveName(final FileName base, final String name, final NameScope scope) + throws FileSystemException { + if (base == null) { + throw new FileSystemException("Invalid base filename."); + } final FileName realBase; - if (base != null && VFS.isUriStyle() && base.isFile()) - { + if (VFS.isUriStyle() && base.isFile()) { realBase = base.getParent(); - } - else - { + } else { realBase = base; } @@ -879,11 +778,9 @@ public FileName resolveName(final FileName base, final String name, String scheme = UriParser.extractScheme(buffer.toString()); // Determine whether to prepend the base path - if (name.length() == 0 || (scheme == null && buffer.charAt(0) != FileName.SEPARATOR_CHAR)) - { + if (name.length() == 0 || (scheme == null && buffer.charAt(0) != FileName.SEPARATOR_CHAR)) { // Supplied path is not absolute - if (!VFS.isUriStyle()) - { + if (!VFS.isUriStyle()) { // when using uris the parent already do have the trailing "/" buffer.insert(0, FileName.SEPARATOR_CHAR); } @@ -895,26 +792,19 @@ public FileName resolveName(final FileName base, final String name, // Check the name is ok final String resolvedPath = buffer.toString(); - if (!AbstractFileName - .checkName(realBase.getPath(), resolvedPath, scope)) - { - throw new FileSystemException( - "vfs.provider/invalid-descendent-name.error", name); + if (!AbstractFileName.checkName(realBase.getPath(), resolvedPath, scope)) { + throw new FileSystemException("vfs.provider/invalid-descendent-name.error", name); } String fullPath; - if (scheme != null) - { + if (scheme != null) { fullPath = resolvedPath; - } - else - { + } else { scheme = realBase.getScheme(); fullPath = realBase.getRootURI() + resolvedPath; } final FileProvider provider = providers.get(scheme); - if (provider != null) - { + if (provider != null) { // TODO: extend the filename parser to be able to parse // only a pathname and take the missing informations from // the base. Then we can get rid of the string operation. @@ -925,8 +815,7 @@ public FileName resolveName(final FileName base, final String name, } // An unknown scheme - hand it to the default provider - if possible - if (scheme != null && defaultProvider != null) - { + if (scheme != null && defaultProvider != null) { return defaultProvider.parseUri(realBase, fullPath); } @@ -937,28 +826,25 @@ public FileName resolveName(final FileName base, final String name, /** * Resolve the uri to a filename. + * * @param uri The URI to resolve. * @return The FileName of the file. * @throws FileSystemException if an error occurs. */ @Override - public FileName resolveURI(final String uri) throws FileSystemException - { + public FileName resolveURI(final String uri) throws FileSystemException { UriParser.checkUriEncoding(uri); - if (uri == null) - { + if (uri == null) { throw new IllegalArgumentException(); } // Extract the scheme final String scheme = UriParser.extractScheme(uri); - if (scheme != null) - { + if (scheme != null) { // An absolute URI - locate the provider final FileProvider provider = providers.get(scheme); - if (provider != null) - { + if (provider != null) { return provider.parseUri(null, uri); } @@ -966,25 +852,20 @@ public FileName resolveURI(final String uri) throws FileSystemException } // Handle absolute file names - if (localFileProvider != null - && localFileProvider.isAbsoluteLocalName(uri)) - { + if (localFileProvider != null && localFileProvider.isAbsoluteLocalName(uri)) { return localFileProvider.parseUri(null, uri); } - if (scheme != null) - { + if (scheme != null) { // An unknown scheme - hand it to the default provider - if (defaultProvider == null) - { + if (defaultProvider == null) { throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme, uri); } return defaultProvider.parseUri(null, uri); } // Assume a relative name - use the supplied base file - if (baseFile == null) - { + if (baseFile == null) { throw new FileSystemException("vfs.impl/find-rel-file.error", uri); } @@ -993,30 +874,28 @@ public FileName resolveURI(final String uri) throws FileSystemException /** * Converts a local file into a {@link FileObject}. + * * @param file The input File. * @return the create FileObject * @throws FileSystemException if an error occurs creating the file. */ @Override - public FileObject toFileObject(final File file) throws FileSystemException - { + public FileObject toFileObject(final File file) throws FileSystemException { return getLocalFileProvider().findLocalFile(file); } /** * Creates a layered file system. + * * @param scheme The scheme to use. * @param file The FileObject. * @return The layered FileObject. * @throws FileSystemException if an error occurs. */ @Override - public FileObject createFileSystem(final String scheme, - final FileObject file) throws FileSystemException - { + public FileObject createFileSystem(final String scheme, final FileObject file) throws FileSystemException { final FileProvider provider = providers.get(scheme); - if (provider == null) - { + if (provider == null) { throw new FileSystemException("vfs.impl/unknown-provider.error", scheme, file); } return provider.createFileSystem(scheme, file, file.getFileSystem().getFileSystemOptions()); @@ -1024,19 +903,16 @@ public FileObject createFileSystem(final String scheme, /** * Creates a layered file system. + * * @param file The FileObject to use. * @return The layered FileObject. * @throws FileSystemException if an error occurs. */ @Override - public FileObject createFileSystem(final FileObject file) - throws FileSystemException - { + public FileObject createFileSystem(final FileObject file) throws FileSystemException { final String scheme = typeMap.getScheme(file); - if (scheme == null) - { - throw new FileSystemException( - "vfs.impl/no-provider-for-file.error", file); + if (scheme == null) { + throw new FileSystemException("vfs.impl/no-provider-for-file.error", file); } return createFileSystem(scheme, file); @@ -1050,65 +926,57 @@ public FileObject createFileSystem(final FileObject file) * @throws FileSystemException if an error occurs. */ @Override - public boolean canCreateFileSystem(final FileObject file) - throws FileSystemException - { + public boolean canCreateFileSystem(final FileObject file) throws FileSystemException { return typeMap.getScheme(file) != null; } /** * Creates a virtual file system. + * * @param rootFile The FileObject to use. * @return The FileObject in the VirtualFileSystem. * @throws FileSystemException if an error occurs creating the file. */ @Override - public FileObject createVirtualFileSystem(final FileObject rootFile) - throws FileSystemException - { + public FileObject createVirtualFileSystem(final FileObject rootFile) throws FileSystemException { return vfsProvider.createFileSystem(rootFile); } /** * Creates an empty virtual file system. + * * @param rootUri The URI to use as the root of the FileSystem. * @return A FileObject in the virtual FileSystem. * @throws FileSystemException if an error occurs. */ @Override - public FileObject createVirtualFileSystem(final String rootUri) - throws FileSystemException - { + public FileObject createVirtualFileSystem(final String rootUri) throws FileSystemException { return vfsProvider.createFileSystem(rootUri); } /** * Locates the local file provider. *

      - * The local file provider is the first - * {@linkplain #addProvider(String[], FileProvider) provider added} + * The local file provider is the first {@linkplain #addProvider(String[], FileProvider) provider added} * implementing {@link LocalFileProvider}. * * @return The LocalFileProvider. * @throws FileSystemException if no local file provider was set. */ - private LocalFileProvider getLocalFileProvider() throws FileSystemException - { - if (localFileProvider == null) - { - throw new FileSystemException( - "vfs.impl/no-local-file-provider.error"); + private LocalFileProvider getLocalFileProvider() throws FileSystemException { + if (localFileProvider == null) { + throw new FileSystemException("vfs.impl/no-local-file-provider.error"); } return localFileProvider; } /** * Get the URLStreamHandlerFactory. + * * @return The URLStreamHandlerFactory. */ @Override - public URLStreamHandlerFactory getURLStreamHandlerFactory() - { + public URLStreamHandlerFactory getURLStreamHandlerFactory() { return new VfsStreamHandlerFactory(); } @@ -1120,8 +988,7 @@ public URLStreamHandlerFactory getURLStreamHandlerFactory() * @param filesystem The FileSystem to close. */ @Override - public void closeFileSystem(final FileSystem filesystem) - { + public void closeFileSystem(final FileSystem filesystem) { // inform the cache ... getFilesCache().clear(filesystem); @@ -1137,32 +1004,24 @@ public void closeFileSystem(final FileSystem filesystem) * * @param filesystem The FileSystem to close. */ - public void _closeFileSystem(final FileSystem filesystem) - { + public void _closeFileSystem(final FileSystem filesystem) { final FileProvider provider = providers.get(filesystem.getRootName().getScheme()); - if (provider != null) - { + if (provider != null) { ((AbstractFileProvider) provider).closeFileSystem(filesystem); - } - else if (filesystem instanceof VirtualFileSystem) - { + } else if (filesystem instanceof VirtualFileSystem) { // vfsProvider does not implement AbstractFileProvider vfsProvider.closeFileSystem(filesystem); } } /** - * This is an internal class because it needs access to the private member - * providers. + * This is an internal class because it needs access to the private member providers. */ - final class VfsStreamHandlerFactory implements URLStreamHandlerFactory - { + final class VfsStreamHandlerFactory implements URLStreamHandlerFactory { @Override - public URLStreamHandler createURLStreamHandler(final String protocol) - { + public URLStreamHandler createURLStreamHandler(final String protocol) { final FileProvider provider = providers.get(protocol); - if (provider != null) - { + if (provider != null) { return new DefaultURLStreamHandler(context); } @@ -1173,11 +1032,11 @@ public URLStreamHandler createURLStreamHandler(final String protocol) /** * Get the schemes currently available. + * * @return The array of scheme names. */ @Override - public String[] getSchemes() - { + public String[] getSchemes() { final String[] schemes = new String[providers.size()]; providers.keySet().toArray(schemes); return schemes; @@ -1191,12 +1050,9 @@ public String[] getSchemes() * @throws FileSystemException if the given scheme is not konwn */ @Override - public Collection getProviderCapabilities(final String scheme) - throws FileSystemException - { + public Collection getProviderCapabilities(final String scheme) throws FileSystemException { final FileProvider provider = providers.get(scheme); - if (provider == null) - { + if (provider == null) { throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme); } @@ -1205,17 +1061,15 @@ public Collection getProviderCapabilities(final String scheme) /** * Get the configuration builder for the given scheme. + * * @param scheme The scheme to locate. * @return The FileSystemConfigBuilder for the scheme. * @throws FileSystemException if the given scheme is not konwn */ @Override - public FileSystemConfigBuilder getFileSystemConfigBuilder(final String scheme) - throws FileSystemException - { + public FileSystemConfigBuilder getFileSystemConfigBuilder(final String scheme) throws FileSystemException { final FileProvider provider = providers.get(scheme); - if (provider == null) - { + if (provider == null) { throw new FileSystemException("vfs.impl/unknown-scheme.error", scheme); } @@ -1225,9 +1079,8 @@ public FileSystemConfigBuilder getFileSystemConfigBuilder(final String scheme) // -- OPERATIONS -- /** - * Adds the specified FileOperationProvider for the specified scheme. - * Several FileOperationProvider's might be registered for the same scheme. - * For example, for "file" scheme we can register SvnWsOperationProvider and + * Adds the specified FileOperationProvider for the specified scheme. Several FileOperationProvider's might be + * registered for the same scheme. For example, for "file" scheme we can register SvnWsOperationProvider and * CvsOperationProvider. * * @param scheme The scheme the provider should be registered for. @@ -1235,40 +1088,31 @@ public FileSystemConfigBuilder getFileSystemConfigBuilder(final String scheme) * @throws FileSystemException if an error occurs adding the provider. */ @Override - public void addOperationProvider(final String scheme, - final FileOperationProvider operationProvider) - throws FileSystemException - { - addOperationProvider(new String[] {scheme}, operationProvider); + public void addOperationProvider(final String scheme, final FileOperationProvider operationProvider) + throws FileSystemException { + addOperationProvider(new String[] { scheme }, operationProvider); } /** - * @see FileSystemManager#addOperationProvider(String, - * org.apache.commons.vfs2.operations.FileOperationProvider) + * @see FileSystemManager#addOperationProvider(String, org.apache.commons.vfs2.operations.FileOperationProvider) * * @param schemes The array of schemes the provider should apply to. * @param operationProvider The FileOperationProvider. * @throws FileSystemException if an error occurs. */ @Override - public void addOperationProvider(final String[] schemes, - final FileOperationProvider operationProvider) - throws FileSystemException - { - for (final String scheme : schemes) - { - if (!operationProviders.containsKey(scheme)) - { + public void addOperationProvider(final String[] schemes, final FileOperationProvider operationProvider) + throws FileSystemException { + for (final String scheme : schemes) { + if (!operationProviders.containsKey(scheme)) { final List providers = new ArrayList<>(); operationProviders.put(scheme, providers); } final List providers = operationProviders.get(scheme); - if (providers.contains(operationProvider)) - { - throw new FileSystemException( - "vfs.operation/operation-provider-already-added.error", scheme); + if (providers.contains(operationProvider)) { + throw new FileSystemException("vfs.operation/operation-provider-already-added.error", scheme); } setupComponent(operationProvider); @@ -1278,24 +1122,18 @@ public void addOperationProvider(final String[] schemes, } /** - * @param scheme - * the scheme for wich we want to get the list af registered - * providers. + * @param scheme the scheme for wich we want to get the list af registered providers. * - * @return the registered FileOperationProviders for the specified scheme. - * If there were no providers registered for the scheme, it returns - * null. + * @return the registered FileOperationProviders for the specified scheme. If there were no providers registered for + * the scheme, it returns null. * * @throws FileSystemException if an error occurs. */ @Override - public FileOperationProvider[] getOperationProviders(final String scheme) - throws FileSystemException - { + public FileOperationProvider[] getOperationProviders(final String scheme) throws FileSystemException { final List providers = operationProviders.get(scheme); - if (providers == null || providers.size() == 0) - { + if (providers == null || providers.size() == 0) { return null; } return providers.toArray(new FileOperationProvider[] {}); @@ -1305,14 +1143,12 @@ public FileOperationProvider[] getOperationProviders(final String scheme) * Converts a URI into a {@link FileObject}. * * @param uri The URI to convert. - * @return The {@link FileObject} that represents the URI. Never - * returns null. + * @return The {@link FileObject} that represents the URI. Never returns null. * @throws FileSystemException On error converting the URI. * @since 2.1 */ @Override - public FileObject resolveFile(final URI uri) throws FileSystemException - { + public FileObject resolveFile(final URI uri) throws FileSystemException { // TODO Push the URI deeper into VFS return resolveFile(baseFile, uri.toString(), null); } @@ -1321,20 +1157,15 @@ public FileObject resolveFile(final URI uri) throws FileSystemException * Converts a URL into a {@link FileObject}. * * @param url The URL to convert. - * @return The {@link FileObject} that represents the URL. Never - * returns null. + * @return The {@link FileObject} that represents the URL. Never returns null. * @throws FileSystemException On error converting the URL. * @since 2.1 */ @Override - public FileObject resolveFile(final URL url) throws FileSystemException - { - try - { + public FileObject resolveFile(final URL url) throws FileSystemException { + try { return this.resolveFile(url.toURI()); - } - catch (final URISyntaxException e) - { + } catch (final URISyntaxException e) { throw new FileSystemException(e); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultProviderConfiguration.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultProviderConfiguration.java similarity index 95% rename from core/src/main/java/org/apache/commons/vfs2/impl/DefaultProviderConfiguration.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultProviderConfiguration.java index 068b8a2839..810ad137e2 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultProviderConfiguration.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultProviderConfiguration.java @@ -16,15 +16,12 @@ */ package org.apache.commons.vfs2.impl; - /** * Same as {@link ProviderConfiguration} but for the default provider. */ -public class DefaultProviderConfiguration extends ProviderConfiguration -{ +public class DefaultProviderConfiguration extends ProviderConfiguration { @Override - public boolean isDefault() - { + public boolean isDefault() { return true; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultVfsComponentContext.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultVfsComponentContext.java similarity index 85% rename from core/src/main/java/org/apache/commons/vfs2/impl/DefaultVfsComponentContext.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultVfsComponentContext.java index 9aed70ca98..a00ef3bcbe 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/DefaultVfsComponentContext.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultVfsComponentContext.java @@ -27,17 +27,13 @@ import org.apache.commons.vfs2.provider.TemporaryFileStore; import org.apache.commons.vfs2.provider.VfsComponentContext; - /** * The default context implementation. */ -final class DefaultVfsComponentContext - implements VfsComponentContext -{ +final class DefaultVfsComponentContext implements VfsComponentContext { private final DefaultFileSystemManager manager; - public DefaultVfsComponentContext(final DefaultFileSystemManager manager) - { + public DefaultVfsComponentContext(final DefaultFileSystemManager manager) { this.manager = manager; } @@ -46,9 +42,7 @@ public DefaultVfsComponentContext(final DefaultFileSystemManager manager) */ @Override public FileObject resolveFile(final FileObject baseFile, final String name, - final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + final FileSystemOptions fileSystemOptions) throws FileSystemException { return manager.resolveFile(baseFile, name, fileSystemOptions); } @@ -57,14 +51,12 @@ public FileObject resolveFile(final FileObject baseFile, final String name, */ @Override public FileObject resolveFile(final String name, final FileSystemOptions fileSystemOptions) - throws FileSystemException - { + throws FileSystemException { return manager.resolveFile(name, fileSystemOptions); } @Override - public FileName parseURI(final String uri) throws FileSystemException - { + public FileName parseURI(final String uri) throws FileSystemException { return manager.resolveURI(uri); } @@ -72,9 +64,7 @@ public FileName parseURI(final String uri) throws FileSystemException * Returns a {@link FileObject} for a local file. */ @Override - public FileObject toFileObject(final File file) - throws FileSystemException - { + public FileObject toFileObject(final File file) throws FileSystemException { return manager.toFileObject(file); } @@ -82,8 +72,7 @@ public FileObject toFileObject(final File file) * Locates a file replicator for the provider to use. */ @Override - public FileReplicator getReplicator() throws FileSystemException - { + public FileReplicator getReplicator() throws FileSystemException { return manager.getReplicator(); } @@ -91,8 +80,7 @@ public FileReplicator getReplicator() throws FileSystemException * Locates a temporary file store for the provider to use. */ @Override - public TemporaryFileStore getTemporaryFileStore() throws FileSystemException - { + public TemporaryFileStore getTemporaryFileStore() throws FileSystemException { return manager.getTemporaryFileStore(); } @@ -102,8 +90,7 @@ public TemporaryFileStore getTemporaryFileStore() throws FileSystemException * @return the filesystem manager */ @Override - public FileSystemManager getFileSystemManager() - { + public FileSystemManager getFileSystemManager() { return manager; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/FileContentInfoFilenameFactory.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/FileContentInfoFilenameFactory.java similarity index 90% rename from core/src/main/java/org/apache/commons/vfs2/impl/FileContentInfoFilenameFactory.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/FileContentInfoFilenameFactory.java index 977a253c54..2a4bbab732 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/FileContentInfoFilenameFactory.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/FileContentInfoFilenameFactory.java @@ -26,19 +26,15 @@ /** * The FileContentInfoFilenameFactory. *

      - * Uses the filename extension to determine the content-type. - * The content-encoding is not resolved. + * Uses the filename extension to determine the content-type. The content-encoding is not resolved. */ -public class FileContentInfoFilenameFactory implements FileContentInfoFactory -{ +public class FileContentInfoFilenameFactory implements FileContentInfoFactory { @Override - public FileContentInfo create(final FileContent fileContent) - { + public FileContentInfo create(final FileContent fileContent) { String contentType = null; final String name = fileContent.getFile().getName().getBaseName(); - if (name != null) - { + if (name != null) { final FileNameMap fileNameMap = URLConnection.getFileNameMap(); contentType = fileNameMap.getContentTypeFor(name); } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/FileTypeMap.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/FileTypeMap.java similarity index 93% rename from core/src/main/java/org/apache/commons/vfs2/impl/FileTypeMap.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/FileTypeMap.java index 7474fd09e1..10b7665bda 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/FileTypeMap.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/FileTypeMap.java @@ -26,24 +26,21 @@ /** * A helper class that determines the provider to use for a file. */ -class FileTypeMap -{ +class FileTypeMap { private final Map mimeTypeMap = new HashMap<>(); private final Map extensionMap = new HashMap<>(); /** * Adds a MIME type mapping. */ - public void addMimeType(final String mimeType, final String scheme) - { + public void addMimeType(final String mimeType, final String scheme) { mimeTypeMap.put(mimeType, scheme); } /** * Adds a filename extension mapping. */ - public void addExtension(final String extension, final String scheme) - { + public void addExtension(final String extension, final String scheme) { extensionMap.put(extension, scheme); } @@ -51,21 +48,19 @@ public void addExtension(final String extension, final String scheme) * Find the scheme for the provider of a layered file system. *

      * This will check the FileContentInfo or file extension. + * * @return Scheme supporting the file type or null (if unknonw). */ - public String getScheme(final FileObject file) throws FileSystemException - { + public String getScheme(final FileObject file) throws FileSystemException { // Check the file's mime type for a match final FileContent content = file.getContent(); final String mimeType = content.getContentInfo().getContentType(); - if (mimeType != null) - { + if (mimeType != null) { return mimeTypeMap.get(mimeType); } // no specific mime-type - if it is a file also check the extension - if (!file.isFile()) - { + if (!file.isFile()) { return null; // VFS-490 folders don't use extensions for mime-type } final String extension = file.getName().getExtension(); @@ -75,8 +70,7 @@ public String getScheme(final FileObject file) throws FileSystemException /** * Removes all extensions and scheme mappings. */ - public void clear() - { + public void clear() { mimeTypeMap.clear(); extensionMap.clear(); } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java similarity index 77% rename from core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java index d47cd86139..4ad6a6c6a9 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/PrivilegedFileReplicator.java @@ -31,24 +31,17 @@ import org.apache.commons.vfs2.provider.VfsComponentContext; /** - * A file replicator that wraps another file replicator, performing - * the replication as a privileged action. + * A file replicator that wraps another file replicator, performing the replication as a privileged action. */ -public class PrivilegedFileReplicator - implements FileReplicator, VfsComponent -{ +public class PrivilegedFileReplicator implements FileReplicator, VfsComponent { private final FileReplicator replicator; private final VfsComponent replicatorComponent; - public PrivilegedFileReplicator(final FileReplicator replicator) - { + public PrivilegedFileReplicator(final FileReplicator replicator) { this.replicator = replicator; - if (replicator instanceof VfsComponent) - { + if (replicator instanceof VfsComponent) { replicatorComponent = (VfsComponent) replicator; - } - else - { + } else { replicatorComponent = null; } } @@ -59,10 +52,8 @@ public PrivilegedFileReplicator(final FileReplicator replicator) * @param logger The logger. */ @Override - public void setLogger(final Log logger) - { - if (replicatorComponent != null) - { + public void setLogger(final Log logger) { + if (replicatorComponent != null) { replicatorComponent.setLogger(logger); } } @@ -73,10 +64,8 @@ public void setLogger(final Log logger) * @param context The component context. */ @Override - public void setContext(final VfsComponentContext context) - { - if (replicatorComponent != null) - { + public void setContext(final VfsComponentContext context) { + if (replicatorComponent != null) { replicatorComponent.setContext(context); } } @@ -87,16 +76,11 @@ public void setContext(final VfsComponentContext context) * @throws FileSystemException if an error occurs. */ @Override - public void init() throws FileSystemException - { - if (replicatorComponent != null) - { - try - { + public void init() throws FileSystemException { + if (replicatorComponent != null) { + try { AccessController.doPrivileged(new InitAction()); - } - catch (final PrivilegedActionException e) - { + } catch (final PrivilegedActionException e) { throw new FileSystemException("vfs.impl/init-replicator.error", e); } } @@ -106,10 +90,8 @@ public void init() throws FileSystemException * Closes the replicator. */ @Override - public void close() - { - if (replicatorComponent != null) - { + public void close() { + if (replicatorComponent != null) { AccessController.doPrivileged(new CloseAction()); } } @@ -123,16 +105,11 @@ public void close() * @throws FileSystemException if an error occurs. */ @Override - public File replicateFile(final FileObject srcFile, final FileSelector selector) - throws FileSystemException - { - try - { + public File replicateFile(final FileObject srcFile, final FileSelector selector) throws FileSystemException { + try { final ReplicateAction action = new ReplicateAction(srcFile, selector); return AccessController.doPrivileged(action); - } - catch (final PrivilegedActionException e) - { + } catch (final PrivilegedActionException e) { throw new FileSystemException("vfs.impl/replicate-file.error", e, srcFile.getName()); } } @@ -140,14 +117,12 @@ public File replicateFile(final FileObject srcFile, final FileSelector selector) /** * An action that initialises the wrapped replicator. */ - private class InitAction implements PrivilegedExceptionAction - { + private class InitAction implements PrivilegedExceptionAction { /** * Performs the action. */ @Override - public Object run() throws Exception - { + public Object run() throws Exception { replicatorComponent.init(); return null; } @@ -156,26 +131,23 @@ public Object run() throws Exception /** * An action that replicates a file using the wrapped replicator. */ - private class ReplicateAction implements PrivilegedExceptionAction - { + private class ReplicateAction implements PrivilegedExceptionAction { private final FileObject srcFile; private final FileSelector selector; - public ReplicateAction(final FileObject srcFile, - final FileSelector selector) - { + public ReplicateAction(final FileObject srcFile, final FileSelector selector) { this.srcFile = srcFile; this.selector = selector; } /** * Performs the action. + * * @throws Exception if an error occurs. */ @Override - public File run() throws Exception - { - // TODO - Do not pass the selector through. It is untrusted + public File run() throws Exception { + // TODO - Do not pass the selector through. It is untrusted // TODO - Need to determine which files can be read return replicator.replicateFile(srcFile, selector); } @@ -184,14 +156,12 @@ public File run() throws Exception /** * An action that closes the wrapped replicator. */ - private class CloseAction implements PrivilegedAction - { + private class CloseAction implements PrivilegedAction { /** * Performs the action. */ @Override - public Object run() - { + public Object run() { replicatorComponent.close(); return null; } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java similarity index 77% rename from core/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java index e91ddae188..6170db0bb4 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/ProviderConfiguration.java @@ -24,48 +24,39 @@ *

      * Used by digester in StandardFileSystemManager */ -public class ProviderConfiguration -{ +public class ProviderConfiguration { private String className; private final List schemes = new ArrayList<>(10); private final List dependenies = new ArrayList<>(10); - public ProviderConfiguration() - { + public ProviderConfiguration() { } - public String getClassName() - { + public String getClassName() { return className; } - public void setClassName(final String className) - { + public void setClassName(final String className) { this.className = className; } - public void setScheme(final String scheme) - { + public void setScheme(final String scheme) { schemes.add(scheme); } - public List getSchemes() - { + public List getSchemes() { return schemes; } - public void setDependency(final String dependency) - { + public void setDependency(final String dependency) { dependenies.add(dependency); } - public List getDependencies() - { + public List getDependencies() { return dependenies; } - public boolean isDefault() - { + public boolean isDefault() { return false; } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/Resource.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/Resource.java similarity index 77% rename from core/src/main/java/org/apache/commons/vfs2/impl/Resource.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/Resource.java index 6e3ea16c50..401d340920 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/Resource.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/Resource.java @@ -25,13 +25,11 @@ import org.apache.commons.vfs2.FileUtil; /** - * Helper class for VFSClassLoader. - * This represents a resource loaded with the classloader. + * Helper class for VFSClassLoader. This represents a resource loaded with the classloader. * * @see VFSClassLoader */ -class Resource -{ +class Resource { private final FileObject root; private final FileObject resource; private final FileObject packageFolder; @@ -40,24 +38,17 @@ class Resource /** * Creates a new instance. * - * @param root The code source FileObject. + * @param root The code source FileObject. * @param resource The resource of the FileObject. */ - public Resource(final String name, - final FileObject root, - final FileObject resource) - throws FileSystemException - { + public Resource(final String name, final FileObject root, final FileObject resource) throws FileSystemException { this.root = root; this.resource = resource; packageFolder = resource.getParent(); final int pos = name.lastIndexOf('/'); - if (pos == -1) - { + if (pos == -1) { packageName = null; - } - else - { + } else { packageName = name.substring(0, pos).replace('/', '.'); } } @@ -65,56 +56,49 @@ public Resource(final String name, /** * Returns the URL of the resource. */ - public URL getURL() throws FileSystemException - { + public URL getURL() throws FileSystemException { return resource.getURL(); } /** * Returns the name of the package containing the resource. */ - public String getPackageName() - { + public String getPackageName() { return packageName; } /** * Returns an attribute of the package containing the resource. */ - public String getPackageAttribute(final Attributes.Name attrName) throws FileSystemException - { + public String getPackageAttribute(final Attributes.Name attrName) throws FileSystemException { return (String) packageFolder.getContent().getAttribute(attrName.toString()); } /** * Returns the folder for the package containing the resource. */ - public FileObject getPackageFolder() - { + public FileObject getPackageFolder() { return packageFolder; } /** * Returns the FileObject of the resource. */ - public FileObject getFileObject() - { + public FileObject getFileObject() { return resource; } /** * Returns the code source as an URL. */ - public URL getCodeSourceURL() throws FileSystemException - { + public URL getCodeSourceURL() throws FileSystemException { return root.getURL(); } /** * Returns the data for this resource as a byte array. */ - public byte[] getBytes() throws IOException - { + public byte[] getBytes() throws IOException { return FileUtil.getContent(resource); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java similarity index 76% rename from core/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java index bef72f8de5..d1058ce14b 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/StandardFileSystemManager.java @@ -36,16 +36,13 @@ import org.w3c.dom.NodeList; /** - * A {@link org.apache.commons.vfs2.FileSystemManager} that configures itself - * from an XML (Default: providers.xml) configuration file. + * A {@link org.apache.commons.vfs2.FileSystemManager} that configures itself from an XML (Default: providers.xml) + * configuration file. *

      - * Certain providers are only loaded and available if the dependent library is in your - * classpath. You have to configure your debugging facility to log "debug" messages to see - * if a provider was skipped due to "unresolved externals". + * Certain providers are only loaded and available if the dependent library is in your classpath. You have to configure + * your debugging facility to log "debug" messages to see if a provider was skipped due to "unresolved externals". */ -public class StandardFileSystemManager - extends DefaultFileSystemManager -{ +public class StandardFileSystemManager extends DefaultFileSystemManager { private static final String CONFIG_RESOURCE = "providers.xml"; private static final String PLUGIN_CONFIG_RESOURCE = "META-INF/vfs-providers.xml"; @@ -57,14 +54,10 @@ public class StandardFileSystemManager * * @param configUri The URI for this manager. */ - public void setConfiguration(final String configUri) - { - try - { + public void setConfiguration(final String configUri) { + try { setConfiguration(new URL(configUri)); - } - catch (final MalformedURLException e) - { + } catch (final MalformedURLException e) { getLogger().warn(e.getLocalizedMessage(), e); } } @@ -74,19 +67,16 @@ public void setConfiguration(final String configUri) * * @param configUri The URI forthis manager. */ - public void setConfiguration(final URL configUri) - { + public void setConfiguration(final URL configUri) { this.configUri = configUri; } /** - * Sets the ClassLoader to use to load the providers. - * Default is to use the ClassLoader that loaded this class. + * Sets the ClassLoader to use to load the providers. Default is to use the ClassLoader that loaded this class. * * @param classLoader The ClassLoader. */ - public void setClassLoader(final ClassLoader classLoader) - { + public void setClassLoader(final ClassLoader classLoader) { this.classLoader = classLoader; } @@ -96,19 +86,16 @@ public void setClassLoader(final ClassLoader classLoader) * @throws FileSystemException if an error occurs. */ @Override - public void init() throws FileSystemException - { + public void init() throws FileSystemException { // Set the replicator and temporary file store (use the same component) final DefaultFileReplicator replicator = createDefaultFileReplicator(); setReplicator(new PrivilegedFileReplicator(replicator)); setTemporaryFileStore(replicator); - if (configUri == null) - { + if (configUri == null) { // Use default config final URL url = getClass().getResource(CONFIG_RESOURCE); - if (url == null) - { + if (url == null) { throw new FileSystemException("vfs.impl/find-config-file.error", CONFIG_RESOURCE); } configUri = url; @@ -128,43 +115,34 @@ public void init() throws FileSystemException * * @throws FileSystemException if an error occurs. */ - protected void configurePlugins() throws FileSystemException - { + protected void configurePlugins() throws FileSystemException { Enumeration enumResources; - try - { + try { enumResources = loadResources(PLUGIN_CONFIG_RESOURCE); - } - catch (final IOException e) - { + } catch (final IOException e) { throw new FileSystemException(e); } - while (enumResources.hasMoreElements()) - { + while (enumResources.hasMoreElements()) { final URL url = enumResources.nextElement(); configure(url); } } - private ClassLoader findClassLoader() - { - if (classLoader != null) - { + private ClassLoader findClassLoader() { + if (classLoader != null) { return classLoader; } ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) - { + if (cl == null) { cl = getClass().getClassLoader(); } return cl; } - protected DefaultFileReplicator createDefaultFileReplicator() - { + protected DefaultFileReplicator createDefaultFileReplicator() { return new DefaultFileReplicator(); } @@ -174,11 +152,9 @@ protected DefaultFileReplicator createDefaultFileReplicator() * @param configUri The URI of the configuration. * @throws FileSystemException if an error occus. */ - private void configure(final URL configUri) throws FileSystemException - { + private void configure(final URL configUri) throws FileSystemException { InputStream configStream = null; - try - { + try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); @@ -186,21 +162,13 @@ private void configure(final URL configUri) throws FileSystemException final Element config = builder.parse(configStream).getDocumentElement(); configure(config); - } - catch (final Exception e) - { + } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri.toString(), e); - } - finally - { - if (configStream != null) - { - try - { + } finally { + if (configStream != null) { + try { configStream.close(); - } - catch (final IOException e) - { + } catch (final IOException e) { getLogger().warn(e.getLocalizedMessage(), e); } } @@ -215,11 +183,8 @@ private void configure(final URL configUri) throws FileSystemException * @throws FileSystemException if an error occurs. */ @SuppressWarnings("unused") - private void configure(final String configUri, final InputStream configStream) - throws FileSystemException - { - try - { + private void configure(final String configUri, final InputStream configStream) throws FileSystemException { + try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); @@ -227,9 +192,7 @@ private void configure(final String configUri, final InputStream configStream) configure(config); - } - catch (final Exception e) - { + } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri, e); } } @@ -240,13 +203,12 @@ private void configure(final String configUri, final InputStream configStream) * @return A DocumentBuilder for the configuration. * @throws ParserConfigurationException if an error occurs. */ - private DocumentBuilder createDocumentBuilder() throws ParserConfigurationException - { + private DocumentBuilder createDocumentBuilder() throws ParserConfigurationException { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringElementContentWhitespace(true); factory.setIgnoringComments(true); factory.setExpandEntityReferences(true); - return factory.newDocumentBuilder(); + return factory.newDocumentBuilder(); } /** @@ -255,45 +217,39 @@ private DocumentBuilder createDocumentBuilder() throws ParserConfigurationExcept * @param config The configuration Element. * @throws FileSystemException if an error occurs. */ - private void configure(final Element config) throws FileSystemException - { + private void configure(final Element config) throws FileSystemException { // Add the providers final NodeList providers = config.getElementsByTagName("provider"); final int count = providers.getLength(); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { final Element provider = (Element) providers.item(i); addProvider(provider, false); } // Add the operation providers final NodeList operationProviders = config.getElementsByTagName("operationProvider"); - for (int i = 0; i < operationProviders.getLength(); i++) - { + for (int i = 0; i < operationProviders.getLength(); i++) { final Element operationProvider = (Element) operationProviders.item(i); addOperationProvider(operationProvider); } // Add the default provider final NodeList defProviders = config.getElementsByTagName("default-provider"); - if (defProviders.getLength() > 0) - { + if (defProviders.getLength() > 0) { final Element provider = (Element) defProviders.item(0); addProvider(provider, true); } // Add the mime-type maps final NodeList mimeTypes = config.getElementsByTagName("mime-type-map"); - for (int i = 0; i < mimeTypes.getLength(); i++) - { + for (int i = 0; i < mimeTypes.getLength(); i++) { final Element map = (Element) mimeTypes.item(i); addMimeTypeMap(map); } // Add the extension maps final NodeList extensions = config.getElementsByTagName("extension-map"); - for (int i = 0; i < extensions.getLength(); i++) - { + for (int i = 0; i < extensions.getLength(); i++) { final Element map = (Element) extensions.item(i); addExtensionMap(map); } @@ -304,12 +260,10 @@ private void configure(final Element config) throws FileSystemException * * @param map containing the Elements. */ - private void addExtensionMap(final Element map) - { + private void addExtensionMap(final Element map) { final String extension = map.getAttribute("extension"); final String scheme = map.getAttribute("scheme"); - if (scheme != null && scheme.length() > 0) - { + if (scheme != null && scheme.length() > 0) { addExtensionMap(extension, scheme); } } @@ -319,8 +273,7 @@ private void addExtensionMap(final Element map) * * @param map containing the Elements. */ - private void addMimeTypeMap(final Element map) - { + private void addMimeTypeMap(final Element map) { final String mimeType = map.getAttribute("mime-type"); final String scheme = map.getAttribute("scheme"); addMimeTypeMap(mimeType, scheme); @@ -333,19 +286,15 @@ private void addMimeTypeMap(final Element map) * @param isDefault true if the default should be used. * @throws FileSystemException if an error occurs. */ - private void addProvider(final Element providerDef, final boolean isDefault) - throws FileSystemException - { + private void addProvider(final Element providerDef, final boolean isDefault) throws FileSystemException { final String classname = providerDef.getAttribute("class-name"); // Make sure all required schemes are available final String[] requiredSchemes = getRequiredSchemes(providerDef); - for (final String requiredScheme : requiredSchemes) - { - if (!hasProvider(requiredScheme)) - { - final String msg = Messages.getString("vfs.impl/skipping-provider-scheme.debug", - classname, requiredScheme); + for (final String requiredScheme : requiredSchemes) { + if (!hasProvider(requiredScheme)) { + final String msg = Messages.getString("vfs.impl/skipping-provider-scheme.debug", classname, + requiredScheme); VfsLog.debug(getLogger(), getLogger(), msg); return; } @@ -353,12 +302,9 @@ private void addProvider(final Element providerDef, final boolean isDefault) // Make sure all required classes are in classpath final String[] requiredClasses = getRequiredClasses(providerDef); - for (final String requiredClass : requiredClasses) - { - if (!findClass(requiredClass)) - { - final String msg = Messages.getString("vfs.impl/skipping-provider.debug", - classname, requiredClass); + for (final String requiredClass : requiredClasses) { + if (!findClass(requiredClass)) { + final String msg = Messages.getString("vfs.impl/skipping-provider.debug", classname, requiredClass); VfsLog.debug(getLogger(), getLogger(), msg); return; } @@ -367,14 +313,12 @@ private void addProvider(final Element providerDef, final boolean isDefault) // Create and register the provider final FileProvider provider = (FileProvider) createInstance(classname); final String[] schemas = getSchemas(providerDef); - if (schemas.length > 0) - { + if (schemas.length > 0) { addProvider(schemas, provider); } // Set as default, if required - if (isDefault) - { + if (isDefault) { setDefaultProvider(provider); } } @@ -382,16 +326,13 @@ private void addProvider(final Element providerDef, final boolean isDefault) /** * Adds a operationProvider from a operationProvider definition. */ - private void addOperationProvider(final Element providerDef) throws FileSystemException - { + private void addOperationProvider(final Element providerDef) throws FileSystemException { final String classname = providerDef.getAttribute("class-name"); // Attach only to available schemas final String[] schemas = getSchemas(providerDef); - for (final String schema : schemas) - { - if (hasProvider(schema)) - { + for (final String schema : schemas) { + if (hasProvider(schema)) { final FileOperationProvider operationProvider = (FileOperationProvider) createInstance(classname); addOperationProvider(schema, operationProvider); } @@ -401,15 +342,11 @@ private void addOperationProvider(final Element providerDef) throws FileSystemEx /** * Tests if a class is available. */ - private boolean findClass(final String className) - { - try - { + private boolean findClass(final String className) { + try { loadClass(className); return true; - } - catch (final ClassNotFoundException e) - { + } catch (final ClassNotFoundException e) { return false; } } @@ -417,17 +354,14 @@ private boolean findClass(final String className) /** * Extracts the required classes from a provider definition. */ - private String[] getRequiredClasses(final Element providerDef) - { + private String[] getRequiredClasses(final Element providerDef) { final ArrayList classes = new ArrayList<>(); final NodeList deps = providerDef.getElementsByTagName("if-available"); final int count = deps.getLength(); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { final Element dep = (Element) deps.item(i); final String className = dep.getAttribute("class-name"); - if (className != null && className.length() > 0) - { + if (className != null && className.length() > 0) { classes.add(className); } } @@ -437,17 +371,14 @@ private String[] getRequiredClasses(final Element providerDef) /** * Extracts the required schemes from a provider definition. */ - private String[] getRequiredSchemes(final Element providerDef) - { + private String[] getRequiredSchemes(final Element providerDef) { final ArrayList schemes = new ArrayList<>(); final NodeList deps = providerDef.getElementsByTagName("if-available"); final int count = deps.getLength(); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { final Element dep = (Element) deps.item(i); final String scheme = dep.getAttribute("scheme"); - if (scheme != null && scheme.length() > 0) - { + if (scheme != null && scheme.length() > 0) { schemes.add(scheme); } } @@ -457,13 +388,11 @@ private String[] getRequiredSchemes(final Element providerDef) /** * Extracts the schema names from a provider definition. */ - private String[] getSchemas(final Element provider) - { + private String[] getSchemas(final Element provider) { final ArrayList schemas = new ArrayList<>(); final NodeList schemaElements = provider.getElementsByTagName("scheme"); final int count = schemaElements.getLength(); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { final Element scheme = (Element) schemaElements.item(i); schemas.add(scheme.getAttribute("name")); } @@ -473,47 +402,38 @@ private String[] getSchemas(final Element provider) /** * Creates a provider. */ - private Object createInstance(final String className) - throws FileSystemException - { - try - { - Class clazz = loadClass(className); + private Object createInstance(final String className) throws FileSystemException { + try { + final Class clazz = loadClass(className); return clazz.newInstance(); - } - catch (final Exception e) - { + } catch (final Exception e) { throw new FileSystemException("vfs.impl/create-provider.error", className, e); } } /** * Load a class from different class loaders. + * * @throws ClassNotFoundException if last {@code loadClass} failed. * @see #findClassLoader() */ - private Class< ? > loadClass(String className) throws ClassNotFoundException - { - try - { + private Class loadClass(final String className) throws ClassNotFoundException { + try { return findClassLoader().loadClass(className); - } - catch (final ClassNotFoundException e) - { + } catch (final ClassNotFoundException e) { return getClass().getClassLoader().loadClass(className); } } /** * Resolve resources from different class loaders. + * * @throws IOException if {@code getResource} failed. * @see #findClassLoader() */ - private Enumeration loadResources(String name) throws IOException - { + private Enumeration loadResources(final String name) throws IOException { Enumeration res = findClassLoader().getResources(name); - if (res == null || !res.hasMoreElements()) - { + if (res == null || !res.hasMoreElements()) { res = getClass().getClassLoader().getResources(name); } return res; diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java similarity index 63% rename from core/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java index a65023f2cc..7cb114685b 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/SynchronizedFileObject.java @@ -28,217 +28,169 @@ /** * This decorator synchronize all access to the FileObject. */ -public class SynchronizedFileObject extends DecoratedFileObject -{ - public SynchronizedFileObject(final FileObject fileObject) - { +public class SynchronizedFileObject extends DecoratedFileObject { + public SynchronizedFileObject(final FileObject fileObject) { super(fileObject); } @Override - public void close() throws FileSystemException - { - synchronized (this) - { + public void close() throws FileSystemException { + synchronized (this) { super.close(); } } @Override - public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException - { - synchronized (this) - { + public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException { + synchronized (this) { super.copyFrom(srcFile, selector); } } @Override - public void createFile() throws FileSystemException - { - synchronized (this) - { + public void createFile() throws FileSystemException { + synchronized (this) { super.createFile(); } } @Override - public void createFolder() throws FileSystemException - { - synchronized (this) - { + public void createFolder() throws FileSystemException { + synchronized (this) { super.createFolder(); } } @Override - public boolean delete() throws FileSystemException - { - synchronized (this) - { + public boolean delete() throws FileSystemException { + synchronized (this) { return super.delete(); } } @Override - public int delete(final FileSelector selector) throws FileSystemException - { - synchronized (this) - { + public int delete(final FileSelector selector) throws FileSystemException { + synchronized (this) { return super.delete(selector); } } @Override - public boolean exists() throws FileSystemException - { - synchronized (this) - { + public boolean exists() throws FileSystemException { + synchronized (this) { return super.exists(); } } @Override public void findFiles(final FileSelector selector, final boolean depthwise, final List selected) - throws FileSystemException - { - synchronized (this) - { + throws FileSystemException { + synchronized (this) { super.findFiles(selector, depthwise, selected); } } @Override - public FileObject[] findFiles(final FileSelector selector) throws FileSystemException - { - synchronized (this) - { + public FileObject[] findFiles(final FileSelector selector) throws FileSystemException { + synchronized (this) { return super.findFiles(selector); } } @Override - public FileObject getChild(final String name) throws FileSystemException - { - synchronized (this) - { + public FileObject getChild(final String name) throws FileSystemException { + synchronized (this) { return super.getChild(name); } } @Override - public FileObject[] getChildren() throws FileSystemException - { - synchronized (this) - { + public FileObject[] getChildren() throws FileSystemException { + synchronized (this) { return super.getChildren(); } } @Override - public FileContent getContent() throws FileSystemException - { - synchronized (this) - { + public FileContent getContent() throws FileSystemException { + synchronized (this) { return super.getContent(); } } @Override - public FileType getType() throws FileSystemException - { - synchronized (this) - { + public FileType getType() throws FileSystemException { + synchronized (this) { return super.getType(); } } @Override - public boolean isHidden() throws FileSystemException - { - synchronized (this) - { + public boolean isHidden() throws FileSystemException { + synchronized (this) { return super.isHidden(); } } @Override - public boolean isReadable() throws FileSystemException - { - synchronized (this) - { + public boolean isReadable() throws FileSystemException { + synchronized (this) { return super.isReadable(); } } @Override - public boolean isWriteable() throws FileSystemException - { - synchronized (this) - { + public boolean isWriteable() throws FileSystemException { + synchronized (this) { return super.isWriteable(); } } @Override - public boolean isExecutable() throws FileSystemException - { - synchronized (this) - { + public boolean isExecutable() throws FileSystemException { + synchronized (this) { return super.isExecutable(); } } @Override - public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException - { - synchronized (this) - { + public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException { + synchronized (this) { return super.setReadable(readable, ownerOnly); } } @Override - public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException - { - synchronized (this) - { + public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException { + synchronized (this) { return super.setWritable(writable, ownerOnly); } } @Override - public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException - { - synchronized (this) - { + public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException { + synchronized (this) { return super.setExecutable(executable, ownerOnly); } } @Override - public void moveTo(final FileObject destFile) throws FileSystemException - { - synchronized (this) - { + public void moveTo(final FileObject destFile) throws FileSystemException { + synchronized (this) { super.moveTo(destFile); } } @Override - public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException - { - synchronized (this) - { + public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException { + synchronized (this) { return super.resolveFile(name, scope); } } @Override - public FileObject resolveFile(final String path) throws FileSystemException - { - synchronized (this) - { + public FileObject resolveFile(final String path) throws FileSystemException { + synchronized (this) { return super.resolveFile(path); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java similarity index 64% rename from core/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java index ded84b4308..55b1ec2842 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/URLStreamHandlerProxy.java @@ -25,34 +25,22 @@ /** * A proxy for URLs that are supported by the standard stream handler factory. */ -class URLStreamHandlerProxy - extends URLStreamHandler -{ +class URLStreamHandlerProxy extends URLStreamHandler { @Override - protected URLConnection openConnection(final URL url) - throws IOException - { + protected URLConnection openConnection(final URL url) throws IOException { final URL proxyURL = new URL(url.toExternalForm()); return proxyURL.openConnection(); } @Override - protected void parseURL(final URL u, - final String spec, - final int start, - final int limit) - { - try - { + protected void parseURL(final URL u, final String spec, final int start, final int limit) { + try { final URL url = new URL(u, spec); - setURL(u, url.getProtocol(), url.getHost(), - url.getPort(), url.getAuthority(), url.getUserInfo(), - url.getFile(), url.getQuery(), url.getRef()); - } - catch (final MalformedURLException mue) - { - //We retrow this as a simple runtime exception. - //It is retrown in URL as a MalformedURLException anyway. + setURL(u, url.getProtocol(), url.getHost(), url.getPort(), url.getAuthority(), url.getUserInfo(), + url.getFile(), url.getQuery(), url.getRef()); + } catch (final MalformedURLException mue) { + // We retrow this as a simple runtime exception. + // It is retrown in URL as a MalformedURLException anyway. throw new RuntimeException(mue.getMessage()); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/VFSClassLoader.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VFSClassLoader.java similarity index 65% rename from core/src/main/java/org/apache/commons/vfs2/impl/VFSClassLoader.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VFSClassLoader.java index 813a3dfa8a..c394cf5f78 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/VFSClassLoader.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VFSClassLoader.java @@ -37,84 +37,65 @@ import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.NameScope; - /** * A class loader that can load classes and resources from a search path. *

      - * The search path can consist of VFS FileObjects referring both to folders - * and JAR files. Any FileObject of type FileType.FILE is assumed to be a JAR and - * is opened by creating a layered file system with the "jar" scheme. + * The search path can consist of VFS FileObjects referring both to folders and JAR files. Any FileObject of type + * FileType.FILE is assumed to be a JAR and is opened by creating a layered file system with the "jar" scheme. *

      * TODO - Test this with signed Jars and a SecurityManager. * * @see FileSystemManager#createFileSystem */ -public class VFSClassLoader extends SecureClassLoader -{ +public class VFSClassLoader extends SecureClassLoader { private final ArrayList resources = new ArrayList<>(); /** * Constructors a new VFSClassLoader for the given file. * - * @param file the file to load the classes and resources from. - * @param manager the FileManager to use when trying create a layered Jar file - * system. + * @param file the file to load the classes and resources from. + * @param manager the FileManager to use when trying create a layered Jar file system. * @throws FileSystemException if an error occurs. */ - public VFSClassLoader(final FileObject file, - final FileSystemManager manager) - throws FileSystemException - { - this(new FileObject[]{file}, manager, null); + public VFSClassLoader(final FileObject file, final FileSystemManager manager) throws FileSystemException { + this(new FileObject[] { file }, manager, null); } /** * Constructors a new VFSClassLoader for the given file. * - * @param file the file to load the classes and resources from. - * @param manager the FileManager to use when trying create a layered Jar file - * system. - * @param parent the parent class loader for delegation. + * @param file the file to load the classes and resources from. + * @param manager the FileManager to use when trying create a layered Jar file system. + * @param parent the parent class loader for delegation. * @throws FileSystemException if an error occurs. */ - public VFSClassLoader(final FileObject file, - final FileSystemManager manager, - final ClassLoader parent) - throws FileSystemException - { - this(new FileObject[]{file}, manager, parent); + public VFSClassLoader(final FileObject file, final FileSystemManager manager, final ClassLoader parent) + throws FileSystemException { + this(new FileObject[] { file }, manager, parent); } /** - * Constructors a new VFSClassLoader for the given files. The files will - * be searched in the order specified. + * Constructors a new VFSClassLoader for the given files. The files will be searched in the order specified. * - * @param files the files to load the classes and resources from. - * @param manager the FileManager to use when trying create a layered Jar file - * system. + * @param files the files to load the classes and resources from. + * @param manager the FileManager to use when trying create a layered Jar file system. * @throws FileSystemException if an error occurs. */ - public VFSClassLoader(final FileObject[] files, - final FileSystemManager manager) - throws FileSystemException - { + public VFSClassLoader(final FileObject[] files, final FileSystemManager manager) throws FileSystemException { this(files, manager, null); } /** - * Constructors a new VFSClassLoader for the given FileObjects. - * The FileObjects will be searched in the order specified. + * Constructors a new VFSClassLoader for the given FileObjects. The FileObjects will be searched in the order + * specified. * - * @param files the FileObjects to load the classes and resources from. - * @param manager the FileManager to use when trying create a layered Jar file - * system. - * @param parent the parent class loader for delegation. + * @param files the FileObjects to load the classes and resources from. + * @param manager the FileManager to use when trying create a layered Jar file system. + * @param parent the parent class loader for delegation. * @throws FileSystemException if an error occurs. */ - public VFSClassLoader(final FileObject[] files, - final FileSystemManager manager, - final ClassLoader parent) throws FileSystemException - { + public VFSClassLoader(final FileObject[] files, final FileSystemManager manager, final ClassLoader parent) + throws FileSystemException { super(parent); addFileObjects(manager, files); } @@ -125,33 +106,26 @@ public VFSClassLoader(final FileObject[] files, * @return An array of FileObjects. * @since 2.0 */ - public FileObject[] getFileObjects() - { + public FileObject[] getFileObjects() { return resources.toArray(new FileObject[resources.size()]); } /** - * Appends the specified FileObjects to the list of FileObjects to search - * for classes and resources. + * Appends the specified FileObjects to the list of FileObjects to search for classes and resources. * * @param manager The FileSystemManager. * @param files the FileObjects to append to the search path. * @throws FileSystemException if an error occurs. */ - private void addFileObjects(final FileSystemManager manager, - final FileObject[] files) throws FileSystemException - { - for (FileObject file : files) - { - if (!file.exists()) - { + private void addFileObjects(final FileSystemManager manager, final FileObject[] files) throws FileSystemException { + for (FileObject file : files) { + if (!file.exists()) { // Does not exist - skip continue; } // TODO - use federation instead - if (manager.canCreateFileSystem(file)) - { + if (manager.canCreateFileSystem(file)) { // Use contents of the file file = manager.createFileSystem(file); } @@ -161,26 +135,20 @@ private void addFileObjects(final FileSystemManager manager, } /** - * Finds and loads the class with the specified name from the search - * path. + * Finds and loads the class with the specified name from the search path. * * @throws ClassNotFoundException if the class is not found. */ @Override - protected Class findClass(final String name) throws ClassNotFoundException - { - try - { + protected Class findClass(final String name) throws ClassNotFoundException { + try { final String path = name.replace('.', '/').concat(".class"); final Resource res = loadResource(path); - if (res == null) - { + if (res == null) { throw new ClassNotFoundException(name); } return defineClass(name, res); - } - catch (final IOException ioe) - { + } catch (final IOException ioe) { throw new ClassNotFoundException(name, ioe); } } @@ -188,40 +156,28 @@ protected Class findClass(final String name) throws ClassNotFoundException /** * Loads and verifies the class with name and located with res. */ - private Class defineClass(final String name, final Resource res) - throws IOException - { + private Class defineClass(final String name, final Resource res) throws IOException { final URL url = res.getCodeSourceURL(); final String pkgName = res.getPackageName(); - if (pkgName != null) - { + if (pkgName != null) { final Package pkg = getPackage(pkgName); - if (pkg != null) - { - if (pkg.isSealed()) - { - if (!pkg.isSealed(url)) - { + if (pkg != null) { + if (pkg.isSealed()) { + if (!pkg.isSealed(url)) { throw new FileSystemException("vfs.impl/pkg-sealed-other-url", pkgName); } - } - else - { - if (isSealed(res)) - { + } else { + if (isSealed(res)) { throw new FileSystemException("vfs.impl/pkg-sealing-unsealed", pkgName); } } - } - else - { + } else { definePackage(pkgName, res); } } final byte[] bytes = res.getBytes(); - final Certificate[] certs = - res.getFileObject().getContent().getCertificates(); + final Certificate[] certs = res.getFileObject().getContent().getCertificates(); final CodeSource cs = new CodeSource(url, certs); return defineClass(name, bytes, 0, bytes.length, cs); } @@ -229,9 +185,7 @@ private Class defineClass(final String name, final Resource res) /** * Returns true if the we should seal the package where res resides. */ - private boolean isSealed(final Resource res) - throws FileSystemException - { + private boolean isSealed(final Resource res) throws FileSystemException { final String sealed = res.getPackageAttribute(Attributes.Name.SEALED); return "true".equalsIgnoreCase(sealed); } @@ -239,10 +193,7 @@ private boolean isSealed(final Resource res) /** * Reads attributes for the package and defines it. */ - private Package definePackage(final String name, - final Resource res) - throws FileSystemException - { + private Package definePackage(final String name, final Resource res) throws FileSystemException { // TODO - check for MANIFEST_ATTRIBUTES capability first final String specTitle = res.getPackageAttribute(Name.SPECIFICATION_TITLE); final String specVendor = res.getPackageAttribute(Attributes.Name.SPECIFICATION_VENDOR); @@ -252,40 +203,32 @@ private Package definePackage(final String name, final String implVersion = res.getPackageAttribute(Name.IMPLEMENTATION_VERSION); final URL sealBase; - if (isSealed(res)) - { + if (isSealed(res)) { sealBase = res.getCodeSourceURL(); - } - else - { + } else { sealBase = null; } - return definePackage(name, specTitle, specVersion, specVendor, - implTitle, implVersion, implVendor, sealBase); + return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); } /** - * Calls super.getPermissions both for the code source and also - * adds the permissions granted to the parent layers. + * Calls super.getPermissions both for the code source and also adds the permissions granted to the parent layers. + * * @param cs the CodeSource. * @return The PermissionCollections. */ @Override - protected PermissionCollection getPermissions(final CodeSource cs) - { - try - { + protected PermissionCollection getPermissions(final CodeSource cs) { + try { final String url = cs.getLocation().toString(); final FileObject file = lookupFileObject(url); - if (file == null) - { + if (file == null) { return super.getPermissions(cs); } final FileObject parentLayer = file.getFileSystem().getParentLayer(); - if (parentLayer == null) - { + if (parentLayer == null) { return super.getPermissions(cs); } @@ -293,53 +236,39 @@ protected PermissionCollection getPermissions(final CodeSource cs) PermissionCollection permCollect = super.getPermissions(cs); copyPermissions(permCollect, combi); - for (FileObject parent = parentLayer; - parent != null; - parent = parent.getFileSystem().getParentLayer()) - { - final CodeSource parentcs = - new CodeSource(parent.getURL(), - parent.getContent().getCertificates()); + for (FileObject parent = parentLayer; parent != null; parent = parent.getFileSystem().getParentLayer()) { + final CodeSource parentcs = new CodeSource(parent.getURL(), parent.getContent().getCertificates()); permCollect = super.getPermissions(parentcs); copyPermissions(permCollect, combi); - parent.close(); // prevent leaky resources } return combi; - } - catch (final FileSystemException fse) - { + } catch (final FileSystemException fse) { throw new SecurityException(fse.getMessage()); } } /** * Copies the permissions from src to dest. + * * @param src The source PermissionCollection. * @param dest The destination PermissionCollection. */ - protected void copyPermissions(final PermissionCollection src, - final PermissionCollection dest) - { - for (final Enumeration elem = src.elements(); elem.hasMoreElements();) - { + protected void copyPermissions(final PermissionCollection src, final PermissionCollection dest) { + for (final Enumeration elem = src.elements(); elem.hasMoreElements();) { final Permission permission = elem.nextElement(); dest.add(permission); } } /** - * Does a reverse lookup to find the FileObject when we only have the - * URL. + * Does a reverse lookup to find the FileObject when we only have the URL. */ - private FileObject lookupFileObject(final String name) - { + private FileObject lookupFileObject(final String name) { final Iterator it = resources.iterator(); - while (it.hasNext()) - { + while (it.hasNext()) { final FileObject object = it.next(); - if (name.equals(object.getName().getURI())) - { + if (name.equals(object.getName().getURI())) { return object; } } @@ -347,50 +276,40 @@ private FileObject lookupFileObject(final String name) } /** - * Finds the resource with the specified name from the search path. - * This returns null if the resource is not found. + * Finds the resource with the specified name from the search path. This returns null if the resource is not found. + * * @param name The resource name. * @return The URL that matches the resource. */ @Override - protected URL findResource(final String name) - { - try - { + protected URL findResource(final String name) { + try { final Resource res = loadResource(name); - if (res != null) - { + if (res != null) { return res.getURL(); } return null; - } - catch (final Exception ignored) - { + } catch (final Exception ignored) { return null; // TODO: report? } } /** - * Returns an Enumeration of all the resources in the search path - * with the specified name. + * Returns an Enumeration of all the resources in the search path with the specified name. *

      - * Gets called from {@link ClassLoader#getResources(String)} after - * parent class loader was questioned. + * Gets called from {@link ClassLoader#getResources(String)} after parent class loader was questioned. * * @param name The resources to find. * @return An Enumeration of the resources associated with the name. * @throws FileSystemException if an error occurs. */ @Override - protected Enumeration findResources(final String name) throws IOException - { + protected Enumeration findResources(final String name) throws IOException { final List result = new ArrayList<>(2); - for (FileObject baseFile : resources) - { + for (final FileObject baseFile : resources) { final FileObject file = baseFile.resolveFile(name, NameScope.DESCENDENT_OR_SELF); - if (file.exists()) - { + if (file.exists()) { result.add(new Resource(name, baseFile, file).getURL()); } } @@ -399,19 +318,16 @@ protected Enumeration findResources(final String name) throws IOException } /** - * Searches through the search path of for the first class or resource - * with specified name. + * Searches through the search path of for the first class or resource with specified name. + * * @param name The resource to load. * @return The Resource. * @throws FileSystemException if an error occurs. */ - private Resource loadResource(final String name) throws FileSystemException - { - for (final FileObject baseFile : resources) - { + private Resource loadResource(final String name) throws FileSystemException { + for (final FileObject baseFile : resources) { final FileObject file = baseFile.resolveFile(name, NameScope.DESCENDENT_OR_SELF); - if (file.exists()) - { + if (file.exists()) { return new Resource(name, baseFile, file); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java similarity index 91% rename from core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java index c3defbf264..543b5a429a 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileName.java @@ -23,22 +23,18 @@ /** * A simple Filename to hold the scheme for to be created virtual filesytsem. */ -public class VirtualFileName extends AbstractFileName -{ - public VirtualFileName(final String scheme, final String absPath, final FileType type) - { +public class VirtualFileName extends AbstractFileName { + public VirtualFileName(final String scheme, final String absPath, final FileType type) { super(scheme, absPath, type); } @Override - public FileName createName(final String absPath, final FileType type) - { + public FileName createName(final String absPath, final FileType type) { return new VirtualFileName(getScheme(), absPath, type); } @Override - protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) - { + protected void appendRootUri(final StringBuilder buffer, final boolean addPassword) { buffer.append(getScheme()); } } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileProvider.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileProvider.java similarity index 81% rename from core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileProvider.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileProvider.java index 3556b63f99..6d731f210d 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileProvider.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileProvider.java @@ -25,12 +25,10 @@ import org.apache.commons.vfs2.provider.AbstractFileSystem; import org.apache.commons.vfs2.provider.AbstractVfsContainer; - /** * A virtual filesystem provider. */ -public class VirtualFileProvider extends AbstractVfsContainer -{ +public class VirtualFileProvider extends AbstractVfsContainer { /** * Creates a virtual file system, with the supplied file as its root. * @@ -38,10 +36,9 @@ public class VirtualFileProvider extends AbstractVfsContainer * @return A FileObject in the FileSystem. * @throws FileSystemException if an error occurs. */ - public FileObject createFileSystem(final FileObject rootFile) throws FileSystemException - { - final AbstractFileName rootName = (AbstractFileName) - getContext().getFileSystemManager().resolveName(rootFile.getName(), FileName.ROOT_PATH); + public FileObject createFileSystem(final FileObject rootFile) throws FileSystemException { + final AbstractFileName rootName = (AbstractFileName) getContext().getFileSystemManager() + .resolveName(rootFile.getName(), FileName.ROOT_PATH); final VirtualFileSystem fs = new VirtualFileSystem(rootName, rootFile.getFileSystem().getFileSystemOptions()); addComponent(fs); fs.addJunction(FileName.ROOT_PATH, rootFile); @@ -55,25 +52,21 @@ public FileObject createFileSystem(final FileObject rootFile) throws FileSystemE * @return A FileObject in the FileSystem. * @throws FileSystemException if an error occurs. */ - public FileObject createFileSystem(final String rootUri) throws FileSystemException - { - final AbstractFileName rootName = - new VirtualFileName(rootUri, FileName.ROOT_PATH, FileType.FOLDER); + public FileObject createFileSystem(final String rootUri) throws FileSystemException { + final AbstractFileName rootName = new VirtualFileName(rootUri, FileName.ROOT_PATH, FileType.FOLDER); final VirtualFileSystem fs = new VirtualFileSystem(rootName, null); addComponent(fs); return fs.getRoot(); } /** - * Close a VirtualFileSystem by removing it from the - * {@code #components} list of this provider. + * Close a VirtualFileSystem by removing it from the {@code #components} list of this provider. *

      * This gets called from DefaultFileManager#_closeFileSystem. * * @param filesystem the file system remembered by this provider. */ - void closeFileSystem(final FileSystem filesystem) - { + void closeFileSystem(final FileSystem filesystem) { final AbstractFileSystem fs = (AbstractFileSystem) filesystem; removeComponent(fs); diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java similarity index 75% rename from core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java index 5a70d2188f..37008ef5de 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/VirtualFileSystem.java @@ -32,17 +32,14 @@ import org.apache.commons.vfs2.provider.DelegateFileObject; /** - * A logical file system, made up of set of junctions, or links, to files from - * other file systems. + * A logical file system, made up of set of junctions, or links, to files from other file systems. *

      * TODO - Handle nested junctions. */ -public class VirtualFileSystem extends AbstractFileSystem -{ +public class VirtualFileSystem extends AbstractFileSystem { private final Map junctions = new HashMap<>(); - public VirtualFileSystem(final AbstractFileName rootName, final FileSystemOptions fileSystemOptions) - { + public VirtualFileSystem(final AbstractFileName rootName, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); } @@ -50,8 +47,7 @@ public VirtualFileSystem(final AbstractFileName rootName, final FileSystemOption * Adds the capabilities of this file system. */ @Override - protected void addCapabilities(final Collection caps) - { + protected void addCapabilities(final Collection caps) { // TODO - this isn't really true caps.add(Capability.ATTRIBUTES); caps.add(Capability.CREATE); @@ -69,77 +65,63 @@ protected void addCapabilities(final Collection caps) } /** - * Creates a file object. This method is called only if the requested - * file is not cached. + * Creates a file object. This method is called only if the requested file is not cached. */ @Override - protected FileObject createFile(final AbstractFileName name) throws Exception - { + protected FileObject createFile(final AbstractFileName name) throws Exception { // Find the file that the name points to final FileName junctionPoint = getJunctionForFile(name); final FileObject file; - if (junctionPoint != null) - { + if (junctionPoint != null) { // Resolve the real file final FileObject junctionFile = junctions.get(junctionPoint); final String relName = junctionPoint.getRelativeName(name); file = junctionFile.resolveFile(relName, NameScope.DESCENDENT_OR_SELF); - } - else - { + } else { file = null; } // Return a wrapper around the file - return new DelegateFileObject(name, this, file); + return new DelegateFileObject(name, this, file); } /** * Adds a junction to this file system. + * * @param junctionPoint The location of the junction. * @param targetFile The target file to base the junction on. * @throws FileSystemException if an error occurs. */ @Override - public void addJunction(final String junctionPoint, - final FileObject targetFile) - throws FileSystemException - { + public void addJunction(final String junctionPoint, final FileObject targetFile) throws FileSystemException { final FileName junctionName = getFileSystemManager().resolveName(getRootName(), junctionPoint); // Check for nested junction - these are not supported yet - if (getJunctionForFile(junctionName) != null) - { + if (getJunctionForFile(junctionName) != null) { throw new FileSystemException("vfs.impl/nested-junction.error", junctionName); } - try - { + try { // Add to junction table junctions.put(junctionName, targetFile); // Attach to file - final DelegateFileObject junctionFile = (DelegateFileObject) getFileFromCache(junctionName); - if (junctionFile != null) - { + final DelegateFileObject junctionFile = (DelegateFileObject) getFileFromCache(junctionName); + if (junctionFile != null) { junctionFile.setFile(targetFile); } // Create ancestors of junction point FileName childName = junctionName; boolean done = false; - for (AbstractFileName parentName = (AbstractFileName) childName.getParent(); - !done && parentName != null; - childName = parentName, parentName = (AbstractFileName) parentName.getParent()) - { - DelegateFileObject file = (DelegateFileObject) getFileFromCache(parentName); - if (file == null) - { - file = new DelegateFileObject(parentName, this, null); + for (AbstractFileName parentName = (AbstractFileName) childName.getParent(); !done + && parentName != null; childName = parentName, parentName = (AbstractFileName) parentName + .getParent()) { + DelegateFileObject file = (DelegateFileObject) getFileFromCache(parentName); + if (file == null) { + file = new DelegateFileObject(parentName, this, null); putFileToCache(file); - } - else - { + } else { done = file.exists(); } @@ -148,22 +130,19 @@ public void addJunction(final String junctionPoint, } // TODO - attach all cached children of the junction point to their real file - } - catch (final Exception e) - { + } catch (final Exception e) { throw new FileSystemException("vfs.impl/create-junction.error", junctionName, e); } } /** * Removes a junction from this file system. + * * @param junctionPoint The junction to remove. * @throws FileSystemException if an error occurs. */ @Override - public void removeJunction(final String junctionPoint) - throws FileSystemException - { + public void removeJunction(final String junctionPoint) throws FileSystemException { final FileName junctionName = getFileSystemManager().resolveName(getRootName(), junctionPoint); junctions.remove(junctionName); @@ -173,22 +152,19 @@ public void removeJunction(final String junctionPoint) /** * Locates the junction point for the junction containing the given file. + * * @param name The FileName. * @return the FileName where the junction occurs. */ - private FileName getJunctionForFile(final FileName name) - { - if (junctions.containsKey(name)) - { + private FileName getJunctionForFile(final FileName name) { + if (junctions.containsKey(name)) { // The name points to the junction point directly return name; } // Find matching junction - for (final FileName junctionPoint : junctions.keySet()) - { - if (junctionPoint.isDescendent(name)) - { + for (final FileName junctionPoint : junctions.keySet()) { + if (junctionPoint.isDescendent(name)) { return junctionPoint; } } @@ -198,8 +174,7 @@ private FileName getJunctionForFile(final FileName name) } @Override - public void close() - { + public void close() { super.close(); junctions.clear(); } diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/package.html b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/package.html similarity index 100% rename from core/src/main/java/org/apache/commons/vfs2/impl/package.html rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/package.html diff --git a/core/src/main/java/org/apache/commons/vfs2/impl/providers.xml b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/providers.xml similarity index 99% rename from core/src/main/java/org/apache/commons/vfs2/impl/providers.xml rename to commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/providers.xml index a50f90f37e..17aa185cf2 100644 --- a/core/src/main/java/org/apache/commons/vfs2/impl/providers.xml +++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/providers.xml @@ -87,6 +87,8 @@ + --> + + + + + + + + + + + + + + + diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/file1.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/file1.xml new file mode 100644 index 0000000000..42e9846ec7 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/file1.xml @@ -0,0 +1,18 @@ + + +foo1 diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/file2.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/file2.xml new file mode 100644 index 0000000000..2e3ff38237 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/file2.xml @@ -0,0 +1,18 @@ + + +foo2 diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/file3-bigger.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/file3-bigger.xml new file mode 100644 index 0000000000..780dc4860c --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/file3-bigger.xml @@ -0,0 +1,1354 @@ + + + + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 foo1 + diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-invalid.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-invalid.xml new file mode 100644 index 0000000000..522c4f6f3f --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-invalid.xml @@ -0,0 +1,25 @@ + + + + John + Q. + Public + diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-not-well-formed.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-not-well-formed.xml new file mode 100644 index 0000000000..305ac6eba8 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-not-well-formed.xml @@ -0,0 +1,24 @@ + + + + John + Q. + Public diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-with-xsd-ref.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-with-xsd-ref.xml new file mode 100644 index 0000000000..cad2771282 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name-with-xsd-ref.xml @@ -0,0 +1,25 @@ + + + + John + Q. + Public + diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/name.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name.xml new file mode 100644 index 0000000000..4c5c870722 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name.xml @@ -0,0 +1,22 @@ + + + + John + Q. + Public + diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/name.xsd b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name.xsd new file mode 100644 index 0000000000..9b0a6a7193 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/name.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/person.xml b/commons-vfs2/src/test/resources/test-data/read-xml-tests/person.xml new file mode 100644 index 0000000000..28e023f633 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/person.xml @@ -0,0 +1,38 @@ + + + + + + John + Q. + Public + + + + 123 Main St. + Ridgway + CO + 81432 + + + diff --git a/commons-vfs2/src/test/resources/test-data/read-xml-tests/person.xsd b/commons-vfs2/src/test/resources/test-data/read-xml-tests/person.xsd new file mode 100644 index 0000000000..4bc82a9408 --- /dev/null +++ b/commons-vfs2/src/test/resources/test-data/read-xml-tests/person.xsd @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + diff --git a/core/src/test/resources/test-data/test-hash-#test.txt b/commons-vfs2/src/test/resources/test-data/test-hash-#test.txt similarity index 100% rename from core/src/test/resources/test-data/test-hash-#test.txt rename to commons-vfs2/src/test/resources/test-data/test-hash-#test.txt diff --git a/core/src/test/resources/test-data/test.jar b/commons-vfs2/src/test/resources/test-data/test.jar similarity index 100% rename from core/src/test/resources/test-data/test.jar rename to commons-vfs2/src/test/resources/test-data/test.jar diff --git a/core/src/test/resources/test-data/test.mf b/commons-vfs2/src/test/resources/test-data/test.mf similarity index 100% rename from core/src/test/resources/test-data/test.mf rename to commons-vfs2/src/test/resources/test-data/test.mf diff --git a/core/src/test/resources/test-data/test.policy b/commons-vfs2/src/test/resources/test-data/test.policy similarity index 100% rename from core/src/test/resources/test-data/test.policy rename to commons-vfs2/src/test/resources/test-data/test.policy diff --git a/core/src/test/resources/test-data/test.tar b/commons-vfs2/src/test/resources/test-data/test.tar similarity index 100% rename from core/src/test/resources/test-data/test.tar rename to commons-vfs2/src/test/resources/test-data/test.tar diff --git a/core/src/test/resources/test-data/test.tbz2 b/commons-vfs2/src/test/resources/test-data/test.tbz2 similarity index 100% rename from core/src/test/resources/test-data/test.tbz2 rename to commons-vfs2/src/test/resources/test-data/test.tbz2 diff --git a/core/src/test/resources/test-data/test.tgz b/commons-vfs2/src/test/resources/test-data/test.tgz similarity index 100% rename from core/src/test/resources/test-data/test.tgz rename to commons-vfs2/src/test/resources/test-data/test.tgz diff --git a/core/src/test/resources/test-data/test.zip b/commons-vfs2/src/test/resources/test-data/test.zip similarity index 100% rename from core/src/test/resources/test-data/test.zip rename to commons-vfs2/src/test/resources/test-data/test.zip diff --git a/core/src/test/resources/test-data/write-tests/dummy.txt b/commons-vfs2/src/test/resources/test-data/write-tests/dummy.txt similarity index 100% rename from core/src/test/resources/test-data/write-tests/dummy.txt rename to commons-vfs2/src/test/resources/test-data/write-tests/dummy.txt diff --git a/core/dependency-reduced-pom.xml b/core/dependency-reduced-pom.xml deleted file mode 100644 index 43a5bbb01b..0000000000 --- a/core/dependency-reduced-pom.xml +++ /dev/null @@ -1,630 +0,0 @@ - - - - commons-vfs2-project - org.apache.commons - 2.2-SNAPSHOT - - 4.0.0 - org.apache.commons - commons-vfs2 - Apache Commons VFS Core - 2.2-SNAPSHOT - Apache Commons VFS is a Virtual File System library. - http://commons.apache.org/proper/commons-vfs/ - - - - src/main/java - - **/*.html - **/*.java - - - - META-INF - ${vfs.parent.dir} - - NOTICE.txt - LICENSE.txt - - - - - - src/test/resources - - - META-INF - ${vfs.parent.dir} - - NOTICE.txt - LICENSE.txt - - - - - - maven-jar-plugin - - - - test-jar - - - - - - maven-antrun-plugin - - - process-test-classes - - run - - - - - - - - - - - - - maven-surefire-plugin - - false - - target/test-classes/test-data - test-data - target/derby.log - - - **/RunTest.java - **/*$* - - - - - - - - webdav - - - - maven-surefire-plugin - - - ${test.webdav.uri} - - - - - - - - ftp - - - - maven-surefire-plugin - - - ${test.ftp.uri} - - - - - - - - sftp - - - - maven-surefire-plugin - - - ${test.sftp.uri} - - - - - - - - http - - - - maven-surefire-plugin - - - ${test.http.uri} - - - - - - - - no-test-hdfs - - - - maven-surefire-plugin - - - **/HdfsFileProviderTest.java - **/HdfsFileProviderTestCase.java - - - - - - - - sources - - - - maven-source-plugin - 3.0.0 - - - attach-sources - - jar - - - - - true - true - - - - - - - - - true - true - - - - - - - - - shade - - - - maven-shade-plugin - 2.3 - - - package - - shade - - - true - - - log4j:log4j - - ** - - - - commons-logging:commons-logging - - ** - - - - com.jcraft:jsch - - ** - - - - org.apache.commons:commons-compress - - ** - - - - - - - - - - - - javadoc - - - - maven-javadoc-plugin - - - attach-javadocs - - jar - - - false - - - - - - - - - - - junit - junit - 4.12 - test - - - hamcrest-core - org.hamcrest - - - - - org.apache.commons - commons-lang3 - 3.4 - test - - - org.apache.ftpserver - ftpserver-core - 1.0.6 - test - - - ftplet-api - org.apache.ftpserver - - - mina-core - org.apache.mina - - - - - org.slf4j - slf4j-api - 1.5.11 - test - - - org.apache.sshd - sshd-core - 0.8.0 - test - - - mina-core - org.apache.mina - - - - - org.bouncycastle - bcprov-jdk16 - 1.46 - test - - - commons-io - commons-io - 2.5 - test - - - org.apache.httpcomponents - httpcore-nio - 4.3.2 - test - - - org.apache.jackrabbit - jackrabbit-standalone - 1.6.5 - test - - - * - * - - - xercesImpl - xerces - - - commons-httpclient - commons-httpclient - - - commons-collections - commons-collections - - - derby - org.apache.derby - - - slf4j-log4j12 - org.slf4j - - - slf4j-api - org.slf4j - - - log4j - log4j - - - jsp-api - javax.servlet.jsp - - - - - org.apache.hadoop - hadoop-common - 2.6.0 - test-jar - test - - - slf4j-log4j12 - org.slf4j - - - log4j - log4j - - - jdk.tools - jdk.tools - - - hadoop-annotations - org.apache.hadoop - - - guava - com.google.guava - - - commons-cli - commons-cli - - - commons-math3 - org.apache.commons - - - xmlenc - xmlenc - - - commons-httpclient - commons-httpclient - - - commons-collections - commons-collections - - - servlet-api - javax.servlet - - - jetty - org.mortbay.jetty - - - jetty-util - org.mortbay.jetty - - - jersey-core - com.sun.jersey - - - jersey-json - com.sun.jersey - - - jersey-server - com.sun.jersey - - - jasper-compiler - tomcat - - - jasper-runtime - tomcat - - - jsp-api - javax.servlet.jsp - - - commons-el - commons-el - - - jets3t - net.java.dev.jets3t - - - commons-lang - commons-lang - - - commons-configuration - commons-configuration - - - jackson-core-asl - org.codehaus.jackson - - - jackson-mapper-asl - org.codehaus.jackson - - - avro - org.apache.avro - - - protobuf-java - com.google.protobuf - - - gson - com.google.code.gson - - - hadoop-auth - org.apache.hadoop - - - curator-client - org.apache.curator - - - curator-recipes - org.apache.curator - - - jsr305 - com.google.code.findbugs - - - htrace-core - org.htrace - - - zookeeper - org.apache.zookeeper - - - - - org.apache.hadoop - hadoop-hdfs - 2.6.0 - test-jar - test - - - commons-daemon - commons-daemon - - - log4j - log4j - - - netty - io.netty - - - xercesImpl - xerces - - - guava - com.google.guava - - - jetty - org.mortbay.jetty - - - jetty-util - org.mortbay.jetty - - - jersey-core - com.sun.jersey - - - jersey-server - com.sun.jersey - - - commons-cli - commons-cli - - - commons-lang - commons-lang - - - jsp-api - javax.servlet.jsp - - - protobuf-java - com.google.protobuf - - - servlet-api - javax.servlet - - - jackson-core-asl - org.codehaus.jackson - - - jackson-mapper-asl - org.codehaus.jackson - - - jasper-runtime - tomcat - - - xmlenc - xmlenc - - - htrace-core - org.htrace - - - - - javax.ws.rs - jsr311-api - 1.1.1 - test - - - - ${basedir}/.. - - - diff --git a/core/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java b/core/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java deleted file mode 100644 index bd6cba9947..0000000000 --- a/core/src/main/java/org/apache/commons/vfs2/provider/FileContentThreadData.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.vfs2.provider; - -import java.io.InputStream; -import java.util.ArrayList; - -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.RandomAccessContent; - -/** - * Holds the data which needs to be local to the current thread - */ -class FileContentThreadData -{ - // private int state = DefaultFileContent.STATE_CLOSED; - - private final ArrayList instrs = new ArrayList<>(); - private final ArrayList rastrs = new ArrayList<>(); - private DefaultFileContent.FileContentOutputStream outstr; - - FileContentThreadData() - { - } - - /* - int getState() - { - return state; - } - - void setState(int state) - { - this.state = state; - } - */ - - void addInstr(final InputStream is) - { - this.instrs.add(is); - } - - void setOutstr(final DefaultFileContent.FileContentOutputStream os) - { - this.outstr = os; - } - - DefaultFileContent.FileContentOutputStream getOutstr() - { - return this.outstr; - } - - void addRastr(final RandomAccessContent ras) - { - this.rastrs.add(ras); - } - - int getInstrsSize() - { - return this.instrs.size(); - } - - public Object removeInstr(final int pos) - { - return this.instrs.remove(pos); - } - - public void removeInstr(final InputStream instr) - { - this.instrs.remove(instr); - } - - public Object removeRastr(final int pos) - { - return this.rastrs.remove(pos); - } - - public void removeRastr(final RandomAccessContent ras) - { - this.rastrs.remove(ras); - } - - public boolean hasStreams() - { - return instrs.size() > 0 || outstr != null || rastrs.size() > 0; - } - - public void closeOutstr() throws FileSystemException - { - outstr.close(); - outstr = null; - } - - int getRastrsSize() - { - return rastrs.size(); - } -} diff --git a/core/src/main/java/org/apache/commons/vfs2/provider/URLFileName.java b/core/src/main/java/org/apache/commons/vfs2/provider/URLFileName.java deleted file mode 100644 index 6bbf782e5f..0000000000 --- a/core/src/main/java/org/apache/commons/vfs2/provider/URLFileName.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.vfs2.provider; - -import java.net.URI; -import java.net.URISyntaxException; - -import org.apache.commons.vfs2.FileName; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.FileType; -import org.apache.http.client.utils.URIBuilder; - -/** - * A file name that represents URL. - * @author Commons VFS team - */ -public class URLFileName extends GenericFileName -{ - private static final int BUFFSZ = 250; - - private final String queryString; - - public URLFileName(final String scheme, - final String hostName, - final int port, - final int defaultPort, - final String userName, - final String password, - final String path, - final FileType type, - final String queryString) - { - super(scheme, hostName, port, defaultPort, userName, password, path, type); - this.queryString = queryString; - } - - /** - * Get the query string. - * - * @return the query string part of the filename - */ - public String getQueryString() - { - return queryString; - } - - /** - * Get the path and query string e.g. /path/servlet?param1=true. - * - * @return the path and its query string - */ - public String getPathQuery() - { - final StringBuilder sb = new StringBuilder(BUFFSZ); - sb.append(getPath()); - String query = getQueryString(); - if (query != null) - { - sb.append("?"); - sb.append(getQueryString()); - } - - return sb.toString(); - } - - /** - * Create a FileName. - * @param absPath The absolute path. - * @param type The FileType. - * @return The FileName - */ - @Override - public FileName createName(final String absPath, final FileType type) - { - return new URLFileName(getScheme(), - getHostName(), - getPort(), - getDefaultPort(), - getUserName(), - getPassword(), - absPath, - type, - getQueryString()); - } - - private String getQueryEncoded() { - final char[] QUERY_RESERVED = {'?','+'}; - String query = getQueryString(); - if (query == null) { - return null; - } - - return UriParser.encode(query, QUERY_RESERVED); - } - - public String getPathQueryEncoded() throws FileSystemException, URISyntaxException { - - String path = getPathDecoded(); - String query = getQueryString(); - - URI uri = new URI(null, null, null, -1, path, query, null); - - return uri.toString(); - } - - /** - * Append query string to the uri. - * - * @return the uri - */ - @Override - protected String createURI() - { - String out = null; - - // URI uri; - // try - // { - // // there seems to be a bug in java.net.URI if there's a colon in the username or password - // uri = new URI(getScheme(), getUserInfo(), getHostName(), getCorrectedPort(), - // getPath(), getQueryString(), null); - // out = uri.toURL().toString(); - // } - // catch (Exception e) - // { - // } - - try { - URIBuilder builder = new URIBuilder(super.getRootURI()); - String path = getPathDecoded(); - if (path != null) { - builder.setPath(path); - } - String query = getQueryString(); - if (query != null) { - builder.setCustomQuery(query); - } - out = builder.toString(); - } catch (Exception e) { - StringBuilder builder = new StringBuilder(); - appendRootUri(builder, true); - String path = getPath(); - if (path != null) { - builder.append(path); - } - String query = getQueryString(); - if (query != null) { - builder.append("?"); - builder.append(getQueryEncoded()); - } - out = builder.toString(); - } - - return out; - - } - -} diff --git a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileContentInfoFactory.java b/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileContentInfoFactory.java deleted file mode 100644 index db30d96125..0000000000 --- a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileContentInfoFactory.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package org.apache.commons.vfs2.provider.http; - -import java.io.IOException; - -import org.apache.commons.vfs2.FileContent; -import org.apache.commons.vfs2.FileContentInfo; -import org.apache.commons.vfs2.FileContentInfoFactory; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.impl.DefaultFileContentInfo; -import org.apache.commons.vfs2.util.FileObjectUtils; -import org.apache.http.Header; -import org.apache.http.HeaderElement; -import org.apache.http.HttpResponse; -import org.apache.http.entity.ContentType; - -/** - * Creates FileContentInfo instances for HTTP. - */ -public class HttpFileContentInfoFactory - implements FileContentInfoFactory -{ - @Override - public FileContentInfo create( final FileContent fileContent ) - throws FileSystemException - { - final HttpFileObject httpFile = (HttpFileObject) FileObjectUtils - .getAbstractFileObject( fileContent.getFile() ); - - String contentType = null; - String contentEncoding = null; - - HttpResponse headResponse = null; - try - { - headResponse = httpFile.getHeadResponse(); - } - catch ( IOException e ) - { - throw new FileSystemException( e ); - } - - final Header[] headers = headResponse.getHeaders( "content-type" ); - if ( headers != null && headers.length > 0 ) - { - Header header = headers[0]; - - HeaderElement[] element = header.getElements(); - if ( element != null && element.length > 0 ) - { - contentType = element[0].getName(); - } - } - - ContentType ct = ContentType.getOrDefault( headResponse.getEntity() ); - contentEncoding = ct.getCharset().displayName(); - - return new DefaultFileContentInfo( contentType, contentEncoding ); - } -} diff --git a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java b/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java deleted file mode 100644 index 53e4cbbba0..0000000000 --- a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileObject.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.vfs2.provider.http; - -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Map; - -import org.apache.commons.vfs2.FileContentInfoFactory; -import org.apache.commons.vfs2.FileNotFoundException; -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.FileType; -import org.apache.commons.vfs2.RandomAccessContent; -import org.apache.commons.vfs2.provider.AbstractFileName; -import org.apache.commons.vfs2.provider.AbstractFileObject; -import org.apache.commons.vfs2.provider.URLFileName; -import org.apache.commons.vfs2.util.MonitorInputStream; -import org.apache.commons.vfs2.util.RandomAccessMode; -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.client.utils.DateUtils; - -/** - * A file object backed by Apache HttpComponents. - *

      - * TODO - status codes. - * - * @param An {@link HttpFileSystem} subclass - */ -public class HttpFileObject - extends AbstractFileObject -{ - /** - * An InputStream that cleans up the HTTP connection on close. - */ - static class HttpInputStream - extends MonitorInputStream - { - private final HttpResponse response; - - public HttpInputStream( final HttpResponse response ) - throws IOException - { - super( response.getEntity().getContent() ); - this.response = response; - } - - /** - * Called after the stream has been closed. - */ - @Override - protected void onClose() - throws IOException - { - if ( response instanceof CloseableHttpResponse ) - { - ( (CloseableHttpResponse) response ).close(); - } - } - } - - private HttpResponse headResponse; - - protected HttpFileObject( final AbstractFileName name, final FS fileSystem ) - { - this( name, fileSystem, HttpFileSystemConfigBuilder.getInstance() ); - } - - protected HttpFileObject( final AbstractFileName name, final FS fileSystem, - final HttpFileSystemConfigBuilder builder ) - { - super( name, fileSystem ); - headResponse = null; - } - - /** - * Detaches this file object from its file resource. - */ - @Override - protected void doDetach() - throws Exception - { - headResponse = null; - } - - /** - * Returns the size of the file content (in bytes). - */ - @Override - protected long doGetContentSize() - throws Exception - { - if ( headResponse == null ) - { - return 0; - } - - final Header[] headers = headResponse.getHeaders( "content-length" ); - - if ( headers == null || headers.length == 0 ) - { - // Assume 0 content-length - return 0; - } - - // return first response - return Long.parseLong( headers[0].getValue() ); - } - - /** - * Creates an input stream to read the file content from. Is only called - * if {@link #doGetType} returns {@link FileType#FILE}. - *

      - * It is guaranteed that there are no open output streams for this file - * when this method is called. - *

      - * The returned stream does not have to be buffered. - */ - @Override - protected InputStream doGetInputStream() - throws Exception - { - final HttpGet getMethod = new HttpGet(); - setupMethod( getMethod ); - - HttpResponse getResponse = getAbstractFileSystem().getClient().execute( getMethod ); - - final int status = getResponse.getStatusLine().getStatusCode(); - - if ( status == HttpURLConnection.HTTP_NOT_FOUND ) - { - throw new FileNotFoundException( getName() ); - } - if ( status != HttpURLConnection.HTTP_OK ) - { - throw new FileSystemException( "vfs.provider.http/get.error", getName(), Integer.valueOf( status ) ); - } - - return new HttpInputStream( getResponse ); - } - - /** - * Returns the last modified time of this file. - *

      - * This implementation throws an exception. - */ - @Override - protected long doGetLastModifiedTime() - throws Exception - { - if ( headResponse == null ) - { - return 0; - } - - final Header[] headers = headResponse.getHeaders( "last-modified" ); - if ( headers == null || headers.length == 0 ) - { - throw new FileSystemException( "vfs.provider.http/last-modified.error", getName() ); - } - return DateUtils.parseDate( headers[0].getValue() ).getTime(); - } - - @Override - protected RandomAccessContent doGetRandomAccessContent( final RandomAccessMode mode ) - throws Exception - { - return new HttpRandomAccessContent( this, mode ); - } - - /** - * Determines the type of this file. Must not return null. The return - * value of this method is cached, so the implementation can be expensive. - */ - @Override - protected FileType doGetType() - throws Exception - { - // Use the HEAD method to probe the file. - HttpResponse headResponse = getHeadResponse(); - final int status = headResponse.getStatusLine().getStatusCode(); - - if ( status == HttpURLConnection.HTTP_OK - || status == HttpURLConnection.HTTP_BAD_METHOD /* method is bad, but resource exist */ ) - { - // return FileType.FILE_OR_FOLDER; // we can't know which from head only - return FileType.FILE; // assume FILE, since tests rely on it - } - else if ( status == HttpURLConnection.HTTP_NOT_FOUND || status == HttpURLConnection.HTTP_GONE ) - { - return FileType.IMAGINARY; - } - else - { - throw new FileSystemException( "vfs.provider.http/head.error", getName(), Integer.valueOf( status ) ); - } - } - - @Override - protected boolean doIsWriteable() - throws Exception - { - return false; - } - - /** - * Lists the children of this file. - */ - @Override - protected String[] doListChildren() - throws Exception - { - throw new Exception( "Not implemented." ); - } - - @Override - protected FileContentInfoFactory getFileContentInfoFactory() - { - return new HttpFileContentInfoFactory(); - } - - HttpResponse getHeadResponse() throws IOException - { - if ( headResponse != null ) - { - return headResponse; - } - - // Use the HEAD method to probe the file. - HttpHead method = new HttpHead(); - setupMethod( method ); - final HttpConnectionClient client = getAbstractFileSystem().getClient(); - - // final int status = client.execute(method); - headResponse = client.execute( method ); - return headResponse; - } - - /** - * Prepares a Request object. - * @param method the HTTP method to configure - * @throws FileSystemException if there is any error in building the request (e.g. an invalid url syntax) - * @since 2.0 (was package) - */ - protected void setupMethod( final HttpRequestBase method ) - throws FileSystemException - { - URLFileName file = ( (URLFileName) getName() ); - URI uri = null; - - try - { - // technically I only need the relative path/query - uri = new URI( null, null, file.getPathDecoded(), file.getQueryString(), null ); - } - catch ( URISyntaxException se ) - { - throw new FileSystemException( "Invalid URI syntax", se ); - } - method.setURI( uri ); - - } - - @Override - protected Map doGetAttributes() - throws Exception - { - return super.doGetAttributes(); - } - - /* - protected Map doGetAttributes() throws Exception - { - TreeMap map = new TreeMap(); - - Header contentType = method.getResponseHeader("content-type"); - if (contentType != null) - { - HeaderElement[] element = contentType.getValues(); - if (element != null && element.length > 0) - { - map.put("content-type", element[0].getName()); - } - } - - map.put("content-encoding", method.getResponseCharSet()); - return map; - } - */ -} diff --git a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystem.java b/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystem.java deleted file mode 100644 index c209bd3c43..0000000000 --- a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileSystem.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package org.apache.commons.vfs2.provider.http; - -import java.util.Collection; - -import org.apache.commons.vfs2.Capability; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.FileSystemOptions; -import org.apache.commons.vfs2.provider.AbstractFileName; -import org.apache.commons.vfs2.provider.AbstractFileSystem; -import org.apache.commons.vfs2.provider.GenericFileName; - -/** - * An HTTP file system. - */ -public class HttpFileSystem - extends AbstractFileSystem -{ - private final HttpConnectionClientManager clientManager; - - private final HttpConnectionClient client; // single client for all communications - - protected HttpFileSystem( final GenericFileName rootName, final HttpConnectionClientManager clientManager, - final FileSystemOptions fileSystemOptions ) - { - super( rootName, null, fileSystemOptions ); - this.clientManager = clientManager; - this.client = clientManager.createClient(); - } - - /** - * Adds the capabilities of this file system. - */ - @Override - protected void addCapabilities( final Collection caps ) - { - caps.addAll( HttpFileProvider.capabilities ); - } - - protected HttpConnectionClientManager getClientManager() - { - return clientManager; - } - - protected HttpConnectionClient getClient() - { - return client; - } - - /** @since 2.0 */ - @Override - public void closeCommunicationLink() - { - HttpConnectionClientManager manager = getClientManager(); - if ( manager != null ) - { - manager.shutdown(); - } - } - - /** - * Creates a file object. This method is called only if the requested - * file is not cached. - */ - @Override - protected FileObject createFile( final AbstractFileName name ) - throws Exception - { - return new HttpFileObject( name, this ); - } -} diff --git a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java b/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java deleted file mode 100644 index 34f263e8a8..0000000000 --- a/core/src/main/java/org/apache/commons/vfs2/provider/http/HttpRandomAccessContent.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package org.apache.commons.vfs2.provider.http; - -import java.io.DataInputStream; -import java.io.FilterInputStream; -import java.io.IOException; -import java.net.HttpURLConnection; - -import org.apache.commons.vfs2.FileSystemException; -import org.apache.commons.vfs2.provider.AbstractRandomAccessStreamContent; -import org.apache.commons.vfs2.util.MonitorInputStream; -import org.apache.commons.vfs2.util.RandomAccessMode; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; - -/** - * RandomAccess content using HTTP. - */ -class HttpRandomAccessContent - extends AbstractRandomAccessStreamContent -{ - protected long filePointer = 0; - - private final HttpFileObject fileObject; - - private final HttpFileSystem fileSystem; - - private DataInputStream dis = null; - - private MonitorInputStream mis = null; - - HttpRandomAccessContent( final HttpFileObject fileObject, final RandomAccessMode mode ) - { - super( mode ); - - this.fileObject = fileObject; - fileSystem = (HttpFileSystem) this.fileObject.getFileSystem(); - } - - @Override - public long getFilePointer() - throws IOException - { - return filePointer; - } - - @Override - public void seek( final long pos ) - throws IOException - { - if ( pos == filePointer ) - { - // no change - return; - } - - if ( pos < 0 ) - { - throw new FileSystemException( "vfs.provider/random-access-invalid-position.error", Long.valueOf( pos ) ); - } - if ( dis != null ) - { - close(); - } - - filePointer = pos; - } - - @Override - protected DataInputStream getDataInputStream() - throws IOException - { - if ( dis != null ) - { - return dis; - } - - final HttpGet getMethod = new HttpGet(); - fileObject.setupMethod( getMethod ); - getMethod.setHeader( "Range", "bytes=" + filePointer + "-" ); - - HttpResponse response = fileSystem.getClient().execute( getMethod ); - int status = response.getStatusLine().getStatusCode(); - - if ( status != HttpURLConnection.HTTP_PARTIAL && status != HttpURLConnection.HTTP_OK ) - { - throw new FileSystemException( "vfs.provider.http/get-range.error", fileObject.getName(), - Long.valueOf( filePointer ), Integer.valueOf( status ) ); - } - - mis = new HttpFileObject.HttpInputStream( response ); - // If the range request was ignored - if ( status == HttpURLConnection.HTTP_OK ) - { - final long skipped = mis.skip( filePointer ); - if ( skipped != filePointer ) - { - throw new FileSystemException( "vfs.provider.http/get-range.error", fileObject.getName(), - Long.valueOf( filePointer ), Integer.valueOf( status ) ); - } - } - dis = new DataInputStream( new FilterInputStream( mis) - { - @Override - public int read() - throws IOException - { - final int ret = super.read(); - if ( ret > -1 ) - { - filePointer++; - } - return ret; - } - - @Override - public int read( final byte[] b ) - throws IOException - { - final int ret = super.read( b ); - if ( ret > -1 ) - { - filePointer += ret; - } - return ret; - } - - @Override - public int read( final byte[] b, final int off, final int len ) - throws IOException - { - final int ret = super.read( b, off, len ); - if ( ret > -1 ) - { - filePointer += ret; - } - return ret; - } - } ); - - return dis; - } - - @Override - public void close() - throws IOException - { - if ( dis != null ) - { - dis.close(); - dis = null; - mis = null; - } - } - - @Override - public long length() throws IOException - { - return fileObject.getContent().getSize(); - } -} diff --git a/core/src/test/java/org/apache/commons/vfs2/provider/tar/test/LargeTarTestCase.java b/core/src/test/java/org/apache/commons/vfs2/provider/tar/test/LargeTarTestCase.java deleted file mode 100644 index 3f21084737..0000000000 --- a/core/src/test/java/org/apache/commons/vfs2/provider/tar/test/LargeTarTestCase.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.vfs2.provider.tar.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.compress.archivers.ArchiveStreamFactory; -import org.apache.commons.compress.archivers.tar.TarArchiveEntry; -import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; -import org.apache.commons.compress.compressors.CompressorStreamFactory; -import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; -import org.apache.commons.compress.utils.IOUtils; -import org.apache.commons.vfs2.CacheStrategy; -import org.apache.commons.vfs2.FileObject; -import org.apache.commons.vfs2.cache.SoftRefFilesCache; -import org.apache.commons.vfs2.impl.DefaultFileSystemManager; -import org.apache.commons.vfs2.provider.local.DefaultLocalFileProvider; -import org.apache.commons.vfs2.provider.tar.TarFileProvider; -import org.junit.Before; -import org.junit.Test; - -//@SuppressWarnings("nls") -public class LargeTarTestCase { - private final static String baseDir = "target/test-classes/test-data/"; - - private DefaultFileSystemManager manager; - private final static String largeFilePath = baseDir; - private final static String largeFileName = "largefile"; - - - @Before -public void setUp() throws Exception { - manager = new DefaultFileSystemManager(); - - manager.setFilesCache(new SoftRefFilesCache()); - manager.setCacheStrategy(CacheStrategy.ON_RESOLVE); - - manager.addProvider("file", new DefaultLocalFileProvider()); - manager.addProvider("tgz", new TarFileProvider()); - manager.addProvider("tar", new TarFileProvider()); - - new File(baseDir).mkdir(); // if test is run standalone - createLargeFile(largeFilePath, largeFileName); - } - - @Test - public void testLargeFile() throws Exception { - final File realFile = new File(largeFilePath + largeFileName + ".tar.gz"); - - final FileObject file = manager.resolveFile("tgz:file://" + realFile.getCanonicalPath() + "!/"); - - assertNotNull(file); - final List files = Arrays.asList(file.getChildren()); - - assertNotNull(files); - assertEquals(1, files.size()); - final FileObject f = files.get(0); - - assertTrue("Expected file not found: " + largeFileName + ".txt", - f.getName().getBaseName().equals(largeFileName + ".txt")); - } - -/* - public void testFileCheck() throws Exception { - String[] expectedFiles = { - "plugins.tsv", - "languages.tsv", - "browser_type.tsv", - "timezones.tsv", - "color_depth.tsv", - "resolution.tsv", - "connection_type.tsv", - "search_engines.tsv", - "javascript_version.tsv", - "operating_systems.tsv", - "country.tsv", - "browser.tsv" - }; - - fileCheck(expectedFiles, "tar:file://c:/temp/data/data/data-small.tar"); - } */ - - protected void fileCheck(final String[] expectedFiles, final String tarFile) throws Exception { - assertNotNull(manager); - final FileObject file = manager.resolveFile(tarFile); - - assertNotNull(file); - final List files = Arrays.asList(file.getChildren()); - - assertNotNull(files); - for (final String expectedFile : expectedFiles) - { - assertTrue("Expected file not found: " + expectedFile, fileExists(expectedFile, files)); - } - } - - /** - * Search for the expected file in a given list, without using the full path. - * - * @param expectedFile the expected file. - * @param files a list of files to search. - * @return {@code true} if {@code expectedFile} is in {@code files}. - */ - protected boolean fileExists(final String expectedFile, final List files) - { - for (final FileObject file : files) - { - if (file.getName().getBaseName().equals(expectedFile)) - { - return true; - } - } - return false; - } - - protected boolean endsWith(final String testString, final String[] testList) - { - for (final String string : testList) - { - if (testString.endsWith(string)) - { - return true; - } - } - return false; - } - - //@SuppressWarnings("unused") - protected void createLargeFile(final String path, final String name) throws Exception { - final long _1K = 1024; - final long _1M = 1024 * _1K; -// long _256M = 256 * _1M; -// long _512M = 512 * _1M; - final long _1G = 1024 * _1M; - - // File size of 3 GB - final long fileSize = 3 * _1G; - - final File tarGzFile = new File(path + name + ".tar.gz"); - - if(!tarGzFile.exists()) { - System.out.println("This test is a bit slow. It needs to write 3GB of data as a compressed file (approx. 3MB) to your hard drive"); - - final PipedOutputStream outTarFileStream = new PipedOutputStream(); - final PipedInputStream inTarFileStream = new PipedInputStream(outTarFileStream); - - final Thread source = new Thread(){ - - @Override - public void run() { - final byte ba_1k[] = new byte[(int) _1K]; - for(int i=0; i < ba_1k.length; i++){ - ba_1k[i]='a'; - } - try { - final TarArchiveOutputStream outTarStream = - (TarArchiveOutputStream)new ArchiveStreamFactory() - .createArchiveOutputStream(ArchiveStreamFactory.TAR, outTarFileStream); - // Create archive contents - final TarArchiveEntry tarArchiveEntry = new TarArchiveEntry(name + ".txt"); - tarArchiveEntry.setSize(fileSize); - - outTarStream.putArchiveEntry(tarArchiveEntry); - for(long i = 0; i < fileSize; i+= ba_1k.length) { - outTarStream.write(ba_1k); - } - outTarStream.closeArchiveEntry(); - outTarStream.close(); - outTarFileStream.close(); - } catch (final Exception e) { - e.printStackTrace(); - } - } - - }; - source.start(); - - // Create compressed archive - final OutputStream outGzipFileStream = new FileOutputStream(path + name + ".tar.gz"); - - final GzipCompressorOutputStream outGzipStream = (GzipCompressorOutputStream)new CompressorStreamFactory() - .createCompressorOutputStream(CompressorStreamFactory.GZIP, outGzipFileStream); - - IOUtils.copy(inTarFileStream, outGzipStream); - inTarFileStream.close(); - - outGzipStream.close(); - outGzipFileStream.close(); - - } - } -} diff --git a/core/src/test/java/org/apache/commons/vfs2/util/NHttpServer.java b/core/src/test/java/org/apache/commons/vfs2/util/NHttpServer.java deleted file mode 100644 index 88fac7b2f8..0000000000 --- a/core/src/test/java/org/apache/commons/vfs2/util/NHttpServer.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.commons.vfs2.util; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InterruptedIOException; -import java.net.InetSocketAddress; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLDecoder; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.util.Date; -import java.util.Locale; -import java.util.concurrent.Executors; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; - -import org.apache.commons.httpclient.util.DateUtil; -import org.apache.commons.io.IOUtils; -import org.apache.http.HttpException; -import org.apache.http.HttpHeaders; -import org.apache.http.HttpRequest; -import org.apache.http.HttpResponse; -import org.apache.http.HttpResponseInterceptor; -import org.apache.http.HttpStatus; -import org.apache.http.MethodNotSupportedException; -import org.apache.http.config.ConnectionConfig; -import org.apache.http.entity.ContentType; -import org.apache.http.impl.DefaultConnectionReuseStrategy; -import org.apache.http.impl.DefaultHttpResponseFactory; -import org.apache.http.impl.nio.DefaultHttpServerIODispatch; -import org.apache.http.impl.nio.DefaultNHttpServerConnection; -import org.apache.http.impl.nio.DefaultNHttpServerConnectionFactory; -import org.apache.http.impl.nio.SSLNHttpServerConnectionFactory; -import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor; -import org.apache.http.nio.NHttpConnection; -import org.apache.http.nio.NHttpConnectionFactory; -import org.apache.http.nio.NHttpServerConnection; -import org.apache.http.nio.entity.NFileEntity; -import org.apache.http.nio.entity.NStringEntity; -import org.apache.http.nio.protocol.BasicAsyncRequestConsumer; -import org.apache.http.nio.protocol.BasicAsyncResponseProducer; -import org.apache.http.nio.protocol.HttpAsyncExchange; -import org.apache.http.nio.protocol.HttpAsyncRequestConsumer; -import org.apache.http.nio.protocol.HttpAsyncRequestHandler; -import org.apache.http.nio.protocol.HttpAsyncService; -import org.apache.http.nio.protocol.UriHttpAsyncRequestHandlerMapper; -import org.apache.http.nio.reactor.IOEventDispatch; -import org.apache.http.nio.reactor.IOReactorException; -import org.apache.http.nio.reactor.ListeningIOReactor; -import org.apache.http.protocol.HttpContext; -import org.apache.http.protocol.HttpCoreContext; -import org.apache.http.protocol.HttpProcessor; -import org.apache.http.protocol.ImmutableHttpProcessor; -import org.apache.http.protocol.ResponseConnControl; -import org.apache.http.protocol.ResponseContent; -import org.apache.http.protocol.ResponseDate; -import org.apache.http.protocol.ResponseServer; - -/** - * Adapted from org.apache.http.examples.nio.NHttpServer. - * - *

      - * HTTP/1.1 file server based on the non-blocking I/O model and capable of direct channel (zero copy) data transfer. - *

      - *

      - * Please note the purpose of this application is demonstrate the usage of HttpCore APIs. It is NOT intended to - * demonstrate the most efficient way of building an HTTP server. - *

      - * - * @version $Id$ - * @since 2.1 - */ -public class NHttpServer -{ - - static class HttpFileHandler implements HttpAsyncRequestHandler - { - - private final File docRoot; - - public HttpFileHandler(final File docRoot) - { - super(); - this.docRoot = docRoot; - } - - @Override - public void handle(final HttpRequest request, final HttpAsyncExchange httpexchange, final HttpContext context) - throws HttpException, IOException - { - final HttpResponse response = httpexchange.getResponse(); - this.handleInternal(request, response, context); - httpexchange.submitResponse(new BasicAsyncResponseProducer(response)); - } - - private void handleInternal(final HttpRequest request, final HttpResponse response, final HttpContext context) - throws HttpException, IOException - { - - final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH); - if (!method.equals("GET") && !method.equals("HEAD") && !method.equals("POST")) - { - throw new MethodNotSupportedException(method + " method not supported"); - } - - final String target = request.getRequestLine().getUri(); - final File file = new File(this.docRoot, URLDecoder.decode(target, "UTF-8")); - if (!file.exists()) - { - - response.setStatusCode(HttpStatus.SC_NOT_FOUND); - final NStringEntity entity = new NStringEntity("

      File" + file.getPath() - + " not found

      ", ContentType.create("text/html", "UTF-8")); - response.setEntity(entity); - NHttpServer.debug("File " + file.getPath() + " not found"); - - } else if (!file.canRead()) - { - - response.setStatusCode(HttpStatus.SC_FORBIDDEN); - final NStringEntity entity = new NStringEntity("

      Access denied

      ", - ContentType.create("text/html", "UTF-8")); - response.setEntity(entity); - NHttpServer.debug("Cannot read file " + file.getPath()); - - } else - { - final NHttpConnection conn = (NHttpConnection) context.getAttribute(HttpCoreContext.HTTP_CONNECTION); - response.setStatusCode(HttpStatus.SC_OK); - final NFileEntity body = new NFileEntity(file, ContentType.create("text/html")); - response.setEntity(body); - if (!response.containsHeader(HttpHeaders.LAST_MODIFIED)) - { - response.addHeader(HttpHeaders.LAST_MODIFIED, DateUtil.formatDate(new Date(file.lastModified()))); - } - NHttpServer.debug(conn + ": serving file " + file.getPath()); - } - } - - @Override - public HttpAsyncRequestConsumer processRequest(final HttpRequest request, final HttpContext context) - { - // Buffer request content in memory for simplicity - return new BasicAsyncRequestConsumer(); - } - - } - - static final boolean Debug = false; - - private static void debug(final String s) - { - if (Debug) - { - System.out.println(s); - } - } - - public static void main(final String[] args) throws Exception - { - new NHttpServer().run(Integer.valueOf(args[0]), new File(args[1]), 0); - } - - volatile ListeningIOReactor ioReactor; - - public boolean run(final int port, final File docRoot, final long waitMillis) throws IOReactorException, - InterruptedException - { - Executors.newSingleThreadExecutor().execute(new Runnable() - { - @Override - public void run() - { - try - { - NHttpServer.this.runBlock(port, docRoot); - } catch (final IOReactorException e) - { - throw new IllegalStateException(e); - } catch (final UnrecoverableKeyException e) - { - throw new IllegalStateException(e); - } catch (final KeyStoreException e) - { - throw new IllegalStateException(e); - } catch (final NoSuchAlgorithmException e) - { - throw new IllegalStateException(e); - } catch (final CertificateException e) - { - throw new IllegalStateException(e); - } catch (final IOException e) - { - throw new IllegalStateException(e); - } catch (final KeyManagementException e) - { - throw new IllegalStateException(e); - } - } - }); - return this.waitForServerStartup(port, waitMillis); - } - - public void runBlock(final int port, final File docRoot) throws KeyStoreException, NoSuchAlgorithmException, - CertificateException, IOException, UnrecoverableKeyException, KeyManagementException - { - if (docRoot == null) - { - throw new IllegalArgumentException("No doc root specified."); - } - // HTTP parameters for the server - // final SocketConfig socketConfig; - // SocketConfig.Builder socketBuilder = SocketConfig.custom(); - // socketBuilder.setSoTimeout(5000); - // socketBuilder.setRcvBufSize(8*1024); - // socketBuilder.setTcpNoDelay(true); - // socketConfig = socketBuilder.build(); - - final ConnectionConfig connConfig; - ConnectionConfig.Builder connBuilder = ConnectionConfig.custom(); - connConfig = connBuilder.build(); - - // final HttpParams params = new SyncBasicHttpParams(); - // params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000) - // .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024) - // .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true) - // .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpTest/1.1"); - - // Create HTTP protocol processing chain - final HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] - { - // Use standard server-side protocol interceptors - new ResponseDate(), - new ResponseServer(), - new ResponseContent(), - new ResponseConnControl() }); - // Create request handler registry - UriHttpAsyncRequestHandlerMapper reqistryMapper = new UriHttpAsyncRequestHandlerMapper(); - // Register the default handler for all URIs - reqistryMapper.register("*", new HttpFileHandler(docRoot)); - // Create server-side HTTP protocol handler - - final HttpAsyncService protocolHandler = new HttpAsyncService(httpproc, new DefaultConnectionReuseStrategy(), - DefaultHttpResponseFactory.INSTANCE, reqistryMapper, null) - { - - @Override - public void closed(final NHttpServerConnection conn) - { - NHttpServer.debug(conn + ": connection closed"); - super.closed(conn); - } - - @Override - public void connected(final NHttpServerConnection conn) - { - NHttpServer.debug(conn + ": connection open"); - super.connected(conn); - } - - }; - // Create HTTP connection factory - NHttpConnectionFactory connFactory; - if (port == 8443) - { - // Initialize SSL context - final ClassLoader cl = NHttpServer.class.getClassLoader(); - final URL url = cl.getResource("my.keystore"); - if (url == null) - { - NHttpServer.debug("Keystore not found"); - System.exit(1); - } - final KeyStore keystore = KeyStore.getInstance("jks"); - keystore.load(url.openStream(), "secret".toCharArray()); - final KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - kmfactory.init(keystore, "secret".toCharArray()); - final KeyManager[] keymanagers = kmfactory.getKeyManagers(); - final SSLContext sslcontext = SSLContext.getInstance("TLS"); - sslcontext.init(keymanagers, null, null); - connFactory = new SSLNHttpServerConnectionFactory(sslcontext, null, connConfig); - } else - { - connFactory = new DefaultNHttpServerConnectionFactory(connConfig); - } - // Create server-side I/O event dispatch - final IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(protocolHandler, connFactory); - // Create server-side I/O reactor - this.ioReactor = new DefaultListeningIOReactor(); - try - { - // Listen of the given port - this.ioReactor.listen(new InetSocketAddress(port)); - // Ready to go! - this.ioReactor.execute(ioEventDispatch); - } catch (final InterruptedIOException ex) - { - System.err.println("Interrupted"); - } catch (final IOException e) - { - System.err.println("I/O error: " + e.getMessage()); - } - NHttpServer.debug("Shutdown"); - } - - public void stop() throws IOException - { - if (this.ioReactor != null) - { - this.ioReactor.shutdown(2000); - } - } - - private boolean waitForServerStartup(final int port, final long waitMillis) throws InterruptedException - { - final long endWait = System.currentTimeMillis() + waitMillis; - final String urlSpec = "http://localhost:" + port; - try - { - final URL url = new URL(urlSpec); - InputStream inputStream = null; - while (System.currentTimeMillis() < endWait && inputStream == null) - { - try - { - inputStream = url.openStream(); - if (inputStream != null) - { - IOUtils.closeQuietly(inputStream); - return true; - } - } catch (final IOException e) - { - // ignore - // debug("While waiting: " + e); - // e.printStackTrace(); - } - Thread.sleep(100); - } - } catch (final MalformedURLException e) - { - throw new IllegalStateException("Error in test code for URL " + urlSpec); - } - return false; - } - -} diff --git a/pom.xml b/pom.xml index 2264eef9fd..42c4233af5 100644 --- a/pom.xml +++ b/pom.xml @@ -21,25 +21,25 @@ org.apache.commons commons-parent - 40 + 43 4.0.0 - org.apache.commons commons-vfs2-project - Apache Commons VFS + Apache Commons VFS Project Apache Commons VFS is a Virtual File System library. pom - 2.2-SNAPSHOT + 2.2.1-SNAPSHOT http://commons.apache.org/proper/commons-vfs/ 2002 - core - examples - dist + commons-vfs2 + commons-vfs2-examples + commons-vfs2-distribution + jira @@ -47,9 +47,9 @@ - scm:svn:http://svn.apache.org/repos/asf/commons/proper/vfs/tags/commons-vfs2-project-2.1 - scm:svn:https://svn.apache.org/repos/asf/commons/proper/vfs/tags/commons-vfs2-project-2.1 - http://svn.apache.org/viewvc/commons/proper/vfs/tags/commons-vfs2-project-2.1 + scm:svn:http://svn.apache.org/repos/asf/commons/proper/vfs/tags/commons-vfs2-project-2.2 + scm:svn:https://svn.apache.org/repos/asf/commons/proper/vfs/tags/commons-vfs2-project-2.2 + http://svn.apache.org/viewvc/commons/proper/vfs/tags/commons-vfs2-project-2.2 @@ -144,15 +144,16 @@ 1.7 - vfs + vfs2 + org.apache.commons.vfs2 VFS 12310495 https://svn.apache.org/repos/infra/websites/production/commons/content/proper/commons-vfs - 2.1 + 2.2 commons-vfs-${commons.release.version} - (requires Java 1.6+) + (requires Java 1.7+) ${basedir} - 2.13 + 2.17 @@ -171,6 +172,7 @@ false 2.6.0 + 2.19.1 @@ -232,10 +234,26 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + -Xmx64m + + org.apache.maven.plugins maven-checkstyle-plugin ${version.checkstyle} + + + com.puppycrawl.tools + checkstyle + + 6.19 + + @@ -256,7 +274,7 @@ src/test/resources/test-data/**/*.txt src/test/resources/test-data/test.mf - sandbox/** + commons-vfs2-sandbox/** @@ -276,7 +294,7 @@ src/test/resources/test-data/**/*.txt src/test/resources/test-data/test.mf - sandbox/** + commons-vfs2-sandbox/** @@ -323,7 +341,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.3 + 3.8 ${maven.compiler.target} true @@ -383,7 +401,7 @@ commons-net commons-net - 3.5 + 3.6 org.apache.commons @@ -393,7 +411,12 @@ org.apache.commons commons-compress - 1.12 + 1.16.1 + + + org.apache.jackrabbit + jackrabbit-webdav + 1.6.5 org.apache.httpcomponents @@ -413,12 +436,12 @@ com.jcraft jsch - 0.1.53 + 0.1.54 jcifs jcifs - 0.8.3 + 1.3.17 javax.mail @@ -457,13 +480,13 @@ org.apache.commons commons-lang3 - 3.4 + 3.7 org.apache.ftpserver ftpserver-core - 1.0.6 + 1.1.1 org.slf4j @@ -494,6 +517,7 @@ org.apache.mina mina-core + 2.0.7 @@ -504,13 +528,26 @@ commons-io commons-io - 2.5 + 2.6 org.apache.httpcomponents httpcore-nio - 4.3.2 + 4.4.9 + + + + org.apache.jackrabbit + jackrabbit-standalone + 1.6.5 + + + + * + * + + @@ -554,7 +591,7 @@ include-sandbox - sandbox + commons-vfs2-sandbox diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 12decfb3dc..c66f04a10a 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -45,18 +45,71 @@ The type attribute can be add,update,fix,remove. - + - + + PatternFileSelector documentation to describe actual matching against getPath(). + + + Update Apache Commons Compress from 1.15 to 1.16.1. + + + Update Apache Commons Compress from 1.14 to 1.15. + + + SFTP moveTo operation hangs if the server does not support SSH channelExec. + + + Replace use of deprecated APIs in HDFS provider. + + + + + Upgrade to jcifs 1.3.17 + + + Possible NPE in DefaultFileSystemManager. + + + Add a file inverter FileSelector: InvertIncludeFileSelector. + + Update the platform requirement from Java 6 to Java 7. - - + + Update Apache Commons Compress from 1.11 to 1.12. - - + + + Update Apache Commons Compress from 1.12 to 1.13. + + + Update Apache Commons Compress from 1.13 to 1.14. + + + Update from Apache Commons Net 3.5 to 3.6. + + + Update from JCraft jsch for SFTP/SSH from 0.1.53 to 0.1.54. + + + Add API VFS.setManager(FileSystemManager). + + + VFS should not log at the INFO level. + + + FileObject.moveTo(FileObject) API doesn't work well for a Linux FTP. + + + ZIP archives are not properly closed after unzipping and cannot be deleted until the JVM exists. + + + AbstractFileSystem.streamClosed() always sets openStream count to zero. + + Commons Collections - Version 4.0. + Version 4.1. LRU Cache (optional) Commons Compress - Version 1.9. + Version 1.14. TAR, Bzip2 Commons Net - Version 3.3. + Version 3.6. FTP @@ -81,7 +81,7 @@ JSch - Version 0.1.51. + Version 0.1.54. SFTP @@ -93,12 +93,12 @@ Version 2.6.0
      This requires a number of dependencies, use $HADOOP_HOME/bin/hadoop classpath command. - hdfs + HDFS jCIFS - Version 0.8.3. + Version 1.3.17. CIFS (VFS sandbox) @@ -142,9 +142,9 @@

      To build Commons VFS, you can use Maven 3.0.5 or later. - You need to use Java 6 or later (tested with Java 6 - 8). Production builds are done with the - -Pjava-1.6 profile from Commons Parent (which will compile and test with a JDK - from the JAVA_1_6_HOME environment variable). + You need to use Java 7 or later (tested with Java 7 - 8). Production builds are done with the + -Pjava-1.7 profile from Commons Parent (which will compile and test with a JDK + from the JAVA_1_7_HOME environment variable).

      Use mvn clean verify to locally build and test the core and examples modules. This will build the core JAR files in diff --git a/src/site/xdoc/download_vfs.xml b/src/site/xdoc/download_vfs2.xml similarity index 83% rename from src/site/xdoc/download_vfs.xml rename to src/site/xdoc/download_vfs2.xml index 13e449b025..2dda0d5961 100644 --- a/src/site/xdoc/download_vfs.xml +++ b/src/site/xdoc/download_vfs2.xml @@ -1,154 +1,154 @@ - - - - - - Download Apache Commons VFS - Apache Commons Documentation Team - - -

      - -

      - We recommend you use a mirror to download our release - builds, but you must verify the integrity of - the downloaded files using signatures downloaded from our main - distribution directories. Recent releases (48 hours) may not yet - be available from all the mirrors. -

      - -

      - You are currently using [preferred]. If you - encounter a problem with this mirror, please select another - mirror. If all mirrors are failing, there are backup - mirrors (at the end of the mirrors list) that should be - available. -

      - [if-any logo][end] -

      - -
      -

      - Other mirrors: - - -

      -
      - -

      - It is essential that you - verify the integrity - of downloaded files, preferably using the PGP signature (*.asc files); - failing that using the MD5 hash (*.md5 checksum files). -

      -

      - The KEYS - file contains the public PGP keys used by Apache Commons developers - to sign releases. -

      -
      -
      -
      - - - - - - - - - - - - -
      commons-vfs-2.1.tar.gzmd5pgp
      commons-vfs-2.1.zipmd5pgp
      -
      - - - - - - - - - - - - -
      commons-vfs-2.1-src.tar.gzmd5pgp
      commons-vfs-2.1-src.zipmd5pgp
      -
      -
      -
      -

      - Older releases can be obtained from the archives. -

      - -
      - - + + + + + + Download Apache Commons VFS Project + Apache Commons Documentation Team + + +
      + +

      + We recommend you use a mirror to download our release + builds, but you must verify the integrity of + the downloaded files using signatures downloaded from our main + distribution directories. Recent releases (48 hours) may not yet + be available from all the mirrors. +

      + +

      + You are currently using [preferred]. If you + encounter a problem with this mirror, please select another + mirror. If all mirrors are failing, there are backup + mirrors (at the end of the mirrors list) that should be + available. +

      + [if-any logo][end] +

      + +
      +

      + Other mirrors: + + +

      +
      + +

      + It is essential that you + verify the integrity + of downloaded files, preferably using the PGP signature (*.asc files); + failing that using the MD5 hash (*.md5 checksum files). +

      +

      + The KEYS + file contains the public PGP keys used by Apache Commons developers + to sign releases. +

      +
      +
      +
      + + + + + + + + + + + + +
      commons-vfs-2.2.tar.gzmd5pgp
      commons-vfs-2.2.zipmd5pgp
      +
      + + + + + + + + + + + + +
      commons-vfs-2.2-src.tar.gzmd5pgp
      commons-vfs-2.2-src.zipmd5pgp
      +
      +
      +
      +

      + Older releases can be obtained from the archives. +

      + +
      + +
      diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index c30df4669e..a01b4a711f 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -66,12 +66,18 @@

      - Apache Commons VFS 2.1 requires Java 6. Many of the file systems require that optional components be present - in order for the protocol to be enabled. See the download and build page for - information on the optional dependencies. + Many of the file systems require that optional components be present in order for the protocol to be + enabled. See the download and build page for information on the optional + dependencies.

      - Apache Commons VFS 2.0 can be used in a Java 5 runtime. + Apache Commons VFS 2.2 requires Java 7. +

      +

      + Apache Commons VFS 2.1 requires Java 6. +

      +

      + Apache Commons VFS 2.0 requires Java 5.