public abstract class AbstractIOProvider extends Object implements IOProvider
IOProvider
sPARAM_CHARSET, PARAM_CONTENT_TYPE
Modifier | Constructor and Description |
---|---|
protected |
AbstractIOProvider()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addSupportedParameter(String name)
Add a supported parameter name, should be called in the constructor
|
IOReport |
execute(ProgressIndicator progress)
Execute the I/O provider.
|
protected abstract IOReport |
execute(ProgressIndicator progress,
IOReporter reporter)
Execute the I/O provider.
|
protected void |
fail(String message)
Fail validation or execution if the configuration is not valid
|
Charset |
getCharset()
Get the configured character set.
|
org.eclipse.core.runtime.content.IContentType |
getContentType()
Get the content type
|
protected Charset |
getDefaultCharset()
Get the default character set.
This implementation returns UTF-8, may be overridden. |
protected abstract String |
getDefaultTypeName()
Get the default type name if no content type is provided
|
Value |
getParameter(String name)
Get the value for the given parameter name
|
Set<String> |
getSupportedParameters()
Get the supported configuration parameters.
|
protected String |
getTypeName()
Get the content type name.
|
void |
loadConfiguration(Map<String,Value> configuration)
Uses
setParameter(String, Value) to load the configuration. |
void |
setCharset(Charset charset)
Set the character set that should be used for encoding/decoding.
|
void |
setContentType(org.eclipse.core.runtime.content.IContentType contentType)
Set the content type.
|
void |
setParameter(String name,
Value value)
Set a parameter
|
void |
storeConfiguration(Map<String,Value> configuration)
Stores all parameters that were set using
setParameter(String, Value) in the configuration. |
void |
validate()
Validate the I/O provider configuration
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createReporter, isCancelable
protected Charset getDefaultCharset()
public IOReport execute(ProgressIndicator progress) throws IOProviderConfigurationException, IOException
IOProvider
execute
in interface IOProvider
progress
- the progress indicator, may be null
IOProviderConfigurationException
- if the I/O provider was not
configured properlyIOException
- if an I/O operation failsIOProvider.execute(ProgressIndicator)
protected abstract IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException
progress
- the progress indicatorreporter
- the reporter to use for the execution reportIOProviderConfigurationException
- if the I/O provider was not
configured properlyIOException
- if an I/O operation failsprotected String getTypeName()
protected abstract String getDefaultTypeName()
public void validate() throws IOProviderConfigurationException
IOProvider
validate
in interface IOProvider
IOProviderConfigurationException
- if the I/O provider was not
configured properlyIOProvider.validate()
public final void loadConfiguration(Map<String,Value> configuration)
setParameter(String, Value)
to load the configuration. For
changing the behavior please override
setParameter(String, Value)
loadConfiguration
in interface IOProvider
configuration
- the configuration to load, values are either
strings, DOM elements or complex value types defined in the
ComplexValueExtension
IOProvider.loadConfiguration(Map)
public void storeConfiguration(Map<String,Value> configuration)
setParameter(String, Value)
in the configuration. For changing
the behavior please override this method.storeConfiguration
in interface IOProvider
configuration
- the configuration to populate, values are either
strings, DOM elements or complex value types defined in the
ComplexValueExtension
IOProvider.storeConfiguration(Map)
protected void fail(String message) throws IOProviderConfigurationException
message
- the error messageIOProviderConfigurationException
- alwaysprotected void addSupportedParameter(String name)
name
- the supported parameter name to addpublic Value getParameter(String name)
IOProvider
getParameter
in interface IOProvider
name
- the parameter namenull
, the value is either a
string, a DOM elements or a complex value types defined in the
ComplexValueExtension
IOProvider.getParameter(String)
public Set<String> getSupportedParameters()
IOProvider
getSupportedParameters
in interface IOProvider
IOProvider.getSupportedParameters()
public void setParameter(String name, Value value)
IOProvider
setParameter
in interface IOProvider
name
- the parameter namevalue
- the parameter value, it is either a string, a DOM elements
or a complex value types defined in the
ComplexValueExtension
public org.eclipse.core.runtime.content.IContentType getContentType()
IOProvider
getContentType
in interface IOProvider
null
IOProvider.getContentType()
public void setContentType(org.eclipse.core.runtime.content.IContentType contentType)
IOProvider
setContentType
in interface IOProvider
contentType
- the content typeIOProvider.setContentType(IContentType)
public void setCharset(Charset charset)
IOProvider
setCharset
in interface IOProvider
charset
- the character setpublic Charset getCharset()
IOProvider
getCharset
in interface IOProvider
null
Build 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a