org.xiruss.xirussrepository.server.jetty.viewer
Class XirussResourceBase

java.lang.Object
  extended by org.mortbay.util.Resource
      extended by org.xiruss.xirussrepository.server.jetty.viewer.XirussResourceBase
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
HttpApiResourceBase, XirussHtmlResource

public abstract class XirussResourceBase
extends org.mortbay.util.Resource

Maps the HTTP Resource API to Xiruss repository objects. NOTE: The code right now is very scripty as I figure out the business logic for handling the URLs. Once I get that worked out it will need to be refactored to make the code cleaner and more abstract. Right now I'm in the "make it work" stage. WEK

See Also:
Serialized Form

Field Summary
protected  java.lang.Object _associate
           
protected  org.mortbay.http.HttpContext _context
           
protected static org.apache.log4j.Logger logger
           
protected  java.lang.String mimeType
           
protected  java.util.Vector pathTokens
           
protected  PathString pathToMe
           
protected  XirussRepository rep
           
protected  RepositoryObject repositoryObject
           
protected  org.mortbay.http.HttpRequest request
           
protected  int resourceType
           
protected  java.net.URL url
           
 
Constructor Summary
XirussResourceBase(Repository rep, org.mortbay.http.HttpRequest request)
           
XirussResourceBase(Repository rep, org.mortbay.http.HttpRequest request, int resourceType, java.util.Vector pathTokens)
           
XirussResourceBase(Repository rep, org.mortbay.http.HttpRequest request, RepositoryObject repObj)
           
XirussResourceBase(Repository rep, org.mortbay.http.HttpRequest request, java.lang.String mimeType)
           
 
Method Summary
 org.mortbay.util.Resource addPath(java.lang.String path)
           
 boolean delete()
           
 boolean exists()
           
 java.lang.Object getAssociate()
           
 java.lang.String getCharacterEncoding()
           
 java.io.File getFile()
           
 org.mortbay.http.HttpContext getHttpContext()
           
abstract  java.io.InputStream getInputStream()
           
 java.lang.String getMimeType()
           
 java.lang.String getName()
           
 java.io.OutputStream getOutputStream()
           
protected  PathString getPathToMe()
           
 RepositoryObject getRepositoryObject()
           
 int getResourceType()
          Returns the type of resource (Resource, Version, Snapshot, etc.)
 java.net.URL getURL()
           
abstract  boolean isDirectory()
           
 long lastModified()
           
abstract  long length()
           
 java.lang.String[] list()
           
 void release()
           
 boolean renameTo(org.mortbay.util.Resource dest)
           
 void setAssociate(java.lang.Object o)
           
 void writeTo(java.io.OutputStream out, long start, long count)
           
 
Methods inherited from class org.mortbay.util.Resource
cache, encode, finalize, getAlias, getListHTML, newResource, newResource, newSystemResource
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_associate

protected java.lang.Object _associate

resourceType

protected int resourceType

rep

protected XirussRepository rep

repositoryObject

protected RepositoryObject repositoryObject

request

protected org.mortbay.http.HttpRequest request

url

protected java.net.URL url

logger

protected static org.apache.log4j.Logger logger

pathTokens

protected java.util.Vector pathTokens

_context

protected org.mortbay.http.HttpContext _context

mimeType

protected java.lang.String mimeType

pathToMe

protected PathString pathToMe
Constructor Detail

XirussResourceBase

public XirussResourceBase(Repository rep,
                          org.mortbay.http.HttpRequest request,
                          int resourceType,
                          java.util.Vector pathTokens)
                   throws java.io.IOException
Throws:
java.io.IOException

XirussResourceBase

public XirussResourceBase(Repository rep,
                          org.mortbay.http.HttpRequest request)

XirussResourceBase

public XirussResourceBase(Repository rep,
                          org.mortbay.http.HttpRequest request,
                          java.lang.String mimeType)

XirussResourceBase

public XirussResourceBase(Repository rep,
                          org.mortbay.http.HttpRequest request,
                          RepositoryObject repObj)
Method Detail

getResourceType

public int getResourceType()
Returns the type of resource (Resource, Version, Snapshot, etc.)


getHttpContext

public org.mortbay.http.HttpContext getHttpContext()

release

public void release()
Specified by:
release in class org.mortbay.util.Resource

exists

public boolean exists()
Specified by:
exists in class org.mortbay.util.Resource

lastModified

public long lastModified()
Specified by:
lastModified in class org.mortbay.util.Resource

getURL

public java.net.URL getURL()
Specified by:
getURL in class org.mortbay.util.Resource

getFile

public java.io.File getFile()
                     throws java.io.IOException
Specified by:
getFile in class org.mortbay.util.Resource
Throws:
java.io.IOException

getName

public java.lang.String getName()
Specified by:
getName in class org.mortbay.util.Resource

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException,
                                            java.lang.SecurityException
Specified by:
getOutputStream in class org.mortbay.util.Resource
Throws:
java.io.IOException
java.lang.SecurityException

delete

public boolean delete()
               throws java.lang.SecurityException
Specified by:
delete in class org.mortbay.util.Resource
Throws:
java.lang.SecurityException

renameTo

public boolean renameTo(org.mortbay.util.Resource dest)
                 throws java.lang.SecurityException
Specified by:
renameTo in class org.mortbay.util.Resource
Throws:
java.lang.SecurityException

list

public java.lang.String[] list()
Specified by:
list in class org.mortbay.util.Resource

addPath

public org.mortbay.util.Resource addPath(java.lang.String path)
                                  throws java.io.IOException,
                                         java.net.MalformedURLException
Specified by:
addPath in class org.mortbay.util.Resource
Throws:
java.io.IOException
java.net.MalformedURLException

writeTo

public void writeTo(java.io.OutputStream out,
                    long start,
                    long count)
             throws java.io.IOException
Overrides:
writeTo in class org.mortbay.util.Resource
Parameters:
out -
start - First byte to write
count - Bytes to write or -1 for all of them.
Throws:
java.io.IOException

getAssociate

public java.lang.Object getAssociate()
Overrides:
getAssociate in class org.mortbay.util.Resource

setAssociate

public void setAssociate(java.lang.Object o)
Overrides:
setAssociate in class org.mortbay.util.Resource

isDirectory

public abstract boolean isDirectory()
Specified by:
isDirectory in class org.mortbay.util.Resource

length

public abstract long length()
Specified by:
length in class org.mortbay.util.Resource

getInputStream

public abstract java.io.InputStream getInputStream()
                                            throws java.io.IOException
Specified by:
getInputStream in class org.mortbay.util.Resource
Throws:
java.io.IOException

getMimeType

public java.lang.String getMimeType()

getCharacterEncoding

public java.lang.String getCharacterEncoding()

getRepositoryObject

public RepositoryObject getRepositoryObject()

getPathToMe

protected PathString getPathToMe()