Class TLcyCompositeModelReferenceDecoder

java.lang.Object
com.luciad.lucy.util.TLcyGenericComposite<ILcdModelReferenceDecoder>
com.luciad.lucy.model.TLcyCompositeModelReferenceDecoder
All Implemented Interfaces:
ILcdModelReferenceDecoder, Iterable<ILcdModelReferenceDecoder>

public class TLcyCompositeModelReferenceDecoder extends TLcyGenericComposite<ILcdModelReferenceDecoder> implements ILcdModelReferenceDecoder

Composite implementation (see composite design pattern) of ILcdModelReferenceDecoder. It keeps a list of associated ILcdModelReferenceDecoders. When it is asked to decode a model reference, it loops over its associated ILcdModelReferenceDecoders to find one that does not return null, or that does not throw an exception. The model reference provided by that decoder is then returned.

When creating a new TLcyCompositeModelReferenceDecoder using the default constructor (see TLcyCompositeModelReferenceDecoder()), the created instance will only work on/with the ILcdModelReferenceDecoders registered on this composite instance (see addModelReferenceDecoder(com.luciad.model.ILcdModelReferenceDecoder) and removeModelReferenceDecoder(com.luciad.model.ILcdModelReferenceDecoder)).

When creating a new TLcyCompositeModelReferenceDecoder using the constructor specifying an ILcyLucyEnv instance (see TLcyCompositeModelReferenceDecoder(com.luciad.lucy.ILcyLucyEnv), the created instance will work on the Lucy back-end services. It will use all registered ILcdModelReferenceDecoder instances of the Lucy back-end, adding and/or removing an ILcdModelReferenceDecoder will add/remove the ILcdModelReferenceDecoder as service from Lucy, ... .

Decoding an ILcdModelReference for a source name using the back-end based implementation can be done by creating a new instance of this class:


 //Create a new instance whenever you need it.
 TLcyCompositeModelReferenceDecoder decoder = new TLcyCompositeModelReferenceDecoder( aLucyEnv );
 try{
   ILcdModelReference modelReference = decoder.decodeModelReference( aSourceName );
 } catch ( IOException aException ){
   //exception occurred during the decoding
 }
 //There is no need to keep a reference to the composite instance, you can create a new one
 //the next time you would need it
 provider = null;