|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.esw.collection.ATransducerAdapter | +--net.sourceforge.esw.collection.URLTransducerAdapter
Performs Transduction to or against a URL.
This transduction occurs both ways; put()
takes data
from the IMetaCollection
instance to which this
ITransducer
instance is attached and places it into the data
source represented by this ITransducer
instance. The
get()
method takes data from the data source represented by this
ITransducer
instance and places it into the
IMetaCollection
instance to which this ITransducer
instance is attached.
This IIOTransducer instance provides stream-based access for stream-based ITransducer implementors. It abstracts out the setting and getting of the streams, or the readers and the writers, into this interface.
This implementation of the URLTransducerAdapter delegates all
get
and put
method invocations to the contained
IIOTransducer instance. Also, this URLTransducerAdapter instance provides
convenience methods to transduce to or against a URL.
Example:
IMetaCollection meta = MetaFactory.createMetaCollection(); IIOTransducer transducer = createIOTransducer() // for whatever // IIOTransducer instance // you need to use. URLTransducerAdapter adapter = new URLTransducerAdapter( getURLStream(), // the URL data transducer ); meta.setTransducer( adapter ); // Notice it is the Adapter set on the // IMetaCollectsion instance! try { meta.get(); } catch ( TransducerException te ) { te.printStackTrace(); // in case something went wrong. }
Field Summary | |
protected java.lang.String |
url
The URL for the data this URLTransducerAdapter instance will transduce. |
Fields inherited from class net.sourceforge.esw.collection.ATransducerAdapter |
ioTransducer |
Constructor Summary | |
URLTransducerAdapter()
Creates a new URLTransducerAdapter instance. |
|
URLTransducerAdapter(IIOTransducer aIIOTransducer)
Creates a new URLTransducerAdapter instance, delegating ITransducer implemented method invocations to the specified IIOTransducer instance. |
|
URLTransducerAdapter(java.lang.String aURL)
Creates a new URLTransducerAdapter instance with the specified URL. |
|
URLTransducerAdapter(java.lang.String aURL,
IIOTransducer aIIOTransducer)
Creates a new URLTransducerAdapter instance with the specified URL and IIOTransducer instance to which to delegate ITransducer implemented method invocations. |
Method Summary | |
void |
get(IMetaCollection aCollection)
Gets the data source's data represented by this ITransducer instance into the referenced IMetaCollection instance. |
java.lang.String |
getURL()
Returns the URL for this URLTransducerAdapter instance. |
void |
put(IMetaCollection aCollection)
Puts the referenced IMetaCollection instance's data into the data source represented by this ITransducer instance. |
void |
setURL(java.lang.String aURL)
Sets the name of the URL this URLTransducerAdapter instance will transduce against. |
Methods inherited from class net.sourceforge.esw.collection.ATransducerAdapter |
getContextFactory, getIOTranducer, setContextFactory, setIOTransducer |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.esw.collection.ITransducer |
getContextFactory, setContextFactory |
Field Detail |
protected java.lang.String url
Constructor Detail |
public URLTransducerAdapter()
public URLTransducerAdapter(java.lang.String aURL)
aURL
- the String representing the URL this URLTransducerAdapter
instance will transduce against.public URLTransducerAdapter(IIOTransducer aIIOTransducer)
aIIOTransducer
- the IIOTransducer instance to which to delegate.public URLTransducerAdapter(java.lang.String aURL, IIOTransducer aIIOTransducer)
aURL
- the String representing the URL this URLTransducerAdapter
instance will transduce against.aIIOTransducer
- the IIOTransducer instance to which to delegate.Method Detail |
public void setURL(java.lang.String aURL)
aURL
- the String representing the URL this URLTransducerAdapter
instance will transduce against.getURL()
public java.lang.String getURL()
setURL( String )
public void get(IMetaCollection aCollection) throws TransducerException
This implementation creates a Reader instance on the previously specified
URL and sets the Reader instance on the previously specified
IIOTransducer instance, then calls get
on the IIOTransducer
instance.
get
in interface ITransducer
get
in class ATransducerAdapter
aCollection
- the IMetaCollection instance into which to read.TransducerException
- if an error occurs during transduction.put( IMetaCollection )
public void put(IMetaCollection aCollection) throws TransducerException
This implementation creates a Writer instance from the URL and sets the
Writer instance on the previously specified IIOTransducer instance, then
calls get
on the IIOTransducer instance.
put
in interface ITransducer
put
in class ATransducerAdapter
aCollection
- the IMetaCollection instance from which to take data.TransducerException
- if an error occurs during transduction.get( IMetaCollection )
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |