You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2013/03/24 21:14:09 UTC

svn commit: r1460434 - /commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocator.java

Author: oheger
Date: Sun Mar 24 20:14:09 2013
New Revision: 1460434

URL: http://svn.apache.org/r1460434
Log:
Added new FileLocator interface.

Added:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocator.java

Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocator.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocator.java?rev=1460434&view=auto
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocator.java (added)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/io/FileLocator.java Sun Mar 24 20:14:09 2013
@@ -0,0 +1,74 @@
+/*
+ * 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.configuration.io;
+
+import java.net.URL;
+
+import org.apache.commons.configuration.FileSystem;
+
+/**
+ * <p>
+ * An interface describing the location of a file.
+ * </p>
+ * <p>
+ * An object implementing this interface can be used to obtain information about
+ * the storage location of a file. It allows querying the typical components
+ * used by {@link FileHandler} to locate a file.
+ * </p>
+ *
+ * @version $Id: $
+ * @since 2.0
+ */
+public interface FileLocator
+{
+    /**
+     * Returns the name of the represented file.
+     *
+     * @return the file name only
+     */
+    String getFileName();
+
+    /**
+     * Returns the base path of the represented file. This is typically the
+     * directory in which the file is stored.
+     *
+     * @return the base path
+     */
+    String getBasePath();
+
+    /**
+     * Returns a full URL to the represented file.
+     *
+     * @return the URL pointing to the file
+     */
+    URL getSourceURL();
+
+    /**
+     * Returns the file system which is used for resolving files to be loaded.
+     *
+     * @return the {@code FileSystem}
+     */
+    FileSystem getFileSystem();
+
+    /**
+     * Returns the encoding of the represented file if known. Result can be
+     * <b>null</b>, then default encoding should be assumed.
+     *
+     * @return the encoding
+     */
+    String getEncoding();
+}