//# 0 errors, 107 messages
//#
/*
    //#SharedThemeResourceFromDir.java:1:1: class: org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir
    //#SharedThemeResourceFromDir.java:1:1: method: org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  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.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */

package org.apache.roller.weblogger.business.themes;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.Serializable;
import org.apache.roller.weblogger.pojos.ThemeResource;


/**
 * A FileManagerImpl specific implementation of a ThemeResource.
 *
 * ThemeResources from the FileManagerImpl are backed by a java.io.File
 * object which represents the resource on a filesystem.
 *
 * This class is internal to the FileManagerImpl class because there should
 * not be any external classes which need to construct their own instances
 * of this class.
 */
public class SharedThemeResourceFromDir 
        implements ThemeResource, Serializable, Comparable {
    
    // the physical java.io.File backing this resource
    private File resourceFile = null;
    
    // the relative path of the resource within the theme
    private String relativePath = null;
    
    
    public SharedThemeResourceFromDir(String path, File file) {
    //#SharedThemeResourceFromDir.java:48: method: void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)
    //#input(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): file
    //#input(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): path
    //#input(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): this
    //#output(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): this.relativePath
    //#output(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): this.resourceFile
    //#post(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): this.relativePath == path
    //#post(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): init'ed(this.relativePath)
    //#post(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): this.resourceFile == file
    //#post(void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)): init'ed(this.resourceFile)
        relativePath = path;
        resourceFile = file;
    }
    //#SharedThemeResourceFromDir.java:51: end of method: void org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir(String, File)
    
    
    /**
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    public int compareTo(Object o) {
        ThemeResource other = (ThemeResource) o;
    //#SharedThemeResourceFromDir.java:58: method: int org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.compareTo(Object)
    //#input(int compareTo(Object)): __Descendant_Table[org/apache/roller/weblogger/business/themes/SharedThemeResourceFromDir]
    //#input(int compareTo(Object)): __Descendant_Table[others]
    //#input(int compareTo(Object)): __Dispatch_Table.getPath()Ljava/lang/String;
    //#input(int compareTo(Object)): o
    //#input(int compareTo(Object)): this
    //#input(int compareTo(Object)): this.__Tag
    //#input(int compareTo(Object)): this.relativePath
    //#output(int compareTo(Object)): return_value
    //#pre[1] (int compareTo(Object)): o != null
    //#pre[3] (int compareTo(Object)): this.__Tag == org/apache/roller/weblogger/business/themes/SharedThemeResourceFromDir
    //#pre[4] (int compareTo(Object)): this.relativePath != null
    //#post(int compareTo(Object)): init'ed(return_value)
        return getPath().compareTo(other.getPath());
    //#SharedThemeResourceFromDir.java:59: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.ThemeResource:getPath()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir
    //#    method: int compareTo(Object)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.ThemeResource:getPath()
    //#SharedThemeResourceFromDir.java:59: end of method: int org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.compareTo(Object)
    }
    
    
    public ThemeResource[] getChildren() {
        return null;
    //#SharedThemeResourceFromDir.java:64: method: ThemeResource[] org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getChildren()
    //#output(ThemeResource[] getChildren()): return_value
    //#post(ThemeResource[] getChildren()): return_value == null
    //#SharedThemeResourceFromDir.java:64: end of method: ThemeResource[] org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getChildren()
    }
    
    
    public String getName() {
        return resourceFile.getName();
    //#SharedThemeResourceFromDir.java:69: method: String org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getName()
    //#input(String getName()): this
    //#input(String getName()): this.resourceFile
    //#output(String getName()): return_value
    //#pre[2] (String getName()): this.resourceFile != null
    //#post(String getName()): init'ed(return_value)
    //#SharedThemeResourceFromDir.java:69: end of method: String org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getName()
    }
    
    public String getPath() {
        return relativePath;
    //#SharedThemeResourceFromDir.java:73: method: String org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getPath()
    //#input(String getPath()): this
    //#input(String getPath()): this.relativePath
    //#output(String getPath()): return_value
    //#pre[2] (String getPath()): init'ed(this.relativePath)
    //#post(String getPath()): return_value == this.relativePath
    //#post(String getPath()): init'ed(return_value)
    //#SharedThemeResourceFromDir.java:73: end of method: String org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getPath()
    }
    
    public long getLastModified() {
        return resourceFile.lastModified();
    //#SharedThemeResourceFromDir.java:77: method: long org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getLastModified()
    //#input(long getLastModified()): this
    //#input(long getLastModified()): this.resourceFile
    //#output(long getLastModified()): return_value
    //#pre[2] (long getLastModified()): this.resourceFile != null
    //#post(long getLastModified()): init'ed(return_value)
    //#SharedThemeResourceFromDir.java:77: end of method: long org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getLastModified()
    }
    
    public long getLength() {
        return resourceFile.length();
    //#SharedThemeResourceFromDir.java:81: method: long org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getLength()
    //#input(long getLength()): this
    //#input(long getLength()): this.resourceFile
    //#output(long getLength()): return_value
    //#pre[2] (long getLength()): this.resourceFile != null
    //#post(long getLength()): init'ed(return_value)
    //#SharedThemeResourceFromDir.java:81: end of method: long org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getLength()
    }
    
    public boolean isDirectory() {
        return resourceFile.isDirectory();
    //#SharedThemeResourceFromDir.java:85: method: bool org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.isDirectory()
    //#input(bool isDirectory()): this
    //#input(bool isDirectory()): this.resourceFile
    //#output(bool isDirectory()): return_value
    //#pre[2] (bool isDirectory()): this.resourceFile != null
    //#post(bool isDirectory()): init'ed(return_value)
    //#SharedThemeResourceFromDir.java:85: end of method: bool org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.isDirectory()
    }
    
    public boolean isFile() {
        return resourceFile.isFile();
    //#SharedThemeResourceFromDir.java:89: method: bool org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.isFile()
    //#input(bool isFile()): this
    //#input(bool isFile()): this.resourceFile
    //#output(bool isFile()): return_value
    //#pre[2] (bool isFile()): this.resourceFile != null
    //#post(bool isFile()): init'ed(return_value)
    //#SharedThemeResourceFromDir.java:89: end of method: bool org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.isFile()
    }
    
    public InputStream getInputStream() {
        try {
            return new FileInputStream(resourceFile);
    //#SharedThemeResourceFromDir.java:94: method: InputStream org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getInputStream()
    //#input(InputStream getInputStream()): this
    //#input(InputStream getInputStream()): this.resourceFile
    //#output(InputStream getInputStream()): new FileInputStream(getInputStream#1) num objects
    //#output(InputStream getInputStream()): return_value
    //#new obj(InputStream getInputStream()): new FileInputStream(getInputStream#1)
    //#pre[2] (InputStream getInputStream()): init'ed(this.resourceFile)
    //#post(InputStream getInputStream()): return_value == &new FileInputStream(getInputStream#1)
    //#post(InputStream getInputStream()): new FileInputStream(getInputStream#1) num objects == 1
        } catch (java.io.FileNotFoundException ex) {
            // should never happen, rethrow as runtime exception
            throw new RuntimeException("Error constructing input stream", ex);
    //#SharedThemeResourceFromDir.java:97: end of method: InputStream org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.getInputStream()
        }
    }
    
}
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Descendant_Table[org/apache/roller/weblogger/business/themes/SharedThemeResourceFromDir]
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.compareTo(Ljava/lang/Object;)I
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getChildren()[Lorg/apache/roller/weblogger/pojos/ThemeResource;
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getInputStream()Ljava/io/InputStream;
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getLastModified()J
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getLength()J
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getPath()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.isDirectory()Z
    //#output(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.isFile()Z
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Descendant_Table[org/apache/roller/weblogger/business/themes/SharedThemeResourceFromDir] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.compareTo(Ljava/lang/Object;)I == &compareTo
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getChildren()[Lorg/apache/roller/weblogger/pojos/ThemeResource; == &getChildren
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getInputStream()Ljava/io/InputStream; == &getInputStream
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getLastModified()J == &getLastModified
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getLength()J == &getLength
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.getPath()Ljava/lang/String; == &getPath
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.isDirectory()Z == &isDirectory
    //#post(org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init): __Dispatch_Table.isFile()Z == &isFile
    //#SharedThemeResourceFromDir.java:: end of method: org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir.org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir__static_init
    //#SharedThemeResourceFromDir.java:: end of class: org.apache.roller.weblogger.business.themes.SharedThemeResourceFromDir
