Advanced Data Communication with the Flash Platform
             twitter.com/wadearnold
                 wadearnold.com
            wade.arnold@t8design.com
resources
Zend AMF Downloads
http://framework.zend.com/download/amf

Adobe Flash Builder 4 beta 2
http://labs.adobe.com/technologies/flashbuilder4/

New PHP Features in Flash Builder 4 - Part 1: Data-Centric Feature Overview
http://ria.dzone.com/articles/new-php-features-flash-builder

New PHP Features in Flash Builder 4 - Part 2: Using Zend AMF and Flash Remoting
http://ria.dzone.com/articles/new-php-features-flash-builder-2

Session Files
http://wadearnold.com/blog/
Why AMF?
• Binary + referencing = fast wire speed
• One CPU cycle and it can be rendered
• No parsing time on the cpu
• No parsing logic w/ the developer
• Alternative endpoint in your SOA
  architecture
http://jamesward.com/census
One year.....
• Zend Amf was released into ZF incubator
  at ZendCon ‘08
• 96 bugs fixed
• 6 Features added
• 44 outstanding features / bugs
• 89% of code coverage
• 7 SVN committers
DB Resource Plugin
• Mysqli Result
• Mysql Result
public function getArrayCollection() {
   $this -> connect();
   $sql = "SELECT * FROM census " .
   	 "LIMIT 100";
   $result = mysql_query( $sql ) or die( "Query failed: " .
   mysql_error() );
   return $result;
}
Authentication
public function ServiceDelegateAmf(responder:IResponder):void {
	 this.responder = responder;
	 this.service =
ServiceLocator.getInstance().getRemoteObject("zendamf");
	 this.service.setCredentials("wade", "arnold");
}
Create Auth Adapter
class RemoteUser extends Zend_Amf_Auth_Abstract
{
    public function __construct($name, $role)
    {
        $this->_name = $name;
        $this->_role = $role;
    }
    public function authenticate()
    {
        $id = new stdClass();
        $id->role = $this->_role;
        $id->name = $this->_name;
        return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS,
$id);
    }
}
bootstrap

$this->_server = new Zend_Amf_Server();

$this->_acl = new Zend_Acl();
$this->_server->setAuth(new RemoteUser("wade", "testrole"));
$this->_acl->addRole(new Zend_Acl_Role("testrole"));
$this->_acl->allow("testrole", null, null);
$this->_server->setAcl($this->_acl);
Basic Service
class demo {
    function hello() {
        return "hello!";
    }

    function hello2() {
        return "hello2!";
    }

    function initAcl(Zend_Acl $acl) {
        $acl->allow("testrole", null, "hello");
        $acl->allow("testrole2", null, "hello2");
        return true;
    }
}
More Auth & ACL!

• Open ID
• Ldap
• Database
• Conditional rules
Model


package com.t8.census.vo               <?php
{                                      class Person
	 [Bindable]                           {
	 [RemoteClass(alias="Person")]          public $id = 0;
	 public class PersonVO                  public $age = "";
	 {                                      public $classofworker = "";
	 	 public var id:int = 0;               public $education = "";
	 	 public var age:int;                  public $maritalstatus = "";
	 	 public var classofworker:String;     public $race = "";
	 	 public var education:String;         public $sex = "";
	 	 public var maritalstatus:String;   }
	 	 public var race:String;
	 	 public var sex:String;
	 }
}
What’s Next?
• Documentation
 • Adobe Evangalist, Adobe TV, DZone
• HTTP Long Pulling
• Speed
 • cache reflection
 • AMFEXT
• Service Browser
Help?


 Issue tracker
   Mailing list
Documentation
Advanced Data Communication with the Flash Platform
             twitter.com/wadearnold
                 wadearnold.com
            wade.arnold@t8design.com

Zendcon 09

  • 1.
    Advanced Data Communicationwith the Flash Platform twitter.com/wadearnold wadearnold.com wade.arnold@t8design.com
  • 2.
    resources Zend AMF Downloads http://framework.zend.com/download/amf AdobeFlash Builder 4 beta 2 http://labs.adobe.com/technologies/flashbuilder4/ New PHP Features in Flash Builder 4 - Part 1: Data-Centric Feature Overview http://ria.dzone.com/articles/new-php-features-flash-builder New PHP Features in Flash Builder 4 - Part 2: Using Zend AMF and Flash Remoting http://ria.dzone.com/articles/new-php-features-flash-builder-2 Session Files http://wadearnold.com/blog/
  • 3.
    Why AMF? • Binary+ referencing = fast wire speed • One CPU cycle and it can be rendered • No parsing time on the cpu • No parsing logic w/ the developer • Alternative endpoint in your SOA architecture
  • 4.
  • 5.
    One year..... • ZendAmf was released into ZF incubator at ZendCon ‘08 • 96 bugs fixed • 6 Features added • 44 outstanding features / bugs • 89% of code coverage • 7 SVN committers
  • 6.
    DB Resource Plugin •Mysqli Result • Mysql Result public function getArrayCollection() { $this -> connect(); $sql = "SELECT * FROM census " . "LIMIT 100"; $result = mysql_query( $sql ) or die( "Query failed: " . mysql_error() ); return $result; }
  • 7.
    Authentication public function ServiceDelegateAmf(responder:IResponder):void{ this.responder = responder; this.service = ServiceLocator.getInstance().getRemoteObject("zendamf"); this.service.setCredentials("wade", "arnold"); }
  • 8.
    Create Auth Adapter classRemoteUser extends Zend_Amf_Auth_Abstract { public function __construct($name, $role) { $this->_name = $name; $this->_role = $role; } public function authenticate() { $id = new stdClass(); $id->role = $this->_role; $id->name = $this->_name; return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $id); } }
  • 9.
    bootstrap $this->_server = newZend_Amf_Server(); $this->_acl = new Zend_Acl(); $this->_server->setAuth(new RemoteUser("wade", "testrole")); $this->_acl->addRole(new Zend_Acl_Role("testrole")); $this->_acl->allow("testrole", null, null); $this->_server->setAcl($this->_acl);
  • 10.
    Basic Service class demo{ function hello() { return "hello!"; } function hello2() { return "hello2!"; } function initAcl(Zend_Acl $acl) { $acl->allow("testrole", null, "hello"); $acl->allow("testrole2", null, "hello2"); return true; } }
  • 11.
    More Auth &ACL! • Open ID • Ldap • Database • Conditional rules
  • 17.
    Model package com.t8.census.vo <?php { class Person [Bindable] { [RemoteClass(alias="Person")] public $id = 0; public class PersonVO public $age = ""; { public $classofworker = ""; public var id:int = 0; public $education = ""; public var age:int; public $maritalstatus = ""; public var classofworker:String; public $race = ""; public var education:String; public $sex = ""; public var maritalstatus:String; } public var race:String; public var sex:String; } }
  • 19.
    What’s Next? • Documentation • Adobe Evangalist, Adobe TV, DZone • HTTP Long Pulling • Speed • cache reflection • AMFEXT • Service Browser
  • 20.
    Help? Issue tracker Mailing list Documentation
  • 21.
    Advanced Data Communicationwith the Flash Platform twitter.com/wadearnold wadearnold.com wade.arnold@t8design.com