//# 0 errors, 104 messages
//#
/*
    //#AtomMediaResource.java:1:1: class: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource
    //#AtomMediaResource.java:1:1: method: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init
 * Copyright 2007 Sun Microsystems, Inc.
 *
 * Licensed 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.roller.weblogger.webservices.atomprotocol;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Date;
import javax.activation.FileTypeMap;
import javax.activation.MimetypesFileTypeMap;
import org.apache.roller.weblogger.pojos.ThemeResource;

/**
 * Represents a media link entry.
 */
public class AtomMediaResource {

    private String contentType = null;
    private int contentLength = 0;
    private InputStream inputStream = null;
    private Date lastModified = null;

    public AtomMediaResource(ThemeResource resource) throws FileNotFoundException {
    //#AtomMediaResource.java:38: method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)
    //#input(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): resource
    //#input(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): this
    //#output(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): new Date(AtomMediaResource#1) num objects
    //#output(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): this.contentLength
    //#output(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): this.contentType
    //#output(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): this.inputStream
    //#output(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): this.lastModified
    //#new obj(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): new Date(AtomMediaResource#1)
    //#pre[1] (void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): resource != null
    //#presumption(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): javax.activation.FileTypeMap:getDefaultFileTypeMap(...)@40 != null
    //#presumption(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): org.apache.roller.weblogger.pojos.ThemeResource:getLength(...)@48 in -2_147_483_648..4_294_967_295
    //#post(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): (soft) init'ed(this.contentLength)
    //#post(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): init'ed(this.contentType)
    //#post(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): init'ed(this.inputStream)
    //#post(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): this.lastModified == &new Date(AtomMediaResource#1)
    //#post(void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)): new Date(AtomMediaResource#1) num objects == 1
        // TODO: figure out why PNG is missing from Java MIME types
        FileTypeMap map = FileTypeMap.getDefaultFileTypeMap();
        if (map instanceof MimetypesFileTypeMap) {
            try {
                ((MimetypesFileTypeMap) map).addMimeTypes("image/png png PNG");
            } catch (Exception ignored) {
            }
        }
        contentType = map.getContentType(resource.getName());
    //#AtomMediaResource.java:47: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.ThemeResource:getName()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource
    //#    method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.ThemeResource:getName()
        contentLength = (int)resource.getLength();
    //#AtomMediaResource.java:48: Warning: method not available
    //#    -- call on long org.apache.roller.weblogger.pojos.ThemeResource:getLength()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource
    //#    method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)
    //#    unanalyzed callee: long org.apache.roller.weblogger.pojos.ThemeResource:getLength()
        lastModified = new Date(resource.getLastModified());
    //#AtomMediaResource.java:49: Warning: method not available
    //#    -- call on long org.apache.roller.weblogger.pojos.ThemeResource:getLastModified()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource
    //#    method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)
    //#    unanalyzed callee: long org.apache.roller.weblogger.pojos.ThemeResource:getLastModified()
        inputStream = resource.getInputStream();
    //#AtomMediaResource.java:50: Warning: method not available
    //#    -- call on InputStream org.apache.roller.weblogger.pojos.ThemeResource:getInputStream()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource
    //#    method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)
    //#    unanalyzed callee: InputStream org.apache.roller.weblogger.pojos.ThemeResource:getInputStream()
    }
    //#AtomMediaResource.java:51: end of method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource(ThemeResource)

    public String getContentType() {
        return contentType;
    //#AtomMediaResource.java:54: method: String org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getContentType()
    //#input(String getContentType()): this
    //#input(String getContentType()): this.contentType
    //#output(String getContentType()): return_value
    //#pre[2] (String getContentType()): init'ed(this.contentType)
    //#post(String getContentType()): return_value == this.contentType
    //#post(String getContentType()): init'ed(return_value)
    //#AtomMediaResource.java:54: end of method: String org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getContentType()
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    //#AtomMediaResource.java:58: method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setContentType(String)
    //#input(void setContentType(String)): contentType
    //#input(void setContentType(String)): this
    //#output(void setContentType(String)): this.contentType
    //#post(void setContentType(String)): this.contentType == contentType
    //#post(void setContentType(String)): init'ed(this.contentType)
    }
    //#AtomMediaResource.java:59: end of method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setContentType(String)

    public int getContentLength() {
        return contentLength;
    //#AtomMediaResource.java:62: method: int org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getContentLength()
    //#input(int getContentLength()): this
    //#input(int getContentLength()): this.contentLength
    //#output(int getContentLength()): return_value
    //#pre[2] (int getContentLength()): init'ed(this.contentLength)
    //#post(int getContentLength()): return_value == this.contentLength
    //#post(int getContentLength()): init'ed(return_value)
    //#AtomMediaResource.java:62: end of method: int org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getContentLength()
    }

    public void setContentLength(int contentLength) {
        this.contentLength = contentLength;
    //#AtomMediaResource.java:66: method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setContentLength(int)
    //#input(void setContentLength(int)): contentLength
    //#input(void setContentLength(int)): this
    //#output(void setContentLength(int)): this.contentLength
    //#post(void setContentLength(int)): this.contentLength == contentLength
    //#post(void setContentLength(int)): init'ed(this.contentLength)
    }
    //#AtomMediaResource.java:67: end of method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setContentLength(int)

    public InputStream getInputStream() {
        return inputStream;
    //#AtomMediaResource.java:70: method: InputStream org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getInputStream()
    //#input(InputStream getInputStream()): this
    //#input(InputStream getInputStream()): this.inputStream
    //#output(InputStream getInputStream()): return_value
    //#pre[2] (InputStream getInputStream()): init'ed(this.inputStream)
    //#post(InputStream getInputStream()): return_value == this.inputStream
    //#post(InputStream getInputStream()): init'ed(return_value)
    //#AtomMediaResource.java:70: end of method: InputStream org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getInputStream()
    }

    public void setInputStream(InputStream inputStream) {
        this.inputStream = inputStream;
    //#AtomMediaResource.java:74: method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setInputStream(InputStream)
    //#input(void setInputStream(InputStream)): inputStream
    //#input(void setInputStream(InputStream)): this
    //#output(void setInputStream(InputStream)): this.inputStream
    //#post(void setInputStream(InputStream)): this.inputStream == inputStream
    //#post(void setInputStream(InputStream)): init'ed(this.inputStream)
    }
    //#AtomMediaResource.java:75: end of method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setInputStream(InputStream)

    public Date getLastModified() {
        return lastModified;
    //#AtomMediaResource.java:78: method: Date org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getLastModified()
    //#input(Date getLastModified()): this
    //#input(Date getLastModified()): this.lastModified
    //#output(Date getLastModified()): return_value
    //#pre[2] (Date getLastModified()): init'ed(this.lastModified)
    //#post(Date getLastModified()): return_value == this.lastModified
    //#post(Date getLastModified()): init'ed(return_value)
    //#AtomMediaResource.java:78: end of method: Date org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.getLastModified()
    }

    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    //#AtomMediaResource.java:82: method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setLastModified(Date)
    //#input(void setLastModified(Date)): lastModified
    //#input(void setLastModified(Date)): this
    //#output(void setLastModified(Date)): this.lastModified
    //#post(void setLastModified(Date)): this.lastModified == lastModified
    //#post(void setLastModified(Date)): init'ed(this.lastModified)
    }
    //#AtomMediaResource.java:83: end of method: void org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.setLastModified(Date)
}
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Descendant_Table[org/apache/roller/weblogger/webservices/atomprotocol/AtomMediaResource]
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getContentLength()I
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getContentType()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getInputStream()Ljava/io/InputStream;
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getLastModified()Ljava/util/Date;
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setContentLength(I)V
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setContentType(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setInputStream(Ljava/io/InputStream;)V
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setLastModified(Ljava/util/Date;)V
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Descendant_Table[org/apache/roller/weblogger/webservices/atomprotocol/AtomMediaResource] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getContentLength()I == &getContentLength
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getContentType()Ljava/lang/String; == &getContentType
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getInputStream()Ljava/io/InputStream; == &getInputStream
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.getLastModified()Ljava/util/Date; == &getLastModified
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setContentLength(I)V == &setContentLength
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setContentType(Ljava/lang/String;)V == &setContentType
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setInputStream(Ljava/io/InputStream;)V == &setInputStream
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init): __Dispatch_Table.setLastModified(Ljava/util/Date;)V == &setLastModified
    //#AtomMediaResource.java:: end of method: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource.org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource__static_init
    //#AtomMediaResource.java:: end of class: org.apache.roller.weblogger.webservices.atomprotocol.AtomMediaResource
