<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>UKoom &#187; Flex</title>
	<atom:link href="http://www.ukoom.com/tag/flex/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ukoom.com</link>
	<description>Documentum, SharePoint, Alfresco, ECM...</description>
	<lastBuildDate>Thu, 13 May 2010 00:21:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>BlazeDS factory mechanism</title>
		<link>http://www.ukoom.com/blazeds-factory-mechanism.htm</link>
		<comments>http://www.ukoom.com/blazeds-factory-mechanism.htm#comments</comments>
		<pubDate>Wed, 23 Dec 2009 09:05:17 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Web MVC]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=988</guid>
		<description><![CDATA[BlazeDS provides a [...]]]></description>
			<content:encoded><![CDATA[<p>BlazeDS provides a factory mechanism that lets you plug in your own component creation and maintenance system to allow it to integrate with systems like EJB and Spring, which store components in their own namespace. You provide a class that implements the flex.messaging.FlexFactory interface. This class is used to create a FactoryInstance that corresponds to a component configured for a specific destination.</p>
<p>Remoting Service destinations use Java classes that you write to integrate with Flex clients. By default, BlazeDS creates these instances. If they are application-scoped components, they are stored in the ServletContext attribute space using the destination&#8217;s name as the attribute name. If you use session-scoped components, the components are stored in the FlexSession, also using the destination name as the attribute. If you specify an <samp>attribute-id</samp> element in the destination, you can control which attribute the component is stored in; this lets more than one destination share the same instance.</p>
<p>The following examples shows a destination definition that contains an <samp>attribute-id</samp> element:</p>
<pre>&lt;destination id="WeatherService"&gt;
    &lt;properties&gt;
        &lt;source&gt;weather.WeatherService&lt;/source&gt;
        &lt;scope&gt;application&lt;/scope&gt;
        &lt;attribute-id&gt;MyWeatherService&lt;/attribute-id&gt;
    &lt;/properties&gt;
&lt;/destination&gt;</pre>
<p>In this example, BlazeDS creates an instance of the class weather.WeatherService and stores it in the ServletContext object&#8217;s set of attributes with the name MyWeatherService. If you define a different destination with the same <samp>attribute-id</samp> value and the same Java class, BlazeDS uses the same component instance.</p>
<p>BlazeDS provides a factory mechanism that lets you plug in your own component creation and maintenance system to BlazeDS so it integrates with systems like EJB and Spring, which store components in their own namespace. You provide a class that implements the flex.messaging.FlexFactory interface. You use this class to create a FactoryInstance that corresponds to a component configured for a specific destination. Then the component uses the FactoryInstance to look up the specific component to use for a given request. The FlexFactory implementation can access configuration attributes from a BlazeDS configuration file and also can access FlexSession and ServletContext objects. For more information, see the documentation for the FlexFactory class in the public BlazeDS Javadoc documentation.</p>
<p>After you implement a FlexFactory class, you can configure it to be available to destinations by placing a <samp>factory</samp> element in the <samp>factories</samp> element in the services-config.xml file, as the following example shows. A single FlexFactory instance is created for each BlazeDS web application. This instance can have its own configuration properties, although in this example, there are no required properties to configure the factory.</p>
<pre>&lt;factories&gt;
    &lt;factory id="spring"/&gt;
&lt;/factories&gt;</pre>
<p>BlazeDS creates one FlexFactory instance for each <samp>factory</samp> element that you specify. BlazeDS uses this one global FlexFactory implementation for each destination that specifies that factory by its ID; the ID is identified by using a <samp>factory</samp> element in the <samp>properties</samp> section of the destination definition. For example, your remoting-config.xml file could have a destination similar to the following one:</p>
<pre>&lt;destination id="WeatherService"&gt;
    &lt;properties&gt;
        &lt;factory&gt;spring&lt;/factory&gt;
        &lt;source&gt;weatherBean&lt;/source&gt;
    &lt;/properties&gt;
&lt;/destination&gt;</pre>
<p>When the <samp>factory</samp> element is encountered at start up, BlazeDS calls the <samp>FlexFactory.createFactoryInstance()</samp> method. That method gets the <samp>source</samp> value and any other attributes it expects in the configuration. Any attributes that you access from the ConfigMap parameter are marked as expected and do not cause a configuration error, so you can extend the default BlazeDS configuration in this manner. When BlazeDS requires an instance of the component for this destination, it calls the <samp>FactoryInstance.lookup()</samp> method to retrieve the individual instance for the destination.</p>
<p>Optionally, factory instances can take additional attributes. There are two places you can do this. When you define the factory initially, you can provide extra attributes as part of the factory definition. When you define an instance of that factory, you can also add your own attributes to the destination definition to be used in creating the factory instance.</p>
<p>The boldface text in the following example shows an attribute added to the factory definition:</p>
<pre>&lt;factories&gt;
    &lt;factory id="myFactoryId"&gt;
        &lt;properties&gt;
<strong><samp>            &lt;myfactoryattributename&gt;</samp></strong>
<strong><samp>                myfactoryattributevalue</samp></strong>
<strong><samp>            &lt;/myfactoryattributename&gt;</samp></strong>
        &lt;/properties&gt;
    &lt;/factory&gt;
&lt;/factories&gt;</pre>
<p>You could use this type of configuration when you are integrating with the Spring Framework Java application framework to provide the Spring factory with a default path for initializing the Spring context that you use to look up all components for that factory. In the class that implements FlexFactory, you would include a call to retrieve the values of the <samp>myfactoryattributename</samp> from the <samp>configMap</samp> parameter to the <samp>initialize()</samp> method in the FlexFactory interface, as the following example shows:</p>
<pre>public void initialize(String id, ConfigMap configMap){
    System.out.println("**** MyFactory initialized with: " +
        configMap.getPropertyAsString("myfactoryattributename", "not set"));
}</pre>
<p>The <samp>initialize()</samp> method in the previous example retrieves a string value where the first parameter is the name of the attribute, and the second parameter is the default value to use if that value is not set. For more information about the various calls to retrieve properties in the config map, see the documentation for the flex.messaging.config.ConfigMap class in the public BlazeDS Javadoc documentation. Each factory instance can add configuration attributes that are used when that factory instance is defined, as the following example shows:</p>
<pre>&lt;destination id="myDestination"&gt;
    &lt;properties&gt;
        &lt;source&gt;mypackage.MyRemoteClass&lt;/source&gt;
        &lt;factory&gt;myFactoryId&lt;/factory&gt;
        &lt;myfactoryinstanceattribute&gt;
            myfoobar2value
        &lt;/myfactoryinstanceattribute&gt;
    &lt;/properties&gt;
&lt;/destination&gt;</pre>
<p>In the <samp>createFactoryInstance()</samp> method as part of the FlexFactory implementation, you access the attribute for that instance of the factory, as the following example shows:</p>
<pre>public FactoryInstance createFactoryInstance(String id, ConfigMap properties) {
    System.out.println("**** MyFactoryInstance instance initialized with myfactoryinstanceattribute=" +
    properties.getPropertyAsString("myfactoryinstanceattribute", "not set"));
….
}

All these info are from http://livedocs.adobe.com/blazeds/1/blazeds_devguide</pre>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/flex-lc-ds-fds-and-blazeds.htm" title="Flex LC DS FDS and BlazeDS">Flex LC DS FDS and BlazeDS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/blazeds-factory-mechanism.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex LC DS FDS and BlazeDS</title>
		<link>http://www.ukoom.com/flex-lc-ds-fds-and-blazeds.htm</link>
		<comments>http://www.ukoom.com/flex-lc-ds-fds-and-blazeds.htm#comments</comments>
		<pubDate>Mon, 21 Dec 2009 06:04:26 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Web MVC]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=976</guid>
		<description><![CDATA[* Flex 1.0 [...]]]></description>
			<content:encoded><![CDATA[<p>* Flex 1.0 (includes the SDK and Server) – Released March 2004</p>
<p>* Flex 1.5  – Released Nov 2004</p>
<p>* FDS (Flex Data Services) was decoupled from the Flex SDK in Flex 2.0 – Released 2006</p>
<p>* FDS was renamed LiveCycle Data Services – released as LC DS 2.5 in summer 2007</p>
<p>* LC DS 2.5.1 in fall 2007</p>
<p>* An open source version of remoting and messaging was released as Blaze DS in early 2008</p>
<p>* LC DS 2.6 was released in mid 2008</p>
<p>* LC DS 2.6.1 was released in Nov 2008</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/blazeds-factory-mechanism.htm" title="BlazeDS factory mechanism">BlazeDS factory mechanism</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/flex-lc-ds-fds-and-blazeds.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
