flex.messaging
Class FactoryInstance

java.lang.Object
  extended by flex.messaging.FactoryInstance
Direct Known Subclasses:
JavaFactoryInstance

public class FactoryInstance
extends Object

This class is used by the FlexFactory to store the configuration for an instance created by the factory. There is one of these for each destination currently since only destinations create these components.

See Also:
FlexFactory

Constructor Summary
FactoryInstance(FlexFactory factory, String id, ConfigMap properties)
          Normally FactoryInstances are constructed by FDS during startup so you do not need to use this method.
 
Method Summary
 String getId()
           
 Class getInstanceClass()
          If possible, returns the class for the underlying configuration.
 ConfigMap getProperties()
          Returns the ConfigMap that this factory instance was created with.
 String getScope()
           
 String getSource()
           
 Object lookup()
          Return an instance as appropriate for this instance of the given factory.
 void operationComplete(Object instance)
          When the caller is done with the instance, this method is called.
 void setScope(String scope)
          Since many factories may provide components in different scopes, this is abstracted in the base factory instance class.
 void setSource(String source)
          This is by convention the main property for the defining the instance we create with this factory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryInstance

public FactoryInstance(FlexFactory factory,
                       String id,
                       ConfigMap properties)
Normally FactoryInstances are constructed by FDS during startup so you do not need to use this method. It is typically called from the FlexFactory.createFactoryInstance method as FDS is parsing the destination configuration information for a given destination. You can override this method to extract additional configuration for your component from the properties argument.

Parameters:
factory - the FlexFactory this FactoryInstance is created from
id - the Destination's id
properties - the configuration properties for this destination.
See Also:
ConfigMap
Method Detail

getId

public String getId()
Returns:
The destination's id that this FactoryInstance is associated with.

setScope

public void setScope(String scope)
Since many factories may provide components in different scopes, this is abstracted in the base factory instance class.


getScope

public String getScope()

setSource

public void setSource(String source)
This is by convention the main property for the defining the instance we create with this factory. It may be the class name for the JavaFactory or the id for a factory that uses ids.


getSource

public String getSource()

getInstanceClass

public Class getInstanceClass()
If possible, returns the class for the underlying configuration. This method can return null if the class is not known until the lookup method is called. The goal is so the factories which know the class at startup time can provide earlier error detection. If the class is not known, this method can return null and validation will wait until the first lookup call.

Returns:
the class for this configured instance or null if the class is not known until lookup time.

getProperties

public ConfigMap getProperties()
Returns the ConfigMap that this factory instance was created with. You can use this ConfigMap to retrieve additional properties which this factory instance is configured with. For example, if you are defining a remote object destination, your FactoryInstance can be configured with additional XML tags underneath the properties tag for your destination. It is important that if you expect additional properties that you access in the ConfigMap or call allowProperty on that property when the FactoryInstance is created. Otherwise, these properties can generate warnings about "unexpected" configuration.

See Also:
ConfigMap

lookup

public Object lookup()
Return an instance as appropriate for this instance of the given factory. This just calls the lookup method on the factory that this instance was created on. You override this method to return the specific component for this destination.


operationComplete

public void operationComplete(Object instance)
When the caller is done with the instance, this method is called. For session scoped components, this gives you the opportunity to update any state modified in the instance in a remote persistence store. This method is not called when the object should be destroyed. To get a destroy notification, you should register for the appropriate events via the FlexContext.

Parameters:
instance - the instance returned via the lookup method for this destination for this operation.


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/FactoryInstance.html