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 StringgetContentLanguage()Returns the content language ornulllonggetContentLength()Returns the length of the data or-1if the content length could not be determined.StringgetEncoding()Returns the encoding extracted from a content type as present in a request header ornullItemgetImportRoot()Returns the import root of the resource to import, i.e.InputStreamgetInputStream()Returns a newInputStreamto the temporary file created during instantiation ornull, if this context does not provide a stream.IOListenergetIOListener()Returns the IOListener.StringgetMimeType()Returns the main media type.longgetModificationTime()Returns the modification time of the resource or the current time if the modification time has not been set.ObjectgetProperty(Object propertyName)StringgetSystemId()Returns the system id of the resource to be imported.booleanhasStream()Return true if the given export context can provide an output streamvoidinformCompleted(boolean success)Informs this context that it will not be used for further exports any more.booleanisCompleted()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, ornullstream- document input stream, ornullioListener-detector- content type detector- Throws:
IOException- See Also:
IOContext.informCompleted(boolean)
-
-
Method Detail
-
getIOListener
public IOListener getIOListener()
Description copied from interface:IOContextReturns the IOListener.- Specified by:
getIOListenerin interfaceIOContext- See Also:
IOContext.getIOListener()
-
getImportRoot
public Item getImportRoot()
Description copied from interface:ImportContextReturns the import root of the resource to import, i.e. the parent node of the new content to be created.- Specified by:
getImportRootin interfaceImportContext- Returns:
- the import root of the resource to import.
- See Also:
ImportContext.getImportRoot()
-
hasStream
public boolean hasStream()
Description copied from interface:IOContextReturn true if the given export context can provide an output stream- Specified by:
hasStreamin interfaceIOContext- See Also:
IOContext.hasStream()
-
getInputStream
public InputStream getInputStream()
Returns a newInputStreamto the temporary file created during instantiation ornull, if this context does not provide a stream.- Specified by:
getInputStreamin interfaceImportContext- Returns:
- the input stream.
- See Also:
ImportContext.getInputStream(),hasStream()
-
getSystemId
public String getSystemId()
Description copied from interface:ImportContextReturns 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:
getSystemIdin interfaceImportContext- Returns:
- the system id of the resource to import
- See Also:
ImportContext.getSystemId()
-
getModificationTime
public long getModificationTime()
Description copied from interface:ImportContextReturns the modification time of the resource or the current time if the modification time has not been set.- Specified by:
getModificationTimein interfaceImportContext- Returns:
- the modification time.
- See Also:
ImportContext.getModificationTime()
-
getContentLanguage
public String getContentLanguage()
Description copied from interface:ImportContextReturns the content language ornull- Specified by:
getContentLanguagein interfaceImportContext- Returns:
- contentLanguage
- See Also:
ImportContext.getContentLanguage()
-
getContentLength
public long getContentLength()
Description copied from interface:ImportContextReturns the length of the data or-1if the content length could not be determined.- Specified by:
getContentLengthin interfaceImportContext- Returns:
- the content length
- See Also:
ImportContext.getContentLength()
-
getMimeType
public String getMimeType()
Description copied from interface:ImportContextReturns 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 undefinednullshould be returned.- Specified by:
getMimeTypein interfaceImportContext- Returns:
- the mimetype of the resource to be imported
- See Also:
ImportContext.getMimeType()
-
getEncoding
public String getEncoding()
Description copied from interface:ImportContextReturns the encoding extracted from a content type as present in a request header ornull- Specified by:
getEncodingin interfaceImportContext- Returns:
- the encoding to be used for importing
- See Also:
ImportContext.getEncoding()
-
getProperty
public Object getProperty(Object propertyName)
- Specified by:
getPropertyin interfaceImportContext- See Also:
ImportContext.getProperty(Object)
-
informCompleted
public void informCompleted(boolean success)
Description copied from interface:IOContextInforms 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:
informCompletedin interfaceIOContext- See Also:
IOContext.informCompleted(boolean)
-
isCompleted
public boolean isCompleted()
Description copied from interface:IOContextReturns true if this context already has been completed.- Specified by:
isCompletedin interfaceIOContext- Returns:
- true if this context already has been completed.
- See Also:
IOContext.isCompleted()
-
-