blaze-ds presentation by subrata

Upload: subratasaha

Post on 31-May-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Blaze-ds Presentation by Subrata

    1/25

    Blaze-DS Exploration Findings

  • 8/14/2019 Blaze-ds Presentation by Subrata

    2/25

    CONFIDENTIAL

    Introduction-

    Blaze DS is a server-based Java remoting and web

    messaging technology that allows you to connect to

    back-end distributed data and push data in real-time to

    Adobe Flex and Adobe AIR rich Internet applications (RIA).

    Previously it was a part of Adobe LCDS .After December 2007 it

    became Open source under LGPL.

    http://en.wikipedia.org/wiki/Java_%28programming_language%29http://en.wikipedia.org/wiki/Adobe_Flexhttp://en.wikipedia.org/wiki/Adobe_AIRhttp://en.wikipedia.org/wiki/RIAhttp://en.wikipedia.org/wiki/RIAhttp://en.wikipedia.org/wiki/Adobe_AIRhttp://en.wikipedia.org/wiki/Adobe_Flexhttp://en.wikipedia.org/wiki/Java_%28programming_language%29
  • 8/14/2019 Blaze-ds Presentation by Subrata

    3/25

    CONFIDENTIAL

    LCDS Feature:-

  • 8/14/2019 Blaze-ds Presentation by Subrata

    4/25

    CONFIDENTIAL

    Blaze-DS Feature in Red Box :-

  • 8/14/2019 Blaze-ds Presentation by Subrata

    5/25

    CONFIDENTIAL

    Blaze-DS is good because it uses AMF ?

    What is AMF ??

    It stands for Action Message Format.

    Fast(10x over XML) and small in size.

    Action Message Format (AMF) is a compact binary formatthat is used to serialize ActionScript object graphs. Once

    serialized an AMF encoded object graph may be used to

    persist and retrieve the public state of an application

    across sessions or allow two endpoints to communicate

    through the exchange of strongly typed data.

    AMF was introduced with Flash Player 6, and this version

    is referred to as AMF 0.(Now with AS3.0 AMF 3.0 is used)

  • 8/14/2019 Blaze-ds Presentation by Subrata

    6/25

    CONFIDENTIAL

    Blaze-DS is good because it uses AMF ?

    What is AMF ??

    It stands for Action Message Format.

    Fast(10x over XML) and small in size.

    Action Message Format (AMF) is a compact binary formatthat is used to serialize ActionScript object graphs. Once

    serialized an AMF encoded object graph may be used to

    persist and retrieve the public state of an application

    across sessions or allow two endpoints to communicate

    through the exchange of strongly typed data.

    AMF was introduced with Flash Player 6, and this version

    is referred to as AMF 0.(Now with AS3.0 AMF 3.0 is used)

  • 8/14/2019 Blaze-ds Presentation by Subrata

    7/25CONFIDENTIAL

    Services provided in Blaze-DS

    RPC services :---- Provides a call and response model for accessingexternal data.

    -- Make asynchronous requests to remote services thatprocess the requests, and then return data to your Flexapplication.

    Message Service :---- Provides messaging services for collaborative and real-time applications.

    -- Send messages to and receive messages from otherapplications, including Flex applications and JMS.

  • 8/14/2019 Blaze-ds Presentation by Subrata

    8/25CONFIDENTIAL

    Remote procedure call (RPC) component

    RPC component arebased on SOA.

    HTTP services .

    Web services .

    Java objects (remote object

    services) .

  • 8/14/2019 Blaze-ds Presentation by Subrata

    9/25CONFIDENTIAL

    Steps in Creating RPC Clients-

    Declaring an RPC component.

    Configuring a destination.

    Calling a service Parameter Binding, Explicit parameter

    passing).

    Calling services in AS (result,fault,name,concurrency).

    Handling service results.

    Validation.

    Handling asynchronous calls to services.

    Accessing Java objects in the source path (EJB).

    (Small App with Add, view, delete Operation in Flex

    With directory structure of various config files)

  • 8/14/2019 Blaze-ds Presentation by Subrata

    10/25CONFIDENTIAL

    Parameter binding Example

    {text1.text}

    {text2.text}

  • 8/14/2019 Blaze-ds Presentation by Subrata

    11/25CONFIDENTIAL

    Explicit parameter passing Example :-

  • 8/14/2019 Blaze-ds Presentation by Subrata

    12/25CONFIDENTIAL

    Configuring RPC Services:-

    Destination configuration .

    An RPC service destination is the object or service that

    you connect to using an ,

    , or tag or the

    corresponding ActionScript API.

    Configuring destination properties .

    To communicate with Remoting Service and ProxyService destinations, you configure specific types of

    destination properties in the properties section of a

    destination definition.

  • 8/14/2019 Blaze-ds Presentation by Subrata

    13/25CONFIDENTIAL

    Destination configuration Example:-

    samples.explorer.EmployeeManager

    application

  • 8/14/2019 Blaze-ds Presentation by Subrata

    14/25CONFIDENTIAL

    Configuring destination properties :-

    For Remote Object :--

    samples.explorer.EmployeeManager

    application (request , session)

    For Web Service Parameters used :- wsdl , soap .

    For HTTP Service Parameters used :- url , dynamic-url .

  • 8/14/2019 Blaze-ds Presentation by Subrata

    15/25CONFIDENTIAL

    Serializing Data (AS to Java) :-

    Array (dense) -> java.util.List

    Array (sparse) -> java.util.Map

    Boolean String of "true" or "false -> java.lang.Boolean

    flash.utils.ByteArray -> byte[ ]

    flash.utils.IExternalizable -> java.io.Externalizable

    Date -> java.util.Date

    int/uint -> java.lang.Integer

    Null -> null

    Number -> java.lang.Double

    Object (generic) -> java.util.Map

    String -> java.lang.String

    XMLDocument -> org.w3c.dom.Document

  • 8/14/2019 Blaze-ds Presentation by Subrata

    16/25CONFIDENTIAL

    Serializing Data ( Java to AS) :-

    enum (JDK 1.5) -> String

    java.lang.String -> String java.lang.Boolean, boolean -> Boolean

    java.lang.Integer, int -> int

    java.lang.Short, short -> int

    ava.lang.Byte, byte[] -> int

    java.lang.Byte[] -> flash.utils.ByteArray

    java.lang.Double, double -> Number

    java.lang.Character, char -> String

    java.util.Calendar -> Date

    java.util.Date -> Date

    java.util.Collection -> mx.collections.ArrayCollection

    java.util.Map -> Object

    org.w3c.dom.Document -> XML object

  • 8/14/2019 Blaze-ds Presentation by Subrata

    17/25CONFIDENTIAL

    Blaze-DS uses the standard Java class,java.beans.Introspector, to get property descriptors for a Javabean class. It also uses reflection to gather public fields on aclass.

    The Java and ActionScript property names should match. In the ActionScript class, you use the [RemoteClass(alias=" ")]

    metadata tag to create an ActionScript object that maps directlyto the Java object.

    Example:--

    package samples.contact {

    [Bindable]

    [RemoteClass(alias="samples.contact.Contact")]

    public class Contact {public var contactId:int;

    }

    }

  • 8/14/2019 Blaze-ds Presentation by Subrata

    18/25CONFIDENTIAL

    Configuring Blaze-DS :-

    Important Files :--

    services-config.xmlThe top-level Blaze-DS configuration file. This file usually containssecurity constraint definitions, channel definitions, and loggingsettings that each of the services can use. It can contain servicedefinitions inline or include them by reference. Generally, the servicesare defined in the remoting-config.xml, proxy-config.xml, and

    messaging-config.xml. remoting-config.xml

    The Remoting Service configuration file, which defines RemotingService destinations for working with remote objects.

    proxy-config.xml

    The Proxy Service configuration file, which defines Proxy Service

    destinations for working with web services and HTTP services (RESTservices).

    messaging-config.xml

    The Message Service configuration file, which defines Message Servicedestinations for performing publish subscribe messaging.

  • 8/14/2019 Blaze-ds Presentation by Subrata

    19/25CONFIDENTIAL

    Securing destinations(Custom) :-

    Custom

    Custom

    sampleuser r

    tomcatUser.xml should contain the following entry:--

  • 8/14/2019 Blaze-ds Presentation by Subrata

    20/25

    CONFIDENTIAL

    Passing credentials to a remote service:-

    var employeeHTTP:HTTPService = new HTTPService();

    employeeHTTP.destination = "secureJSP";employeeHTTP.setRemoteCredentials

    ("myRemoteUserName", "myRemotePassword");

    employeeHTTP.send({param1: 'foo'});

    Alternative way of doing the above is

    http://someserver/SecureService.jsp

    johndoeopensaysme

  • 8/14/2019 Blaze-ds Presentation by Subrata

    21/25

    CONFIDENTIAL

    Securing destinations(Basic) :-

    Basic Basic

    privilegedusers

    In Web.xml the following need to be set :-

    Protected Channel

    /messagebroker/amf

    GET

    POST

    sampleusers

    BASIC

    sampleusers

  • 8/14/2019 Blaze-ds Presentation by Subrata

    22/25

    CONFIDENTIAL

    Login adapters :-

    For both custom and basic authentication, Flex uses alogin adapter, known as a login command, to check auser's credentials and log a principal into the applicationserver. A login command must implement theflex.messaging.security.LoginCommand API.

    For basic authentication, an HTTP 401 error causes abrowser challenge .

    For custom authentication, the server sends a fault to theclient to indicate that authentication is required.

    (services-config.xml)

  • 8/14/2019 Blaze-ds Presentation by Subrata

    23/25

    CONFIDENTIAL

    Monitoring and managing services :-

    We can See all the MBean through the following :-

    http://server:port/ds-consoleData services class loading :--

    MessageBrokerServlet

    MessageBrokerServlet

    flex.messaging.MessageBrokerServlet

    services.configuration.file

    /WEB-INF/flex/services-config.xml

    1

    http://-/http://-/
  • 8/14/2019 Blaze-ds Presentation by Subrata

    24/25

    CONFIDENTIAL

    Server-side service logging:-

    We can set the logging level to one of the following available levels:

    all ,debug ,info ,warn ,error ,none .Example :-

    [Blaze-Ds-Test-By-Subrata]false

    false

    false

    false

    Endpoint

  • 8/14/2019 Blaze-ds Presentation by Subrata

    25/25

    CONFIDENTIAL

    The End

    PPT By- Subrata Saha