Package org.apache.jackrabbit.server.io
Class ImportContextImpl
- java.lang.Object
-
- org.apache.jackrabbit.server.io.ImportContextImpl
-
- All Implemented Interfaces:
ImportContext
,IOContext
public class ImportContextImpl extends Object implements ImportContext
ImportContextImpl
...
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentLanguage()
Returns the content language ornull
long
getContentLength()
Returns the length of the data or-1
if the content length could not be determined.String
getEncoding()
Returns the encoding extracted from a content type as present in a request header ornull
Item
getImportRoot()
Returns the import root of the resource to import, i.e.InputStream
getInputStream()
Returns a newInputStream
to the temporary file created during instantiation ornull
, 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 streamvoid
informCompleted(boolean success)
Informs this context that it will not be used for further exports any more.boolean
isCompleted()
Returns true if this context already has been completed.
-
-
-
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, ornull
stream
- document input stream, ornull
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 interfaceIOContext
- 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 interfaceImportContext
- Returns:
- the import root of the resource to import.
- See Also:
ImportContext.getImportRoot()
-
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 interfaceIOContext
- See Also:
IOContext.hasStream()
-
getInputStream
public InputStream getInputStream()
Returns a newInputStream
to the temporary file created during instantiation ornull
, if this context does not provide a stream.- Specified by:
getInputStream
in interfaceImportContext
- 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 coming from. it can be a filename, a display name of a webdav resource, an URI, etc.- Specified by:
getSystemId
in interfaceImportContext
- 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 interfaceImportContext
- Returns:
- the modification time.
- See Also:
ImportContext.getModificationTime()
-
getContentLanguage
public String getContentLanguage()
Description copied from interface:ImportContext
Returns the content language ornull
- Specified by:
getContentLanguage
in interfaceImportContext
- 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 interfaceImportContext
- 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 undefinednull
should be returned.- Specified by:
getMimeType
in interfaceImportContext
- 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 ornull
- Specified by:
getEncoding
in interfaceImportContext
- Returns:
- the encoding to be used for importing
- See Also:
ImportContext.getEncoding()
-
getProperty
public Object getProperty(Object propertyName)
- Specified by:
getProperty
in interfaceImportContext
- 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 further exports any more. A boolean flag indicates about the success of the export.- Specified by:
informCompleted
in interfaceIOContext
- 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 interfaceIOContext
- Returns:
- true if this context already has been completed.
- See Also:
IOContext.isCompleted()
-
-