Archive for the 'Dr Flex Question' Category

Nov 13 2008

Deploying Adobe AIR in a locked down enterprise environment

Disease:
Your (customers) IT organization is resistant in rolling out the Adobe AIR runtime throughout the organization because “it is not secure”. Your rich internet application on the desktop is at risk because the desktop administrators in the IT department have heard that AIR applications have access to the local file system, and more, and thus don’t want users to install those applications.

Prescription:
It is recommended to point these administrators to the Adobe AIR Administrator’s Guide which covers enterprise deployment and configuration of Adobe AIR.

We have found that not all desktop administrators are aware of the ability to ‘lock down’ the Adobe AIR runtime when deployed within their organization. They tend to think that once Adobe AIR has been deployed on the desktop, that all users can just install any application which has the potential to harm local resources. The guide covers most of these concerns (and if not, let us know!) and should help administrators to better identify and limit the risks involved, for example by only allowing trusted applications to run within their firewalls.

The guide outlines how on Windows, IT administrators can apply configuration settings using registry keys to prevent installation of all AIR applications, how they can only prevent installation of untrusted AIR applications and how to disable automatic updates of the AIR runtime updates. The Adobe AIR runtime can also be silently installed, AIR based applications can be silently installed and End User License Agreements can be centrally suppressed by IT administrators (who accept the agreement on the users behalf.

Tips to stay healthy:
Adobe’s devnet has a dedicated section discussing Adobe AIR for IT administrators. It features articles on centrally distributing Adobe AIR in the enterprise and the Adobe AIR Security Whitepaper alongside the previously mentioned Adobe AIR Administrators Guide.

No responses yet

Oct 22 2008

LiveCycle Data Services 2.6 Capacity Planning Guide Now Available

Finally the Capacity Planning Guide for LiveCycle Data Services 2.6 has been published on the Adobe site. A document like this was asked for a few times during a DrLiveCycle consult, so it seems very welcomed by Flex developers leveraging Adobe LCDS.

As Damon Cooper, Director of Engineering, wrote on his website:

With LiveCycle Data Services 2.6, you can create Adobe Flex applications that can deliver thousands of messages per second to thousands of end users simultaneously:

This document presents the results of software benchmark tests performed by Adobe engineers on my LiveCycle Data Services team and show how LiveCycle Data Services 2.6 can scale linearly and perform under load using various messaging scenarios that represent real-world situations. It provides a starting point for those who need to plan a hardware and software infrastructure that scales in a linear fashion to meet peak period demand.

You can download the Capacity Planning Guide for LiveCycle Data Services 2.6 from www.adobe.com/go/lcds26_cap_planning_guide.

No responses yet

Oct 21 2008

Answering LiveCycle Data Services messaging questions

This month’s DrLiveCycle consult was about leveraging the message feature of LiveCycle Data Services.

Disease:
You are planning the architecture of your LCDS Messaging based application and you asked yourself the following questions:

  • Is the order in which the messages are delivered to the clients always guaranteed, and does that depend on which channel you use?
  • If you have many concurrent consumers/producers connected to your messaging destination, but the consumers/producers don’t generate a lot of messages, would that have more impact on the processor or the memory

Prescription:
DrLiveCycle checked back with the engineering specialists (Jeff Vroom and Mete Atamel helped the doctor with the right diagnose) and learned that the order of messages from server to client are currently only guaranteed when using the RTMP channel. A RTMP channel uses only a single TCP connection and therefore the message order is always guaranteed. The AMF/HTTP channels, on the other hand, may issue concurrent HTTP requests over multiple TCP connections and even though each TCP connection guarantees its message ordering, there’s no message order guaranteed across multiple TCP connections. So, currently the order is only guaranteed with RTMP channels.

So how about memory and CPU usage of low-active consumers? The answer is that an inactive consumer would just take up memory (there is the connection memory, session memory etc.). The only CPU load that an idle messaging client would take up is any load caused by polling, or the heart-beat style functionality that was put into the HTTP streaming channel.

Tips to stay healthy:
The polling overhead is fairly easy to compute based on your settings – how long does the request wait on both the client and the server. The streaming overhead is pretty low… periodically the server has to send some bytes back on the connection to keep it alive. The RTMP channels – when not using the RTMPT HTTP polling mode – don’t have any significant overhead.

One response so far

Sep 29 2008

Load test Flex and LiveCycle Data Services enabled applications

Disease:
You have built an amazing cool and data intense Rich Internet Application with Adobe Flex and expect many users to work with your application. Suddenly you get concerned; how will the server behave when hundreds or even thousands of users visit your site?

Prescription:
Some more background on this problem first; You probably know that a server in production will behave differently when interacting with a RIA than compared to serving traditional HTML apps that you have been building before.  This is mainly because UIs are not generated on the server any more. Though on the other side, there is probably increased data exchange between the client and server and most of all…. ideally you use the ActionScript Message Format (AMF) and Data Management cause it is easier to develop or faster on the client.  But how does it impact the server, can it handle the load and do traditional load testing tools still work?

LiveCycle Data Services Stress Testing Framework admin UI screenshot

Adobe currently hosts the LiveCycle Data Services Stress Testing Framework on Adobe Labs which addresses lots of these questions. The framework helps developers that use LiveCycle Data Services ES 2.6 to load test the server-side implementation of their LCDS applications. The page is stuffed with information on how to use the Framework so definitely spend some time going through all the details. The Data Services Stress Testing Framework is currently in beta form, but available for testing and evaluation. You can download and test the framework and we obviously hope you will provide us your feedback through the Adobe Labs page.

Tips to stay healthy:
The stress / load testing problem itself has been around for long, and many software vendors have created solutions to help web developers test their servers for large rollouts. However, most of these solutions are still based on the traditional HTML web metaphor and do not work well with AMF. Also, the Data Services Stress Testing Framework currently does not support BlazeDS or other AMF server implementations. Adobe is currently working with a number of testing tool vendors to implement all of the data transport protocols available in Flash. It seems that Borland’s SilkPerformer is one of the first to have AMF3 support. I have not worked with it myself and would love your feedback. Obviously if you know of other tools that are useful for load testing your Flex applications, feel free to leave a comment!

ps: I heard internally that we are working on a new Capacity Planning Guide for LiveCycle Data Services ES 2.6 whitepaper, but it has not yet been finalized. I assume it will be posted in the coming weeks on the LiveCycle Development Center so stay tuned.

UPDATE: You can download the Capacity Planning Guide for LiveCycle Data Services 2.6 from www.adobe.com/go/lcds26_cap_planning_guide.

4 responses so far

Jul 08 2008

LiveCycle Data Services and Java EE container managed security

Disease

You want to authenticate via a Flex application and still leverage Java EE container managed security.

Prescription

With LiveCycle ES Data Services you can authenticate users using the Flex application and you can pass these credentials on to the back-end where they will be verified by the container. The server-side Flex Session give you access to the Principal object. Through the use of roles you can authorize users to invoke LiveCycle ES Data Services endpoints or avoid users invoking specific LiveCycle ES Data Services assembler methods.

Following steps explain how to set this up on Tomcat 5.5.

  • Download the source of this sample from Adobe share and import the Flex project
  • Configure container managed security in Tomcat.
  • Follow the steps in $LCDSHOME/resources/security/tomcat/readme.txt (download LiveCycle ES Data Services)
  • Create a LiveCycle ES Data Services project in Eclipse (Dr. FLex & Dr. LiveCycle)
  • In your project, create a context.xml under META-INF/
 

<Context>
      <Realm className="org.apache.catalina.realm.MemoryRealm" />
      <Valve className="flex.messaging.security.TomcatValve"/>
</Context>

 
  • In your project, edit services-config.xml in WEB-INF/flex, the <security> tag should point to the following login command:
 

<security>
    <login-command class="flex.messaging.security.TomcatLoginCommand"
                               server="Tomcat">
      <per-client-authentication>false</per-client-authentication>
    </login-command>

</security>

 
  • To pass on the credentials captured in your Flex application to your back-end you can use (see main.mxml in the code sample):
 

personDS.setCredentials(username.text, password.text);

 

      personDS is a LiveCycle ES Data Services Data Management endpoint

  • The container will only allow you to access the LiveCycle ES Data Services endpoint when these credentials are valid.
  • To obtain the Principal in the LiveCycle ES Data Services assembler you execute (see PersonAssember in the code sample). For more info on assemblers, go to Dr Flex & Dr. LiveCycle or consult the LiveCycle Data Services Developer Guide.
  Principal principal = FlexContext.getUserPrincipal();  

 

Tips to stay healthy :

You can extend this further by leveraging the integration between LiveCycle ES Data Services and Java EE security by protecting resources via roles to allow only specific users to invoke Data Services endpoints.

Embedding the following in your LiveCycle ES Data Services data-management-config.xml file, you can avoid users not having the correct role to invoke this endpoint (see sample code):

 

<destination id="persons">

    <adapter ref="java-dao" />
    <security>
        <security-constraint>
            <auth-method>Custom</auth-method>
            <roles>
                <role>help</role>
            </roles>
        </security-constraint>
    </security>

    ….

One response so far

Jul 08 2008

LiveCycle ES Data Services [Data Management] and Java Enums

Disease :

You want to use LiveCycle ES Data Services on top of a Java back-end that is using Java enums.

Prescription :

LiveCycle ES Data Services 2.6 supports Java enums. When serializing from Java to ActionScript, Data Services will transform the Java enum value into an ActionScript String. When serializing from ActionScript to Java, Data Services will assign the correct enum value to the corresponding Java attribute.

Let’s see how it looks like. To get started we create a LiveCycle ES Data Services project (What is the preferred LiveCycle Data Services development environment). In the next part we will run through all the steps needed to develop a LiveCycle ES Data Services Data Manangement application.

The Java side

The Java enum looks like this

 

package myenum.test;

public enum MyEnum {
    VOLVO,
    PORSCHE,
    AUDI,
    BMW;
}

 

 

The DTO looks like this:

 

package myenum.test;

public class MyDTO {

    public int id;
    public MyEnum car;
    public String name;
}

 

 

 

LiveCycle ES Data Services Data Management automatically takes care of all DTO’s that are modified and retrieved by the Flex application (created, deleted and updated objects). When a client side "commit" operation is invoked the modifications are sent to the server. Those changes are mapped to your back-end via an assembler class. Typically this class implements four methods (fill, createItem, updateItem and deleteItem). In this example the assembler class looks like this:

 

 

package myenum.test;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import flex.data.assemblers.AbstractAssembler;

public class MyAssembler extends AbstractAssembler {

    @Override
    public Collection fill(List fillParameters) {
        ArrayList<MyDTO> list = new ArrayList<MyDTO>();
        MyDTO myDTO = new MyDTO();
        myDTO.id = 1;
        myDTO.name = "Marc";
        myDTO.car = MyEnum.AUDI;
        list.add(myDTO);
        // TODO Auto-generated method stub
        return list;
    }

    @Override
    public void createItem(Object item) {
        MyDTO myDTO = (MyDTO) item;
        System.out.format("Name : %s\nCar : %s", myDTO.name, myDTO.car);
    }

    @Override
    public void deleteItem(Object previousVersion) {

        MyDTO myDTO = (MyDTO) previousVersion;
        System.out.format("Name : %s\nCar : %s", myDTO.name, myDTO.car);
    }

    @Override
    public void updateItem(Object newVersion, Object previousVersion,
            List changes) {

        MyDTO myDTO = (MyDTO) newVersion;
        System.out.format("Name : %s\nCar : %s", myDTO.name, myDTO.car);
    }
}

 

In the real world these methods will be calling your specific services to retrieve and process the information.

Before we go to the Flex client we need to configure a Data Management endpoint by configuring the data-management-config.xml file in your LiveCycle ES Data Services project (located in WEB-INF/flex)

 

 

<destination id="myds">

    <adapter ref="java-dao" />
    <channels>
       <channel ref="my-rtmp"/>
    </channels>

    <properties>

        <auto-sync-enabled>true</auto-sync-enabled>

        <use-transactions>false</use-transactions>

        <source>myenum.test.MyAssembler</source>
        <scope>application</scope>

        <metadata>
            <identity property="id" />
        </metadata>

        <network>
            <session-timeout>20</session-timeout>
            <paging enabled="false" pageSize="10" />
            <throttle-inbound policy="ERROR" max-frequency="500" />
            <throttle-outbound policy="REPLACE" max-frequency="500" />
        </network>

        <server/>

    </properties>

</destination>

 

 

The Flex side

The ActionScript DTO (it maps directly to the Java class):

 

package vo
{
    [Managed]
    [RemoteClass(alias="myenum.test.MyDTO")]   
    public class MyDTO
    {
        public function MyDTO()
        {
        }
        public var id:int;
        public var name:String;
        public var car:String;

    }
}

 

The Flex application:

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

    <mx:Script>
        <![CDATA[
            import vo.MyDTO;

            private function createMyDTO():void {
                var myDTO:MyDTO = new MyDTO();
                myDTO.id = 0;
                myDTO.name = "Marc";
                myDTO.car = "BMW";
                myCol.addItem(myDTO);
            }

          ]]>
    </mx:Script>

 

    <mx:DataService id="myDS" destination="myds" autoCommit="false"/>
    <mx:ArrayCollection id="myCol"/>

    <mx:Panel x="116" y="49" width="488" height="204" layout="absolute">
        <mx:DataGrid id="myDG" x="0" y="0" width="100%" height="100%"
                     dataProvider="{myCol}" editable="true">
        </mx:DataGrid>
        <mx:ControlBar>
            <mx:Button label="Query" click="myDS.fill(myCol)"/>
            <mx:Button label="Create" click="createMyDTO()"/>
            <mx:Button label="Save"
                  enabled="{myDS.commitRequired}" click="myDS.commit()"/>
            <mx:Button label="Undo"
                  enabled="{myDS.commitRequired}" click="myDS.revertChanges()"/>
        </mx:ControlBar>
    </mx:Panel>
</mx:Application>

 

 

On the Java side "car" is a enum while in ActionScript it is a String. Assigning "BMW" to a newly created myVO results serverside in a new myVO with the car enum equal to BMW.

Notice that there are no explicit calls made to the server for creating, deleting or updating the DTO’s. The only interaction with the server happens through the fill and the save operation. LiveCycle ES Data Services Data Management takes care of the hard work.

image

You can download the sources for this sample as a LiveCycle ES Data Services project archive from Adobe Share, next import this into your Eclipse + Flex plugin environment.

Tip to stay healthy:

Check out Christophe Coenraets‘ website to find more examples about LiveCycle ES Data Services. You can download LiveCycle ES Data Services 2.6 (beta) from Adobe Labs.

2 responses so far

Jun 25 2008

How to integrate Flex with an online payment system like Ogone ?

Disease :
What would be the best way to integrate an online payment system like Ogone into my Flex application ?
Prescription :
Depending on the payment system, there are a number of different options.
Option 1 : Use the payment provider web application that handles payment
This is probably the best way to integrate as the payment provider will handle the full payment and has to take care of security. Most of the payment providers will provide you with an html application that you can integrate into your own application, and which is running on a secure environment.You would forward your user to this HTML page. When the payment transaction is done,
the payment service will return your customer to your application and provide
it with information on the transaction. So your Flex application will not even see any credit card details !
So how can you integrate this secure HTML payment application into your Flex application ? The best way is to show the application in an iFrame on top of your Flex application. The Flex application will be able to communicate with the iFrame through FABridge. FABridge is an Adobe javascript library that allows flash player to interact with the HTML container and the other way around. Alistair Rutherford wrote a post on how to use an iFrame on top of your Flex application.
The solution Ogone is providing is Ogone e-commerce. I have build an example integrating Flex with Ogone e-commerce. You can find the source code here.
Here in a few steps what you need to take care of :
1. PaymentEvent.as : Custom event that is used to pass the payment data to the HTML page running in the iFrame.
2. iFrame.as : iFrame component build by Alistair RutherFord
3. Add the FABridge javascript library to ‘html-template/index.template.html’ and add the .js itself.
4. ogone_html.html : html file that will runn in iFrame. Main part is an HTML form that we’ll submit to the Ogone server. Notice how I added an event listener for the Payment event, and i fill in the form and submit it. Also check the form to see what is configurable on the payment side.
5. ogone_bevestiging : html file that will be called by Ogone when transaction is over. Ogone will call this html file with an attribute indicating the status of the transaction. When this page is loaded you can see in the load() function I’m calling the transactionOver() function in my Flex application (Ogone.mxml). TransactionOver function will take as an argument the transaction status and show it in my Flex application.
You can find the source files on here
And have a look at the application here. (Use this test VISA number : 4111 1111 1111 1111)
Option 2 : Use the payment provider API’s.
In this case you’ll build the UI that will handle payment details yourself, which means you’ll be responsable for providing the necesary security measures. After collectint the credit card details you’ll be using the API’s to handle the payment.
So depending on the API technology you’ll have to use a specific solution :
Tips to stay healthy :
Taking care of payments is a delicate thing. Check out legal and security issues. Try to go for solution 1, which will put those responsibilities on the payment provider.

17 responses so far

Jun 18 2008

What is the preferred LiveCycle Data Services development environment

Disease : 

What would be the best development environment if I want to start developing a Flex applications that uses LiveCycle ES Data Services, so I can interact with a database or any other backend system ? 

Prescription : 

You will need these components :

  • Flex Builder (full version or plugin) : You will use the Flex Builder plugin to build and debug your Flex application (MXML/Actionscript).
  • Apache Tomcat (or any other J2EE server) : LiveCycle Data Services is a J2EE Web component (WAR), so you need a J2EE web container to run LiveCycle ES DataServices. You’ll need to add “Java Open Transaction Manager” to Tomcat, to make sure Data Management can handle your database transactions. 
  • Eclipse WTC plugin : This plugin extends the Eclipse platform with tools for developing Web and Java EE applications. 
  • LiveCycle Data Services (get your trial version at adobe.com)

All these components are available for Windows and Mac. So you can set up this environment on both operating systems. 

For setting up these components there are 2 approaches :
  • Install Eclipse and add Flex Builder as a plugin. In this case you probably want to start off with the Eclipse “Europa” version. The Eclipse Europa build is is a coordinated release of different Eclipse project teams. This release will contain extra components, like WTC,  that will make development easier. 
  • Install Flex Builder and add the WTC plugin. 

Mihae Corlan has described the second option. In his post you can also find how to create a combined Flex/J2EE project and how to add the Tomcat installation. (which is applicable to both approaches ofcourse )

Mihae also added a post on how debugging works in a Flex/J2EE project. 

So now you are ready to build your Flex data rich application that will use LiveCycle Data Services. You will be able to edit the Flex Data Services configuration XML files in Eclipse, write your Assemblers, etc … Every modification will be picked up and automatically deployed. 
  
Tips to stay healthy :
 
When building data intensive RIA applications with intensive use  of CRUD operations, use LiveCycle Data Services data management functionality. It will save you loads of development time and minimize the number of code that has to be written. This will benefit the readability and maintenance of your code and it provides you extra functionality like support for database transactions. 

2 responses so far