public class URLDataSource extends AbstractDataSource implements ConfigurableUnit
FileObject
objects (VFS).
Modifier and Type | Field and Description |
---|---|
static java.net.URL |
ICON_DEFAULT
Default icon for document tabs.
|
static java.net.URL |
ICON_ERROR
Default icon to represent the error state (e.g. file does not exist).
|
protected org.apache.commons.vfs2.FileObject |
url
The managed content.
|
protected VFSConnection |
vfsConn
The managed content.
|
action, ACTION_FILE_EDIT, ACTION_FILE_HEXEDIT, ACTION_FILE_OPEN, ACTION_UNKNOWN, ACTION_URL_EDIT, ACTION_URL_HEXEDIT, ACTION_URL_OPEN, date, encoding, formatProps, name, path, size, type
Constructor and Description |
---|
URLDataSource()
Constructor method for i18n purposes only.
|
URLDataSource(java.lang.String type,
org.apache.commons.vfs2.FileObject url,
VFSConnection vfsconn,
int action)
Init functionality.
|
Modifier and Type | Method and Description |
---|---|
void |
configureUnit(java.lang.String id,
Configuration config)
Restores values from persistent data stores.
|
void |
finish(java.io.OutputStream ostream)
After the data has been written to the output stream it is flushed, closed and updated here.
|
VFSConnection |
getConnection()
Provides the VFS connection (optional).
|
javax.swing.Icon |
getIcon()
Provides the data source specific icon (optional).
|
java.io.InputStream |
getInputStream()
This method returns an
InputStream representing the data and throws the
appropriate exception if it can not do so. |
java.io.OutputStream |
getOutputStream()
This method returns an
OutputStream where the data can be written and throws
the appropriate exception if it can not do so
Note that a new OutputStream object must be returned each time this method
is called, and the stream must be positioned at the location the data is to be written. |
java.lang.String |
getPath()
Provides the path for this data source.
|
org.apache.commons.vfs2.FileObject |
getURL()
Provides the file object.
|
void |
setURL(org.apache.commons.vfs2.FileObject url)
Sets a new file reference (e.g. after save as".
|
void |
storeUnit(java.lang.String id,
Configuration config)
Stores the current configuration values persistently.
|
void |
unitRegistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitUnregistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
finalize, getAction, getContentType, getDate, getDisplayAction, getEncoding, getFormatProperties, getName, getSize, loadTemporaryFile, setAction, setContentType, setDate, setEncoding, setFormatProperty, setName, setPath, setSize, storeTemporaryFile
public static final java.net.URL ICON_DEFAULT
public static final java.net.URL ICON_ERROR
protected org.apache.commons.vfs2.FileObject url
protected VFSConnection vfsConn
public URLDataSource()
public URLDataSource(java.lang.String type, org.apache.commons.vfs2.FileObject url, VFSConnection vfsconn, int action)
type
- The MIME type (default is "application/octet-stream", optional)url
- The managed contentvfsconn
- The connection (optional)action
- The load action AbstractDataSource.FILE_OPEN
, ...java.lang.NullPointerException
- If a parameter is null
public java.io.InputStream getInputStream() throws java.io.IOException
InputStream
representing the data and throws the
appropriate exception if it can not do so.
Note that a new InputStream
object must be returned each time this method
is called, and the stream must be positioned at the beginning of the data.
getInputStream
in interface javax.activation.DataSource
getInputStream
in class AbstractDataSource
java.io.IOException
- If an error occurredjava.lang.NullPointerException
- If the loaded content is null
public java.io.OutputStream getOutputStream() throws java.io.IOException
OutputStream
where the data can be written and throws
the appropriate exception if it can not do so
Note that a new OutputStream
object must be returned each time this method
is called, and the stream must be positioned at the location the data is to be written.
getOutputStream
in interface javax.activation.DataSource
getOutputStream
in class AbstractDataSource
java.io.IOException
- If an error occurredpublic void finish(java.io.OutputStream ostream) throws java.io.IOException
finish
in class AbstractDataSource
ostream
- An output streamjava.io.IOException
- If an error occurredpublic org.apache.commons.vfs2.FileObject getURL()
null
public void setURL(org.apache.commons.vfs2.FileObject url)
url
- The network filepublic javax.swing.Icon getIcon()
getIcon
in class AbstractDataSource
null
public void configureUnit(java.lang.String id, Configuration config)
configureUnit
in interface ConfigurableUnit
configureUnit
in class AbstractDataSource
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, Configuration config)
storeUnit
in interface ConfigurableUnit
storeUnit
in class AbstractDataSource
id
- The unique identifier for the instanceconfig
- The configurationpublic void unitRegistered(ApplicationModel model, java.lang.String id)
unitRegistered
in interface ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void unitUnregistered(ApplicationModel model, java.lang.String id)
unitUnregistered
in interface ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic java.lang.String getPath()
getPath
in class AbstractDataSource
public VFSConnection getConnection()
null
otherwiseCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.