org.apache.jackrabbit.server.io
Class ImportContextImpl

java.lang.Object
  extended by org.apache.jackrabbit.server.io.ImportContextImpl
All Implemented Interfaces:
ImportContext, IOContext

public class ImportContextImpl
extends Object
implements ImportContext

ImportContextImpl...


Constructor Summary
ImportContextImpl(Item importRoot, String systemId, InputContext inputCtx, InputStream stream, IOListener ioListener, org.apache.tika.detect.Detector detector)
          Creates a new item import context.
 
Method Summary
 String getContentLanguage()
          Returns the content language or null
 long getContentLength()
          Returns the length of the data or -1 if the content length could not be determined.
 org.apache.tika.detect.Detector getDetector()
           
 String getEncoding()
          Returns the encoding extracted from a content type as present in a request header or null
 Item getImportRoot()
          Returns the import root of the resource to import, i.e. the parent node of the new content to be created.
 InputStream getInputStream()
          Returns a new InputStream to the temporary file created during instanciation or null, if this context does not provide a stream.
 IOListener getIOListener()
          Returns the IOListener.
 String getMimeType()
          Returns the main media type.
 long getModificationTime()
          Returns the modification time of the resource or the current time if the modification time has not been set.
 Object getProperty(Object propertyName)
           
 String getSystemId()
          Returns the system id of the resource to be imported.
 boolean hasStream()
          Return true if the given export context can provide an output stream
 void informCompleted(boolean success)
          Informs this context that it will not be used for futher exports any more.
 boolean isCompleted()
          Returns true if this context already has been completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportContextImpl

public ImportContextImpl(Item importRoot,
                         String systemId,
                         InputContext inputCtx,
                         InputStream stream,
                         IOListener ioListener,
                         org.apache.tika.detect.Detector detector)
                  throws IOException
Creates a new item import context. The specified InputStream is written to a temporary file in order to avoid problems with multiple IOHandlers that try to run the import but fail. The temporary file is deleted as soon as this context is informed that the import has been completed and it will not be used any more.

Parameters:
importRoot -
systemId -
inputCtx - input context, or null
stream - document input stream, or null
ioListener -
detector - content type detector
Throws:
IOException
See Also:
IOContext.informCompleted(boolean)
Method Detail

getIOListener

public IOListener getIOListener()
Description copied from interface: IOContext
Returns the IOListener.

Specified by:
getIOListener in interface IOContext
Returns:
See Also:
IOContext.getIOListener()

getImportRoot

public Item getImportRoot()
Description copied from interface: ImportContext
Returns the import root of the resource to import, i.e. the parent node of the new content to be created.

Specified by:
getImportRoot in interface ImportContext
Returns:
the import root of the resource to import.
See Also:
ImportContext.getImportRoot()

getDetector

public org.apache.tika.detect.Detector getDetector()
See Also:
ImportContext#getDetector()

hasStream

public boolean hasStream()
Description copied from interface: IOContext
Return true if the given export context can provide an output stream

Specified by:
hasStream in interface IOContext
See Also:
IOContext.hasStream()

getInputStream

public InputStream getInputStream()
Returns a new InputStream to the temporary file created during instanciation or null, if this context does not provide a stream.

Specified by:
getInputStream in interface ImportContext
Returns:
the input stream.
See Also:
ImportContext.getInputStream(), hasStream()

getSystemId

public String getSystemId()
Description copied from interface: ImportContext
Returns the system id of the resource to be imported. This id depends on the system the resource is comming from. it can be a filename, a display name of a webdav resource, an URI, etc.

Specified by:
getSystemId in interface ImportContext
Returns:
the system id of the resource to import
See Also:
ImportContext.getSystemId()

getModificationTime

public long getModificationTime()
Description copied from interface: ImportContext
Returns the modification time of the resource or the current time if the modification time has not been set.

Specified by:
getModificationTime in interface ImportContext
Returns:
the modification time.
See Also:
ImportContext.getModificationTime()

getContentLanguage

public String getContentLanguage()
Description copied from interface: ImportContext
Returns the content language or null

Specified by:
getContentLanguage in interface ImportContext
Returns:
contentLanguage
See Also:
ImportContext.getContentLanguage()

getContentLength

public long getContentLength()
Description copied from interface: ImportContext
Returns the length of the data or -1 if the content length could not be determined.

Specified by:
getContentLength in interface ImportContext
Returns:
the content length
See Also:
ImportContext.getContentLength()

getMimeType

public String getMimeType()
Description copied from interface: ImportContext
Returns the main media type. It should be retrieved from a content type (as present in a http request) or from the systemId. If either value is indefined null should be returned.

Specified by:
getMimeType in interface ImportContext
Returns:
the mimetype of the resource to be imported
See Also:
ImportContext.getMimeType()

getEncoding

public String getEncoding()
Description copied from interface: ImportContext
Returns the encoding extracted from a content type as present in a request header or null

Specified by:
getEncoding in interface ImportContext
Returns:
the encoding to be used for importing
See Also:
ImportContext.getEncoding()

getProperty

public Object getProperty(Object propertyName)
Specified by:
getProperty in interface ImportContext
Returns:
See Also:
ImportContext.getProperty(Object)

informCompleted

public void informCompleted(boolean success)
Description copied from interface: IOContext
Informs this context that it will not be used for futher exports any more. A boolean flag indicates about the success of the export

Specified by:
informCompleted in interface IOContext
See Also:
IOContext.informCompleted(boolean)

isCompleted

public boolean isCompleted()
Description copied from interface: IOContext
Returns true if this context already has been completed.

Specified by:
isCompleted in interface IOContext
Returns:
true if this context already has been completed.
See Also:
IOContext.isCompleted()


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.