You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rg...@apache.org on 2009/04/13 06:06:06 UTC
svn commit: r764356 [11/11] - in /commons/proper/vfs/trunk: ./
core/src/main/java/org/apache/commons/vfs/
core/src/main/java/org/apache/commons/vfs/auth/
core/src/main/java/org/apache/commons/vfs/cache/
core/src/main/java/org/apache/commons/vfs/events/...
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileObject.java Mon Apr 13 04:06:01 2009
@@ -76,22 +76,23 @@
* @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
* @version $Revision$
*/
-public class WebdavFileObject
- extends HttpFileObject
- implements FileObject
+public class WebdavFileObject extends HttpFileObject implements FileObject
{
+ /** The character set property name */
+ public static final DavPropertyName RESPONSE_CHARSET = DavPropertyName.create(
+ "response-charset");
+
private final WebdavFileSystem fileSystem;
private final String urlCharset;
- public static final DavPropertyName RESPONSE_CHARSET = DavPropertyName.create("response-charset");
- public final WebdavFileSystemConfigBuilder builder;
- protected WebdavFileObject(final FileName name,
- final WebdavFileSystem fileSystem)
+ /** The FileSystemConfigBuilder */
+ private final WebdavFileSystemConfigBuilder builder;
+
+ protected WebdavFileObject(final FileName name, final WebdavFileSystem fileSystem)
{
super(name, fileSystem);
this.fileSystem = fileSystem;
- builder =
- (WebdavFileSystemConfigBuilder)WebdavFileSystemConfigBuilder.getInstance();
+ builder = (WebdavFileSystemConfigBuilder) WebdavFileSystemConfigBuilder.getInstance();
this.urlCharset = builder.getUrlCharset(getFileSystem().getFileSystemOptions());
}
@@ -104,12 +105,11 @@
* Determines the type of this file. Must not return null. The return
* value of this method is cached, so the implementation can be expensive.
*/
- protected FileType doGetType()
- throws Exception
+ protected FileType doGetType() throws Exception
{
try
{
- return isDirectory((URLFileName)getName()) ? FileType.FOLDER : FileType.FILE;
+ return isDirectory((URLFileName) getName()) ? FileType.FOLDER : FileType.FILE;
}
catch (FileNotFolderException fnfe)
{
@@ -139,23 +139,23 @@
PropFindMethod method = null;
try
{
- URLFileName name = (URLFileName)getName();
- if ( isDirectory( name ) )
+ URLFileName name = (URLFileName) getName();
+ if (isDirectory(name))
{
DavPropertyNameSet nameSet = new DavPropertyNameSet();
- nameSet.add( DavPropertyName.create( DavConstants.PROPERTY_DISPLAYNAME ) );
+ nameSet.add(DavPropertyName.create(DavConstants.PROPERTY_DISPLAYNAME));
- method = new PropFindMethod( urlString(name), nameSet,
- DavConstants.DEPTH_1 );
+ method = new PropFindMethod(urlString(name), nameSet,
+ DavConstants.DEPTH_1);
- execute( method );
+ execute(method);
List vfs = new ArrayList();
- if ( method.succeeded() )
+ if (method.succeeded())
{
MultiStatusResponse[] responses =
method.getResponseBodyAsMultiStatus().getResponses();
- for (int i=0; i < responses.length; ++i)
+ for (int i = 0; i < responses.length; ++i)
{
MultiStatusResponse response = responses[i];
if (isCurrentFile(response.getHref(), name))
@@ -165,10 +165,11 @@
String resourceName = resourceName(response.getHref());
if (resourceName != null && resourceName.length() > 0)
{
- WebdavFileObject fo = (WebdavFileObject)FileObjectUtils.
- getAbstractFileObject(getFileSystem().resolveFile(
- getFileSystem().getFileSystemManager().
- resolveName(getName(), resourceName, NameScope.CHILD)));
+ WebdavFileObject fo = (WebdavFileObject) FileObjectUtils.
+ getAbstractFileObject(getFileSystem().resolveFile(
+ getFileSystem().getFileSystemManager().
+ resolveName(getName(), resourceName,
+ NameScope.CHILD)));
vfs.add(fo);
}
}
@@ -177,22 +178,24 @@
}
throw new FileNotFolderException(getName());
}
- catch ( FileNotFolderException fnfe)
+ catch (FileNotFolderException fnfe)
{
throw fnfe;
}
- catch ( DavException e )
+ catch (DavException e)
{
- throw new FileSystemException( e.getMessage(), e );
+ throw new FileSystemException(e.getMessage(), e);
}
- catch ( IOException e )
+ catch (IOException e)
{
- throw new FileSystemException( e.getMessage(), e );
+ throw new FileSystemException(e.getMessage(), e);
}
finally
{
- if ( method != null )
+ if (method != null)
+ {
method.releaseConnection();
+ }
}
}
@@ -201,7 +204,7 @@
*/
protected void doCreateFolder() throws Exception
{
- DavMethod method = new MkColMethod(urlString((URLFileName)getName()));
+ DavMethod method = new MkColMethod(urlString((URLFileName) getName()));
setupMethod(method);
try
{
@@ -210,7 +213,7 @@
catch (FileSystemException fse)
{
throw new FileSystemException("vfs.provider.webdav/create-collection.error", getName(),
- fse);
+ fse);
}
}
@@ -219,7 +222,7 @@
*/
protected void doDelete() throws Exception
{
- DavMethod method = new DeleteMethod(urlString((URLFileName)getName()));
+ DavMethod method = new DeleteMethod(urlString((URLFileName) getName()));
setupMethod(method);
execute(method);
}
@@ -229,8 +232,8 @@
*/
protected void doRename(FileObject newfile) throws Exception
{
- String url = encodePath(urlString((URLFileName)getName()));
- String dest = urlString((URLFileName)newfile.getName(), false);
+ String url = encodePath(urlString((URLFileName) getName()));
+ String dest = urlString((URLFileName) newfile.getName(), false);
DavMethod method = new MoveMethod(url, dest, false);
setupMethod(method);
execute(method);
@@ -241,9 +244,9 @@
*/
protected long doGetContentSize() throws Exception
{
- DavProperty property = getProperty((URLFileName)getName(),
+ DavProperty property = getProperty((URLFileName) getName(),
DavConstants.PROPERTY_GETCONTENTLENGTH);
- if ( property != null )
+ if (property != null)
{
String value = (String) property.getValue();
return Long.parseLong(value);
@@ -257,9 +260,9 @@
*/
protected long doGetLastModifiedTime() throws Exception
{
- DavProperty property = getProperty((URLFileName)getName(),
+ DavProperty property = getProperty((URLFileName) getName(),
DavConstants.PROPERTY_GETLASTMODIFIED);
- if ( property != null )
+ if (property != null)
{
String value = (String) property.getValue();
return DateUtil.parseDate(value).getTime();
@@ -275,25 +278,25 @@
final Map attributes = new HashMap();
try
{
- URLFileName fileName = (URLFileName)getName();
+ URLFileName fileName = (URLFileName) getName();
DavPropertySet properties = getProperties(fileName, PropFindMethod.PROPFIND_ALL_PROP,
new DavPropertyNameSet(), false);
Iterator iter = properties.iterator();
while (iter.hasNext())
{
- DavProperty property = (DavProperty)iter.next();
+ DavProperty property = (DavProperty) iter.next();
attributes.put(property.getName().toString(), property.getValue());
}
properties = getPropertyNames(fileName);
iter = properties.iterator();
while (iter.hasNext())
{
- DavProperty property = (DavProperty)iter.next();
+ DavProperty property = (DavProperty) iter.next();
if (!attributes.containsKey(property.getName()))
{
property = getProperty(fileName, property.getName());
attributes.put(property.getName().toString(), property.getValue());
- }
+ }
}
return attributes;
}
@@ -315,9 +318,10 @@
/**
* Prepares a Method object.
+ *
* @param method the HttpMethod.
* @throws FileSystemException if an error occurs encoding the uri.
- * @throws URIException if the URI is in error.
+ * @throws URIException if the URI is in error.
*/
protected void setupMethod(final HttpMethod method) throws FileSystemException, URIException
{
@@ -326,10 +330,10 @@
// All the WebDav methods are EntityEnclosingMethods and are not allowed to redirect.
method.setFollowRedirects(false);
method.setRequestHeader("User-Agent", "Jakarta-Commons-VFS");
- method.addRequestHeader( "Cache-control", "no-cache" );
- method.addRequestHeader( "Cache-store", "no-store" );
- method.addRequestHeader( "Pragma", "no-cache" );
- method.addRequestHeader( "Expires", "0" );
+ method.addRequestHeader("Cache-control", "no-cache");
+ method.addRequestHeader("Cache-store", "no-store");
+ method.addRequestHeader("Pragma", "no-cache");
+ method.addRequestHeader("Expires", "0");
}
/**
@@ -344,7 +348,7 @@
{
int status = fileSystem.getClient().executeMethod(method);
if (status == HttpURLConnection.HTTP_NOT_FOUND
- || status == HttpURLConnection.HTTP_GONE)
+ || status == HttpURLConnection.HTTP_GONE)
{
throw new FileNotFoundException(method.getURI());
}
@@ -377,9 +381,9 @@
{
DavProperty property = getProperty(name, DavConstants.PROPERTY_RESOURCETYPE);
Node node;
- if ( property != null && (node = (Node)property.getValue()) != null)
+ if (property != null && (node = (Node) property.getValue()) != null)
{
- return node.getLocalName().equals( DavConstants.XML_COLLECTION );
+ return node.getLocalName().equals(DavConstants.XML_COLLECTION);
}
else
{
@@ -415,7 +419,8 @@
DavPropertySet getProperties(URLFileName name) throws FileSystemException
{
- return getProperties(name, PropFindMethod.PROPFIND_ALL_PROP, new DavPropertyNameSet(), false);
+ return getProperties(name, PropFindMethod.PROPFIND_ALL_PROP, new DavPropertyNameSet(),
+ false);
}
@@ -434,12 +439,12 @@
String urlStr = urlString(name);
PropFindMethod method = new PropFindMethod(urlStr, type, nameSet, DavConstants.DEPTH_0);
setupMethod(method);
- execute( method );
- if ( method.succeeded() )
+ execute(method);
+ if (method.succeeded())
{
MultiStatus multiStatus = method.getResponseBodyAsMultiStatus();
MultiStatusResponse response = multiStatus.getResponses()[0];
- DavPropertySet props = response.getProperties( HttpStatus.SC_OK );
+ DavPropertySet props = response.getProperties(HttpStatus.SC_OK);
if (addEncoding)
{
DavProperty prop = new DefaultDavProperty(RESPONSE_CHARSET,
@@ -462,17 +467,18 @@
/**
* Returns the resource name from the path.
+ *
* @param path the path to the file.
* @return The resource name
*/
- private String resourceName( String path )
+ private String resourceName(String path)
{
if (path.endsWith("/"))
{
- path = path.substring(0, path.length()-1);
+ path = path.substring(0, path.length() - 1);
}
- final int i = path.lastIndexOf( "/" );
- return ( ( i >= 0 ) ? path.substring( i + 1 ) : path );
+ final int i = path.lastIndexOf("/");
+ return (i >= 0) ? path.substring(i + 1) : path;
}
private String urlString(URLFileName name)
@@ -482,7 +488,9 @@
/**
* Convert the FileName to an encoded url String.
+ *
* @param name The FileName.
+ * @param includeUserInfo true if user information should be included.
* @return The encoded URL String.
*/
private String urlString(URLFileName name, boolean includeUserInfo)
@@ -519,6 +527,7 @@
/**
* Convert the FileName to an encoded url String.
+ *
* @param name The FileName.
* @return The encoded URL String.
*/
@@ -559,7 +568,7 @@
protected void onClose() throws IOException
{
RequestEntity entity = new StringRequestEntity(out.toString());
- URLFileName fileName = (URLFileName)getName();
+ URLFileName fileName = (URLFileName) getName();
String urlStr = urlString(fileName);
if (builder.isVersioning(getFileSystem().getFileSystemOptions()))
{
@@ -604,7 +613,7 @@
}
catch (FileSystemException ex)
{
- //
+ // Ignore the exception checking out.
}
}
@@ -645,7 +654,7 @@
}
else
{
- createVersion(urlStr);
+ createVersion(urlStr);
}
}
else
@@ -660,14 +669,14 @@
}
catch (IOException e)
{
-
+ // Ignore the exception if unable to set the user name.
}
}
- ((DefaultFileContent)this.file.getContent()).resetAttributes();
+ ((DefaultFileContent) this.file.getContent()).resetAttributes();
}
private void setUserName(URLFileName fileName, String urlStr)
- throws IOException
+ throws IOException
{
List list = new ArrayList();
String name = builder.getCreatorName(getFileSystem().getFileSystemOptions());
@@ -705,4 +714,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileProvider.java Mon Apr 13 04:06:01 2009
@@ -42,7 +42,15 @@
public class WebdavFileProvider
extends HttpFileProvider
{
- protected final static Collection capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[]
+ /** The authenticator types used by the WebDAV provider */
+ public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[]
+ {
+ UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD
+ };
+
+ /** The capabilities of the WebDAV provider */
+ protected static final Collection capabilities =
+ Collections.unmodifiableCollection(Arrays.asList(new Capability[]
{
Capability.CREATE,
Capability.DELETE,
@@ -58,12 +66,7 @@
Capability.DIRECTORY_READ_CONTENT,
}));
- public final static UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[]
- {
- UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD
- };
-
- public WebdavFileProvider()
+ public WebdavFileProvider()
{
super();
@@ -79,27 +82,29 @@
final GenericFileName rootName = (GenericFileName) name;
FileSystemOptions fsOpts = (fileSystemOptions == null) ? new FileSystemOptions() : fileSystemOptions;
- UserAuthenticationData authData = null;
- HttpClient httpClient;
- try
- {
- authData = UserAuthenticatorUtils.authenticate(fsOpts, AUTHENTICATOR_TYPES);
+ UserAuthenticationData authData = null;
+ HttpClient httpClient;
+ try
+ {
+ authData = UserAuthenticatorUtils.authenticate(fsOpts, AUTHENTICATOR_TYPES);
- httpClient = HttpClientFactory.createConnection(
+ httpClient = HttpClientFactory.createConnection(
WebdavFileSystemConfigBuilder.getInstance(),
"http",
rootName.getHostName(),
- rootName.getPort(),
- UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))),
- UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))),
- fsOpts);
- }
- finally
- {
- UserAuthenticatorUtils.cleanup(authData);
- }
+ rootName.getPort(),
+ UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+ UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))),
+ UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+ UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))),
+ fsOpts);
+ }
+ finally
+ {
+ UserAuthenticatorUtils.cleanup(authData);
+ }
- return new WebdavFileSystem(rootName, httpClient, fsOpts);
+ return new WebdavFileSystem(rootName, httpClient, fsOpts);
}
public FileSystemConfigBuilder getConfigBuilder()
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystem.java Mon Apr 13 04:06:01 2009
@@ -38,7 +38,8 @@
extends HttpFileSystem
implements FileSystem
{
- protected WebdavFileSystem(final GenericFileName rootName, final HttpClient client, final FileSystemOptions fileSystemOptions)
+ protected WebdavFileSystem(final GenericFileName rootName, final HttpClient client,
+ final FileSystemOptions fileSystemOptions)
{
super(rootName, client, fileSystemOptions);
}
@@ -50,6 +51,7 @@
/**
* Returns the capabilities of this file system.
+ * @caps The Capabilities to add.
*/
protected void addCapabilities(final Collection caps)
{
@@ -59,6 +61,8 @@
/**
* Creates a file object. This method is called only if the requested
* file is not cached.
+ * @param name the FileName.
+ * @return The created FileObject.
*/
protected FileObject createFile(final FileName name)
{
@@ -67,8 +71,8 @@
}
/**
- * Return a URLStreamHandler
- * @return
+ * Return a URLStreamHandler.
+ * @return The URLStreamHandler.
*/
public URLStreamHandler getURLStreamHandler()
{
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavFileSystemConfigBuilder.java Mon Apr 13 04:06:01 2009
@@ -21,28 +21,28 @@
/**
* Configuration options for WebDav
- *
+ *
* @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
* @version $Revision$ $Date$
*/
-public class WebdavFileSystemConfigBuilder extends HttpFileSystemConfigBuilder
+public final class WebdavFileSystemConfigBuilder extends HttpFileSystemConfigBuilder
{
- private final static WebdavFileSystemConfigBuilder builder = new WebdavFileSystemConfigBuilder();
+ private static final WebdavFileSystemConfigBuilder BUILDER = new WebdavFileSystemConfigBuilder();
- public static HttpFileSystemConfigBuilder getInstance()
+ private WebdavFileSystemConfigBuilder()
{
- return builder;
+ super("webdav.");
}
- private WebdavFileSystemConfigBuilder()
+ public static HttpFileSystemConfigBuilder getInstance()
{
- super("webdav.");
+ return BUILDER;
}
/**
* The user name to be associated with changes to the file.
- * @param opts
- * @param creatorName
+ * @param opts The FileSystem options
+ * @param creatorName The creator name to be associated with the file.
*/
public void setCreatorName(FileSystemOptions opts, String creatorName)
{
@@ -51,8 +51,8 @@
/**
* Return the user name to be associated with changes to the file.
- * @param opts
- * @return
+ * @param opts The FileSystem options
+ * @return The creatorName.
*/
public String getCreatorName(FileSystemOptions opts)
{
@@ -61,20 +61,27 @@
/**
* Whether to use versioning
+ * @param opts The FileSystem options.
+ * @param versioning true if versioning should be enabled.
*/
public void setVersioning(FileSystemOptions opts, boolean versioning)
{
- setParam(opts, "versioning", new Boolean(versioning));
+ setParam(opts, "versioning", Boolean.valueOf(versioning));
}
/**
* The cookies to add to the reqest
+ * @param opts The FileSystem options.
+ * @return true if versioning is enabled.
*/
public boolean isVersioning(FileSystemOptions opts)
{
return getBoolean(opts, "versioning", false);
}
-
+
+ /**
+ * @return The Webdav FileSystem Class object.
+ */
protected Class getConfigClass()
{
return WebdavFileSystem.class;
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavMethodRetryHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavMethodRetryHandler.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavMethodRetryHandler.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/WebdavMethodRetryHandler.java Mon Apr 13 04:06:01 2009
@@ -29,9 +29,9 @@
* @author <a href="http://commons.apache.org/vfs/team-list.html">Commons VFS team</a>
* @version $Revision$ $Date$
*/
-public class WebdavMethodRetryHandler implements MethodRetryHandler
+public final class WebdavMethodRetryHandler implements MethodRetryHandler
{
- private final static WebdavMethodRetryHandler INSTANCE = new WebdavMethodRetryHandler();
+ private static final WebdavMethodRetryHandler INSTANCE = new WebdavMethodRetryHandler();
private WebdavMethodRetryHandler()
{
@@ -42,7 +42,9 @@
return INSTANCE;
}
- public boolean retryMethod(HttpMethod method, HttpConnection connection, HttpRecoverableException recoverableException, int executionCount, boolean requestSent)
+ public boolean retryMethod(HttpMethod method, HttpConnection connection,
+ HttpRecoverableException recoverableException, int executionCount,
+ boolean requestSent)
{
return executionCount < 2;
}
Added: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/package.html
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/package.html?rev=764356&view=auto
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/package.html (added)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/package.html Mon Apr 13 04:06:01 2009
@@ -0,0 +1,19 @@
+<!--
+ 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.
+-->
+<body>
+<p>The WebDAV File Provider</p>
+</body>
\ No newline at end of file
Propchange: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/package.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/webdav/package.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileProvider.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileProvider.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileProvider.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/zip/ZipFileSystem.java Mon Apr 13 04:06:01 2009
@@ -200,5 +200,5 @@
{
closeCommunicationLink();
}
- */
+ */
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/AbstractSyncTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/AbstractSyncTask.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/AbstractSyncTask.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/AbstractSyncTask.java Mon Apr 13 04:06:01 2009
@@ -111,7 +111,7 @@
{
this.failonerror = failonerror;
}
-
+
/**
* Sets whether we should fail if there was an error or not
*/
@@ -119,7 +119,7 @@
{
return failonerror;
}
-
+
/**
* Sets the files to includes
*/
@@ -217,15 +217,15 @@
}
}
- protected void logOrDie(final String message, int level)
- {
- if (!isFailonerror())
- {
- log(message, level);
- return;
- }
- throw new BuildException(message);
- }
+ protected void logOrDie(final String message, int level)
+ {
+ if (!isFailonerror())
+ {
+ log(message, level);
+ return;
+ }
+ throw new BuildException(message);
+ }
/**
* Copies the source files to the destination.
@@ -252,7 +252,7 @@
{
final String message =
Messages.getString("vfs.tasks/sync.src-file-no-exist.warn", srcFile);
-
+
logOrDie(message, Project.MSG_WARN);
}
else
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/CopyTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/CopyTask.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/CopyTask.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/CopyTask.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
@@ -75,7 +75,7 @@
{
log("Copying " + srcFile + " to " + destFile);
destFile.copyFrom(srcFile, Selectors.SELECT_SELF);
- if (preserveLastModified &&
+ if (preserveLastModified &&
srcFile.getFileSystem().hasCapability(Capability.GET_LAST_MODIFIED) &&
destFile.getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE))
{
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/DeleteTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/DeleteTask.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/DeleteTask.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/DeleteTask.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MkdirTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MkdirTask.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MkdirTask.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MkdirTask.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MoveTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MoveTask.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MoveTask.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/MoveTask.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/ShowFileTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/ShowFileTask.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/ShowFileTask.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/ShowFileTask.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/SyncTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/SyncTask.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/SyncTask.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/tasks/SyncTask.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/CombinedResources.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/CombinedResources.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/CombinedResources.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/CombinedResources.java Mon Apr 13 04:06:01 2009
@@ -25,106 +25,106 @@
public class CombinedResources extends ResourceBundle
{
- // locale.getLanguage()
- // locale.getCountry()
- // locale.getVariant()
-
- private final String resourceName;
- private boolean inited;
- private final Properties properties = new Properties();
-
- public CombinedResources(String resourceName)
- {
- this.resourceName = resourceName;
- }
-
- protected void init()
- {
- if (inited)
- {
- return;
- }
-
- loadResources(getResourceName());
- loadResources(Locale.getDefault());
- loadResources(getLocale());
- inited = true;
- }
-
- protected void loadResources(Locale locale)
- {
- if (locale == null)
- {
- return;
- }
- String[] parts = new String[]{locale.getLanguage(), locale.getCountry(), locale.getVariant()};
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < 3; i++)
- {
- sb.append(getResourceName());
- for (int j = 0; j < i; j++)
- {
- sb.append('_').append(parts[j]);
- }
- if (parts[i].length() != 0)
- {
- sb.append('_').append(parts[i]);
- loadResources(sb.toString());
- }
- sb.setLength(0);
- }
- }
-
- protected void loadResources(String resourceName)
- {
- ClassLoader loader = getClass().getClassLoader();
- if (loader == null)
- {
- loader = ClassLoader.getSystemClassLoader();
- }
- resourceName = resourceName.replace('.', '/') + ".properties";
- try
- {
- Enumeration resources = loader.getResources(resourceName);
- while (resources.hasMoreElements())
- {
- URL resource = (URL) resources.nextElement();
- try
- {
- properties.load(resource.openConnection().getInputStream());
- }
- catch (IOException e)
- {
- // ignore
- }
- }
- }
- catch (IOException e)
- {
- // ignore
- }
- }
-
- public String getResourceName()
- {
- return resourceName;
- }
-
- public Enumeration getKeys()
- {
- if (!inited)
- {
- init();
- }
- return properties.keys();
- }
-
- protected Object handleGetObject(String key)
- {
- if (!inited)
- {
- init();
- }
- return properties.get(key);
- }
+ // locale.getLanguage()
+ // locale.getCountry()
+ // locale.getVariant()
+
+ private final String resourceName;
+ private boolean inited;
+ private final Properties properties = new Properties();
+
+ public CombinedResources(String resourceName)
+ {
+ this.resourceName = resourceName;
+ }
+
+ protected void init()
+ {
+ if (inited)
+ {
+ return;
+ }
+
+ loadResources(getResourceName());
+ loadResources(Locale.getDefault());
+ loadResources(getLocale());
+ inited = true;
+ }
+
+ protected void loadResources(Locale locale)
+ {
+ if (locale == null)
+ {
+ return;
+ }
+ String[] parts = new String[]{locale.getLanguage(), locale.getCountry(), locale.getVariant()};
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < 3; i++)
+ {
+ sb.append(getResourceName());
+ for (int j = 0; j < i; j++)
+ {
+ sb.append('_').append(parts[j]);
+ }
+ if (parts[i].length() != 0)
+ {
+ sb.append('_').append(parts[i]);
+ loadResources(sb.toString());
+ }
+ sb.setLength(0);
+ }
+ }
+
+ protected void loadResources(String resourceName)
+ {
+ ClassLoader loader = getClass().getClassLoader();
+ if (loader == null)
+ {
+ loader = ClassLoader.getSystemClassLoader();
+ }
+ resourceName = resourceName.replace('.', '/') + ".properties";
+ try
+ {
+ Enumeration resources = loader.getResources(resourceName);
+ while (resources.hasMoreElements())
+ {
+ URL resource = (URL) resources.nextElement();
+ try
+ {
+ properties.load(resource.openConnection().getInputStream());
+ }
+ catch (IOException e)
+ {
+ // ignore
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ // ignore
+ }
+ }
+
+ public String getResourceName()
+ {
+ return resourceName;
+ }
+
+ public Enumeration getKeys()
+ {
+ if (!inited)
+ {
+ init();
+ }
+ return properties.keys();
+ }
+
+ protected Object handleGetObject(String key)
+ {
+ if (!inited)
+ {
+ init();
+ }
+ return properties.get(key);
+ }
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/FileObjectUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/FileObjectUtils.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/FileObjectUtils.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/FileObjectUtils.java Mon Apr 13 04:06:01 2009
@@ -29,53 +29,53 @@
*/
public class FileObjectUtils
{
- private FileObjectUtils()
- {
- }
-
- /**
- * get access to the base object even if decorated
- */
- public static AbstractFileObject getAbstractFileObject(final FileObject fileObject) throws FileSystemException
- {
- Object searchObject = fileObject;
- while (searchObject instanceof DecoratedFileObject)
- {
- searchObject = ((DecoratedFileObject) searchObject).getDecoratedFileObject();
- }
- if (searchObject instanceof AbstractFileObject)
- {
- return (AbstractFileObject) searchObject;
- }
+ private FileObjectUtils()
+ {
+ }
+
+ /**
+ * get access to the base object even if decorated
+ */
+ public static AbstractFileObject getAbstractFileObject(final FileObject fileObject) throws FileSystemException
+ {
+ Object searchObject = fileObject;
+ while (searchObject instanceof DecoratedFileObject)
+ {
+ searchObject = ((DecoratedFileObject) searchObject).getDecoratedFileObject();
+ }
+ if (searchObject instanceof AbstractFileObject)
+ {
+ return (AbstractFileObject) searchObject;
+ }
if (searchObject == null)
{
return null;
}
throw new FileSystemException("vfs.util/find-abstract-file-object.error", fileObject==null?"null":fileObject.getClass().getName());
- }
+ }
+
+ /**
+ * check if the given FileObject is instance of given class argument
+ */
+ public static boolean isInstanceOf(final FileObject fileObject, final Class wantedClass) throws FileSystemException
+ {
+ Object searchObject = fileObject;
+ while (searchObject instanceof DecoratedFileObject)
+ {
+ if (wantedClass.isInstance(searchObject))
+ {
+ return true;
+ }
+
+ searchObject = ((DecoratedFileObject) searchObject).getDecoratedFileObject();
+ }
- /**
- * check if the given FileObject is instance of given class argument
- */
- public static boolean isInstanceOf(final FileObject fileObject, final Class wantedClass) throws FileSystemException
- {
- Object searchObject = fileObject;
- while (searchObject instanceof DecoratedFileObject)
- {
- if (wantedClass.isInstance(searchObject))
- {
- return true;
- }
-
- searchObject = ((DecoratedFileObject) searchObject).getDecoratedFileObject();
- }
-
- if (wantedClass.isInstance(searchObject))
- {
- return true;
- }
+ if (wantedClass.isInstance(searchObject))
+ {
+ return true;
+ }
- return false;
- }
+ return false;
+ }
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorInputStream.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorInputStream.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorInputStream.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
@@ -39,20 +39,20 @@
}
- /**
- * Returns 0 if the stream is at eof, else the underlaying inputStream will be queried
- */
- public synchronized int available() throws IOException
- {
- if (finished)
- {
- return 0;
- }
+ /**
+ * Returns 0 if the stream is at eof, else the underlaying inputStream will be queried
+ */
+ public synchronized int available() throws IOException
+ {
+ if (finished)
+ {
+ return 0;
+ }
- return super.available();
- }
+ return super.available();
+ }
- /**
+ /**
* Reads a character.
*/
public int read() throws IOException
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorOutputStream.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorOutputStream.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/MonitorOutputStream.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
@@ -78,44 +78,44 @@
}
- public synchronized void write(int b) throws IOException
- {
- assertOpen();
- super.write(b);
- }
-
- public synchronized void write(byte b[], int off, int len) throws IOException
- {
- assertOpen();
- super.write(b, off, len);
- }
-
- public synchronized void flush() throws IOException
- {
- assertOpen();
- super.flush();
- }
-
- public void write(byte b[]) throws IOException
- {
- assertOpen();
- super.write(b);
- }
-
- /**
- * check if file is still open. <br />
- * This is a workaround for an oddidy with javas BufferedOutputStream where you can write to
- * even if the stream has been closed
- */
- protected void assertOpen() throws FileSystemException
- {
- if (finished)
- {
- throw new FileSystemException("vfs.provider/closed.error");
- }
- }
+ public synchronized void write(int b) throws IOException
+ {
+ assertOpen();
+ super.write(b);
+ }
+
+ public synchronized void write(byte b[], int off, int len) throws IOException
+ {
+ assertOpen();
+ super.write(b, off, len);
+ }
+
+ public synchronized void flush() throws IOException
+ {
+ assertOpen();
+ super.flush();
+ }
+
+ public void write(byte b[]) throws IOException
+ {
+ assertOpen();
+ super.write(b);
+ }
+
+ /**
+ * check if file is still open. <br />
+ * This is a workaround for an oddidy with javas BufferedOutputStream where you can write to
+ * even if the stream has been closed
+ */
+ protected void assertOpen() throws FileSystemException
+ {
+ if (finished)
+ {
+ throw new FileSystemException("vfs.provider/closed.error");
+ }
+ }
- /**
+ /**
* Called after this stream is closed. This implementation does nothing.
*/
protected void onClose() throws IOException
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/Os.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/Os.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/Os.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/Os.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/OsFamily.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/OsFamily.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/OsFamily.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/OsFamily.java Mon Apr 13 04:06:01 2009
@@ -5,9 +5,9 @@
* 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.
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/RandomAccessMode.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/RandomAccessMode.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/RandomAccessMode.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/RandomAccessMode.java Mon Apr 13 04:06:01 2009
@@ -24,54 +24,54 @@
*/
public class RandomAccessMode
{
- /**
- * read
- */
- public static final RandomAccessMode READ = new RandomAccessMode(true, false);
-
- /**
- * read/write
- */
- public static final RandomAccessMode READWRITE = new RandomAccessMode(true, true);
-
-
- private final boolean read;
- private final boolean write;
-
- private RandomAccessMode(final boolean read, final boolean write)
- {
- this.read = read;
- this.write = write;
- }
-
- public boolean requestRead()
- {
- return read;
- }
-
- public boolean requestWrite()
- {
- return write;
- }
-
- public String getModeString()
- {
- if (requestRead())
- {
- if (requestWrite())
- {
- return "rw"; // NON-NLS
- }
- else
- {
- return "r"; // NON-NLS
- }
- }
- else if (requestWrite())
- {
- return "w"; // NON-NLS
- }
+ /**
+ * read
+ */
+ public static final RandomAccessMode READ = new RandomAccessMode(true, false);
+
+ /**
+ * read/write
+ */
+ public static final RandomAccessMode READWRITE = new RandomAccessMode(true, true);
+
+
+ private final boolean read;
+ private final boolean write;
+
+ private RandomAccessMode(final boolean read, final boolean write)
+ {
+ this.read = read;
+ this.write = write;
+ }
+
+ public boolean requestRead()
+ {
+ return read;
+ }
+
+ public boolean requestWrite()
+ {
+ return write;
+ }
+
+ public String getModeString()
+ {
+ if (requestRead())
+ {
+ if (requestWrite())
+ {
+ return "rw"; // NON-NLS
+ }
+ else
+ {
+ return "r"; // NON-NLS
+ }
+ }
+ else if (requestWrite())
+ {
+ return "w"; // NON-NLS
+ }
- return "";
- }
+ return "";
+ }
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/UserAuthenticatorUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/UserAuthenticatorUtils.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/UserAuthenticatorUtils.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/UserAuthenticatorUtils.java Mon Apr 13 04:06:01 2009
@@ -26,32 +26,32 @@
*/
public class UserAuthenticatorUtils
{
- /**
- * gets data of given type from the UserAuthenticationData or null if there is no data or data of this type available
- */
- public static char[] getData(UserAuthenticationData data, UserAuthenticationData.Type type, char[] overwriddenValue)
- {
+ /**
+ * gets data of given type from the UserAuthenticationData or null if there is no data or data of this type available
+ */
+ public static char[] getData(UserAuthenticationData data, UserAuthenticationData.Type type, char[] overwriddenValue)
+ {
if (overwriddenValue != null)
{
return overwriddenValue;
}
if (data == null)
- {
- return null;
- }
-
- return data.getData(type);
- }
-
- /**
- * if there is a authenticator the authentication will take place, else null will be reutrned
- */
- public static UserAuthenticationData authenticate(FileSystemOptions opts, UserAuthenticationData.Type[] authenticatorTypes)
- {
- UserAuthenticator auth = DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(opts);
+ {
+ return null;
+ }
+
+ return data.getData(type);
+ }
+
+ /**
+ * if there is a authenticator the authentication will take place, else null will be reutrned
+ */
+ public static UserAuthenticationData authenticate(FileSystemOptions opts, UserAuthenticationData.Type[] authenticatorTypes)
+ {
+ UserAuthenticator auth = DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(opts);
return authenticate(auth, authenticatorTypes);
- }
+ }
/**
* if there is a authenticator the authentication will take place, else null will be reutrned
@@ -67,41 +67,41 @@
}
/**
- * converts a string to a char array (null safe)
- */
- public static char[] toChar(String string)
- {
- if (string == null)
- {
- return null;
- }
-
- return string.toCharArray();
- }
-
- /**
- * cleanup the data in the UerAuthenticationData (null safe)
- */
- public static void cleanup(UserAuthenticationData authData)
- {
- if (authData == null)
- {
- return;
- }
-
- authData.cleanup();
- }
-
- /**
- * converts the given data to a string (null safe)
- */
- public static String toString(char[] data)
- {
- if (data == null)
- {
- return null;
- }
+ * converts a string to a char array (null safe)
+ */
+ public static char[] toChar(String string)
+ {
+ if (string == null)
+ {
+ return null;
+ }
+
+ return string.toCharArray();
+ }
+
+ /**
+ * cleanup the data in the UerAuthenticationData (null safe)
+ */
+ public static void cleanup(UserAuthenticationData authData)
+ {
+ if (authData == null)
+ {
+ return;
+ }
+
+ authData.cleanup();
+ }
- return new String(data);
- }
+ /**
+ * converts the given data to a string (null safe)
+ */
+ public static String toString(char[] data)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+
+ return new String(data);
+ }
}
Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/WeakRefFileListener.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/WeakRefFileListener.java?rev=764356&r1=764355&r2=764356&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/WeakRefFileListener.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/util/WeakRefFileListener.java Mon Apr 13 04:06:01 2009
@@ -32,80 +32,80 @@
*/
public class WeakRefFileListener implements FileListener
{
- private final FileSystem fs;
- private final FileName name;
- private final WeakReference listener;
-
- protected WeakRefFileListener(final FileObject file, final FileListener listener)
- {
- this.fs = file.getFileSystem();
- this.name = file.getName();
- this.listener = new WeakReference(listener);
- }
-
- /**
- * This will install the <code>listener<code> at the given <code>file</code>
- */
- public static void installListener(final FileObject file, final FileListener listener)
- {
- WeakRefFileListener weakListener = new WeakRefFileListener(file, listener);
-
- file.getFileSystem().addListener(file, new WeakRefFileListener(file, weakListener));
- }
-
- /**
- * returns the wrapped listener. If it is gone, the WeakRefFileListener wrapper will
- * remove itself from the list of listeners.
- */
- protected FileListener getListener() throws Exception
- {
- FileListener listener = (FileListener) this.listener.get();
- if (listener == null)
- {
- FileObject file = fs.resolveFile(name);
- file.getFileSystem().removeListener(file, this);
- }
- return listener;
- }
-
- /**
- * Called when a file is created.
- */
- public void fileCreated(final FileChangeEvent event) throws Exception
- {
- FileListener listener = getListener();
- if (listener == null)
- {
- return;
- }
- listener.fileCreated(event);
- }
-
- /**
- * Called when a file is deleted.
- */
- public void fileDeleted(final FileChangeEvent event) throws Exception
- {
- FileListener listener = getListener();
- if (listener == null)
- {
- return;
- }
- listener.fileDeleted(event);
- }
-
- /**
- * Called when a file is changed.
- * <p/>
- * This will only happen if you monitor the file using {@link org.apache.commons.vfs.FileMonitor}.
- */
- public void fileChanged(FileChangeEvent event) throws Exception
- {
- FileListener listener = getListener();
- if (listener == null)
- {
- return;
- }
- listener.fileChanged(event);
- }
+ private final FileSystem fs;
+ private final FileName name;
+ private final WeakReference listener;
+
+ protected WeakRefFileListener(final FileObject file, final FileListener listener)
+ {
+ this.fs = file.getFileSystem();
+ this.name = file.getName();
+ this.listener = new WeakReference(listener);
+ }
+
+ /**
+ * This will install the <code>listener<code> at the given <code>file</code>
+ */
+ public static void installListener(final FileObject file, final FileListener listener)
+ {
+ WeakRefFileListener weakListener = new WeakRefFileListener(file, listener);
+
+ file.getFileSystem().addListener(file, new WeakRefFileListener(file, weakListener));
+ }
+
+ /**
+ * returns the wrapped listener. If it is gone, the WeakRefFileListener wrapper will
+ * remove itself from the list of listeners.
+ */
+ protected FileListener getListener() throws Exception
+ {
+ FileListener listener = (FileListener) this.listener.get();
+ if (listener == null)
+ {
+ FileObject file = fs.resolveFile(name);
+ file.getFileSystem().removeListener(file, this);
+ }
+ return listener;
+ }
+
+ /**
+ * Called when a file is created.
+ */
+ public void fileCreated(final FileChangeEvent event) throws Exception
+ {
+ FileListener listener = getListener();
+ if (listener == null)
+ {
+ return;
+ }
+ listener.fileCreated(event);
+ }
+
+ /**
+ * Called when a file is deleted.
+ */
+ public void fileDeleted(final FileChangeEvent event) throws Exception
+ {
+ FileListener listener = getListener();
+ if (listener == null)
+ {
+ return;
+ }
+ listener.fileDeleted(event);
+ }
+
+ /**
+ * Called when a file is changed.
+ * <p/>
+ * This will only happen if you monitor the file using {@link org.apache.commons.vfs.FileMonitor}.
+ */
+ public void fileChanged(FileChangeEvent event) throws Exception
+ {
+ FileListener listener = getListener();
+ if (listener == null)
+ {
+ return;
+ }
+ listener.fileChanged(event);
+ }
}