Parsley Introduction Kui Huang Oct. 13, 2009. Topics Background Dependency Injection Object Lifecycle Message Bus Sample FW Extensions.

Slides:



Advertisements
Similar presentations
Flex Component Life-cycle. What is it? Sequence of steps that occur when you create a component object from a component class. As part of this process,
Advertisements

Coding Basics - Deferred Binding. Deferred Binding is a feature of the GWT compiler works by generating many versions of code at compile time, only one.
Exceptions and Exception Handling Carl Alphonce CSE116 March 9, 2007.
The Web Warrior Guide to Web Design Technologies
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Inheritance and Polymorphism CS351 – Programming Paradigms.
Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.
Using Ant to build J2EE Applications Kumar
UNIT-V The MVC architecture and Struts Framework.
Technical Workshops | Esri International User Conference San Diego, California ArcGIS Viewer for Flex – Advanced Topics Lloyd Heberlie Björn Svensson July.
Programming Languages and Paradigms Object-Oriented Programming.
.NET Framework Introduction: Metadata
BEST PRACTICES - Java By Configuration Use global-forwards/results Helps to avoid duplicate jsp files and redundancy forward mapping.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
Introducing Axis2 Eran Chinthaka. Agenda  Introduction and Motivation  The “big picture”  Key Features of Axis2 High Performance XML Processing Model.
Pattern Oriented Software Architecture for Networked Objects Based on the book By Douglas Schmidt Michael Stal Hans Roehnert Frank Buschmann.
ITCS 6010 SALT. Speech Application Language Tags (SALT) Speech interface markup language Extension of HTML and other markup languages Adds speech and.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
What is MOF? The Meta Object Facility (MOF) specification provides a set of CORBA interfaces that can be used to define and manipulate a set of interoperable.
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
(Business) Process Centric Exchanges
Component frameworks Roy Kensmil. Historical trens in software development. ABSTRACT INTERACTIONS COMPONENT BUS COMPONENT GLUE THIRD-PARTY BINDING.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Flex 2 We’re Not in Kansas Anymore! or Welcome to Flex Theo Rushin Jr TeraTech, Inc.
System.Security.Policy namespace Chinmay Lokesh.NET Security CS 795 Summer 2010.
Collaborate Lesson 4C / Slide 1 of 22 Collaborate Knowledge Byte In this section, you will learn about: The EJB timer service Message linking in EJB 2.1.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
Object Oriented Software Development
ActionScript 3 Extensible Markup Language (XML) by Martin Stanhope The University of Bolton.
Introduction to Java Beans CIS 421 Web-based Java Programming.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
JavaScript, Fourth Edition
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
Axis2 - Overview. Agenda  What is already there Overall Architecture Core AXIOM WSDL Deployment Client API  What is yet to come Encoding – Pluggable.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
CS212: Object Oriented Analysis and Design Lecture 19: Exception Handling.
Spring RabbitMQ Martin Toshev.
Unit-IV - Flash Player - Flex framework - MXML introduction - Action script introduction - Working with Action script - Flex data binding - Common UI components.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
2006/2007 Licence Apache 2.0 Castle.Igloo. Castle Igloo Basics Pre-require Concept Scopes PageFlow Configuration Controller View Exemple Castle.Igloo.
红杉树(中国)信息技术有限公司公司 地址:杭州市天目山路 176 号西湖数源软件园 11 号楼 3 层 电话: (86) Transaction & JAVA Fondy Wang 12/7/07.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
95-843: Service Oriented Architecture 1 Master of Information System Management Service Oriented Architecture Lecture 8: More BPEL Notes selected from.
The Chain of Responsibility Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
1 Entity Callbacks and Listeners When you execute EntityManager methods like persist( ), merge( ), remove( ), and find( ), or when you execute EJB QL queries,
Flux & React Web Application Development Mark Repka, Rich McNeary, Steve Mueller.
Introduction to Inversion Of Control (IOC). IOC Definition (based on Wikipedia)  Consider the way in which an object obtains references to its dependencies.
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
Modularization of Geant4 Dynamic loading of modules Configurable build using CMake Pere Mato Witek Pokorski
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
Java FX: Scene Builder.
Chapter 7: Modifiability
Self Healing and Dynamic Construction Framework:
OpenStorage API part II
Presentation transcript:

Parsley Introduction Kui Huang Oct. 13, 2009

Topics Background Dependency Injection Object Lifecycle Message Bus Sample FW Extensions

Background Introduce Injection (IOC) to ActionScript world  Louse couple of the dependencies between interface and implementation Define some variables will be injected with instances at runtime dynamically; (Using declaration annotation/tag directly in codes) Define object pool in configuration files. Design a powerful event-driven framework Louse couple of event dispatcher and listener

Configuration and Initialization Configuring and initializing the Parsley Framework usually consists of the following steps:  Step 1: Telling the IOC Container which classes it should manage. This can be done with MXML, XML files or in ActionScript. All three mechanisms will be described in the following sections.  Step 2: Configure the container services like Dependency Injection or Messaging for each individual class. This can be done with the mechanism you had chosen for step 1 (e.g. with MXML or XML configuration tags) or - in most cases - conveniently with AS3 Metadata Tags right within the classes themselves.  Step 3: Initialize the IOC Container (usually on application startup). In Parsley 2 this is a one-liner in most cases. See the sections below for examples.

Dependency Injection

Using Factories

Object Lifecycle If you want the Parsley Container to invoke methods on your object when it is created or when it is destroyed, you can add the [PostConstruct] or [PreDestroy] metadata tags to the corresponding methods:

Asynchronous Object Initialization

Event.COMPLETE and ErrorEvent.ERROR are the default event types to signal whether initialization has completed or failed. They can be switched with attributes of the [AsyncInit] tag:  [AsyncInit(completeEvent="myCustomCompleteEvent",errorEvent="myC ustomErrorEvent")] Initialization order. If you use more than one asynchronously initializing object and one depends on the other you may want to explicitly specify the initialization order. You can do that with the order attribute:  [AsyncInit(order="1")]

Modular Contexts and Lifecycle In larger applications you may want to split your application into modules which are loaded on demand. In this case it would be unfortunate to have a monolithic Context that is fully loaded and initialized at application startup. This is where another feature of Parsley comes in handy: when creating a Context you can define an existing context as its parent with optional parameters of all the various context builder methods  var parent:Context =...; FlexContextBuilder.build(BookStoreConfig, parent); If you load multiple Context instances as modules like described in the previous section, you may want to get rid of them when you unload a module.  context.destroy();

When a Context gets destroyed the following actions occur:  All objects configured in the destroyed Context stop receiving messages dispatched by Parsleys central MessageRouter. This affects all elements annotated with MessageHandler, MessageBinding or MessageInterceptor.  If any objects declared in the destroyed Context declared ManagedEvents they will be ignored from now on and no longer dispatched trough Parsleys MessageRouter.  All methods annotated with [PreDestroy] (or the corresponding MXML or XML tags) on any object of the destroyed Context get invoked.  The destroyed Context will remove all internal references to the configured objects so they are eligible for garbage collection. (Of course you have to make sure that your application does not retain any references to those objects).  The Context may no longer be used after invoking destroy. Any subsequent method invocations on that Context throw Errors. The parent of the destroyed Context (if any) is not affected and may continue to operate normally.

Message Bus Louse couple of event dispatcher and listener  not only means that the sender and the receiver do not have to know each other.  sending and receiving objects are also fully decoupled from the framework itself. Versus:  Flash Event  Cairngorm  PureMVC  Swiz

Message Bus Dispatching Messages Managed Events if the dispatching object is a regular EventDispatcher. Managed Events Injected MessageDispatchers if your messages are not subclasses of Event Injected MessageDispatchers Using the MessageRouter programmatically in rare cases where you need to use the Framework API directly Using the MessageRouter programmatically

ManagedEvents

Injected MessageDispatchers

Message Bus Receiving Messages MessageHandlers for methods that should be invoked when a particular message is dispatched. MessageHandlers MessageBindings for properties that should be set when a particular message is dispatched. MessageBindings MessageInterceptors for intercepting, and optionally cancelling or deferring then redispatching a message before it is processed by handlers or bindings. MessageInterceptors Using the MessageRouter programmatically in rare cases where you need to use the Framework API to register any of the features listed above. Using the MessageRouter programmatically

Message Handlers

Message Bindings In the following example the user property of the example will be set to the value of the user property of the LoginMessage instance whenever such a message is dispatched.

Message Interceptors An example would be to show a simple warning before any delete operation is actually performed like in the following example. When the user hits cancel, the MessageProcessor never resumes and no subsequent handler or bindings will be executed.

Using Selectors In the examples for the sections about MessageHandlers, MessageBindings and MessageInterceptors the matching methods or properties were always determined solely by the type (class) of the message. Sometimes that may not be sufficient if you dispatch the same message type in different scenarios or application states. In such a case you can refine the selection process with custom selectors.

Others Localization Logging Remoting  Flex Remoting  Pimento Data Services  Cinnamon Remoting

Sample

Extension of framework Available Extension Points  Factories/ObjectDefinitionDecorator  Context/ObjectDefinition  …… Creating Custom Configuration Tags Creating Tags that produce Objects Custom Configuration Processors

Q&A