Online / In-Person Meeting Monday :: Marc Hughes :: Creating a Simple Diagram Application Using Degrafa and ObjectHandles
July 4th, 2008
What:
- Marc Hughes will show us how to build a basic diagramming application using Degrafa and ObjectHandles. You can see the application in action at here, play with it, and view its source, or download a zipped source code file here. Marc is the Manager of Software Engineering at Tom Snyder Productions, is the creator of the Adobe AIR Derby winning Agile Agenda project planning application, is the creator of the ObjectHandles and Pulse Particles libraries, and writes interesting stuff at his Marc’s Musings blog. This should be a great presentation.
- ObjectHandles allows you to add resize handles to your graphic objects, as seen in the image above.
- Degrafa is a declarative graphics framework for Flex. It allows you to use MXML to declaratively specify graphics. Here’s one example:
Where:
- Online, at http://adobechats.adobe.acrobat.com/bfaig20080707/
- See our Attending BFAIG page for details on attending online.
- In person, at Douglas McCarroll’s home at 26 Hamlet Street, Somerville (map)
- Marc will be presenting remotely, so he won’t be here in person.
- Please RSVP via our contact form if you’ll be attending in person.
- Parking: Douglas has a fair amount of off-street parking in his yard. If you RSVP Douglas will contact you with details.
When:
- Monday, July 7, 2008, 7:00-9:00 PM EDT
Software Raffle:
Twice a year our parent group - the Adobe Boston User Group - raffles off an Adobe software package of your choice up to a value of $2100. If you attend this meeting your name will be added to the list of possible winners. For full details, see the ABUG software raffle page.
Getting Started with BlazeDS, Spring, and Spring JDBC
May 6th, 2008
Some time ago in one of the BFAIG meetings we discussed exploring different server side technologies and I offered to do a demo using BlazeDS. Seeing others new to Java using JDBC (Java DataBase Connectivity) directly, I also suggested taking a look at Spring JDBC as well as a persistence technology. Spring JDBC offers support classes for using JDBC which remove a lot of the dirty work allowing you to focus only on your SQL. Spring JDBC also ensures that your code will be handling connections correctly. If you are using or want to use JDBC for your persistence, I recommend it.
Other Java persistence options, that I might explore in continuing this example, but are not included in this post are Hibernate, IBATIS SQL maps, and JPA.
To get started with this example, I am using Douglas McCarrolls's schema provided in his Comparing different approaches to server-side database access post.
Rather than complete Douglas's specified task, I selected a simple table, CATEGORY, to use for this example.
For clarity, I separated this example into 3 steps:
- Getting started with BlazeDS
- Adding Spring
- Using Spring JDBC
For this example, I am using Tomcat, Eclipse Europa with the Flex Builder 3 Plugin, BlazeDS, MySQL, and Spring
I am not going to go over where to get everything and how to install everything, but if you have questions, I'll be happy to point you in the right direction.
You can download the source here:
Client
Step 1
Step 2
Step 3
These are eclipse compressed archive files. you can import them using the "Existing projects into workspace" option.
For Step 2 and 3 I had to remove the jars in lib, so you will have to copy them from Step 1. Sorry, but there was a limit on file size.
So, let's get started.
Step 1 - Getting started with BlazeDS
- On the server side, we have to create a webapp with our Java code
- I created a Java Project, BlazeDS_Step1, containing the following directories:
- src
- WebContent/WEB-INF/classes
- WebContent/WEB-INF/lib
- WebContent/WEB-INF/flex
- Since we are working with the CATEGORY table, lets create (in src) a Domain object (POJO, Value object, or whatever else you wish to call it) for this, com.brightworks.langcollab.domain.Category.
CODE:package com.brightworks.langcollab.domain;
public class Category {
private long id;
private String name;
public Category() {
super();
}
public Category(long id, String name) {
super();
this.id = id;
this.name = name;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} - Now we define our DAO (Data Access Object) interface. DAO is a design pattern to create a logical layer between business logic and your persistence implementation. Here, it is useful because I want to create several implementations of persistence (Mock, Spring JDBC, Hibernate, IBATIS, etc.) which do the same thing. Defining an interface will help us keep these implementations consistent.
CODE:package com.brightworks.langcollab.dao;
import java.util.List;
import com.brightworks.langcollab.domain.Category;
public interface CategoryDAO {
List<Category> getCategories();
} - And to just get BlazeDS working without adding the complexity of working with a Database, let's create a mock implementation of CategoryDAO, com.brightworks.langcollab.dao.mock.MockCategoryDAO.
CODE:package com.brightworks.langcollab.dao.mock;
import java.util.ArrayList;
import java.util.List;import com.brightworks.langcollab.dao.CategoryDAO;
import com.brightworks.langcollab.domain.Category;public class MockCategoryDAO implements CategoryDAO {
public List<Category> getCategories() {
List<Category> categories = new ArrayList<Category>();
categories.add( new Category(1,"Test A") );
categories.add( new Category(2,"Test B") );
categories.add( new Category(3,"Test C") );
categories.add( new Category(4,"Test D") );
categories.add( new Category(5,"Test E") );
categories.add( new Category(6,"Test F") );
categories.add( new Category(7,"Test G") );
return categories;
}}
This is just creating a new list and adding a bunch of category objects to the list.
This is it for the Java code. Pretty simple.
- To use BlazeDS, we have to add the jars provided by Adobe to WEB-INF/lib
- backport-util-concurrent.jar
- cfgatewayadapter.jar
- commons-codec-1.3.jar
- commons-httpclient-3.0.1.jar
- commons-logging.jar
- concurrent.jar
- flex-messaging-common.jar
- flex-messaging-core.jar
- flex-messaging-opt.jar
- flex-messaging-proxy.jar
- flex-messaging-remoting.jar
- xalan.jar
- Create web.xml in WEB-INF and configure a context-param, a servlet, and a listener for BlazeDS.
CODE:<context-param>
<param-name>flex.class.path</param-name>
<param-value>/WEB-INF/flex/hotfixes</param-value>
</context-param>
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener><servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>Don't worry about this too much as this is just configuration to get BlazeDS working, but note the servlet-mapping, which is mapping urls beginning with messagebroker to the MessageBrokerServlet. This is a class included in one of the BlazeDS jars we added to lib and is what is doing the work for us. Also, note the init param named services.configuration.file for this servlet with a value of /WEB-INF/flex/services-config.xml. We have to configure this next.
- Create WEB-INF/flex/service-config.xml
CODE:<?xml version="1.0" encoding="UTF-8"?>
<services-config><services>
<service-include file-path="remoting-config.xml" /><default-channels>
<channel ref="my-amf"/>
</default-channels>
</services><channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
</channels>
</services-config>For this example, we really only need a single channel for communication. Were we using the messaging features of BlazeDS, we would likely add others. Check out the BlazeDS docs for info on other channels and messaging capabilities.
I also recommend checking out the BlazeDS turnkey installation with sample apps. What you can do with the messaging technologies with BlazeDS is VERY impressive.
Since convention is to keep your remoting configuration separately, service-config.xml imports remoting-config.xml. So we have to create this in WEB-INF/flex too:
CODE:<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
class="flex.messaging.services.RemotingService"><adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels><destination id="categoryService">
<properties>
<source>com.brightworks.langcollab.dao.mock.MockCategoryDAO</source>
</properties>
</destination></service>
Note the destination categoryService, which defines the com.brightworks.langcollab.dao.mock.MockCategoryDAO class as it's source. We will use this destination by name in the client and BlazeDS will create a new instance of MockCategoryDAO presumably using the JavaAdapter for requests to this destination.
- There are a lot of different ways to get this webapp to run in Tomcat. We could create a war, create an unpacked webapp, but for simplicity I am pointing tomcat to our source directory. To do this, I add BlazeDS_Step1.xml to %CATALINA_HOME%\conf\Catalina\localhost (CATALINA_HOME is your tomcat installation directory)
CODE:<Context path="BlazeDS_Step1" docBase="C:\flex\workspace_example\BlazeDS_Step1\WebContent" reloadable="true">
</Context>You will of course have to modify this for the path to your project.
- To get the project classes to be added to the classpath of our webapp, I changed the source output folder to BlazeDS_Step1/WebContent/WEB-INF/classes in BlazeDS_Step1 project properties - Java Build Path.
- Now we have to create the client.
- Create an ActionScript class, Category
CODE:package com.brightworks.langcollab.service
{
[Bindable]
[RemoteClass(alias="com.brightworks.langcollab.domain.Category")]
public class Category
{
public var id:Number;
public var name:String;
public function Category() {}}
}The important pieces here are adding the RemoteObject attribute, setting the alias to our server side Java class and adding properties equivalent to our Category Java class.
- In our client code, use mx:RemoteObject
CODE:<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"><mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
public var categories:ArrayCollection;
private function load():void {
categoryService.getCategories();
}
private function handleResult(e:ResultEvent):void {
categories = e.result as ArrayCollection;
}
]]>
</mx:Script>
<mx:RemoteObject id="categoryService" destination="categoryService">
<mx:method name="getCategories" result="handleResult(event)"/>
</mx:RemoteObject>
<mx:Button label="load" click="load()" />
<mx:DataGrid id="dg" dataProvider="{categories}">
<mx:columns>
<mx:DataGridColumn dataField="id" />
<mx:DataGridColumn dataField="name" />
</mx:columns>
</mx:DataGrid>
</mx:Application>Note that in our client code we specify only the name of the destination that we configured on the server. We will have to set a few options when compiling to ensure that the resulting swf will connect to our server correctly.
First, compile using: -services "...\BlazeDS_Step1\WebContent\WEB-INF\flex\services-config.xml". The ... will be specific to your environment, but this is specifying where the compiler can find our service configuration for it to include in the compiled application.
Second, be sure to configure Flex Services in your project properties. Specifically the context root will be required.
- Finally, I have configured Flex Build path to output the client code to ${DOCUMENTS}\BlazeDS_Step1\WebContent\bfaig. This will place the compiled client in the directory to which we have pointed Tomcat.
- Add spring factory code. This is taken directly from the BlazeDS documentation. see flex.samples.factories.SpringFactory in BlazeDS_Step2.
- Configure the spring factory in services-config.xml
CODE:<factories>
<factory id="spring" class="flex.samples.factories.SpringFactory"/>
</factories> - Create a Spring config file, applicationContext.xml, and define our spring bean which we will name categoryDAO and will specify our MockCategoryDAO class for now.
CODE:<bean id="categoryDAO" class="com.brightworks.langcollab.dao.mock.MockCategoryDAO" />
- Add a listener and context param for Spring to web.xml
CODE:<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>Note that the context-param contextConfigLocation defines where Spring should look to load Spring bean configs. In this case, we just have applicationContext.xml, but you may add additional Spring configs too.
- Add spring.jar (spring-framework-2.0.7) to lib
- On your own, you would have to add all jars in lib, plus servlet-api.jar to the BlazeDS_Step2 project path for the SpringFactory to compile correctly, but the projects provided should have this configured for you already.
- reconfigure the categoryService destination in remoting-config.xml
CODE:<destination id="categoryService">
<properties>
<factory>spring</factory>
<source>categoryDAO</source>
</properties>
</destination>Note that we no longer specify the class to use for BlazeDS. Instead, we tell BlazeDS to use the spring factory we configured in services-config.xml and to use the Spring bean named categoryDAO that we configured in applicationContext.xml
- Create Spring JDBC implementation, com.brightworks.langcollab.dao.jdbc.spring.SJDBCCategoryDAO
CODE:package com.brightworks.langcollab.dao.jdbc.spring;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;import com.brightworks.langcollab.dao.CategoryDAO;
import com.brightworks.langcollab.domain.Category;public class SJDBCCategoryDAO extends SimpleJdbcDaoSupport implements CategoryDAO {
public List<Category> getCategories() {
final String sql = "SELECT CATEGORY_ID,EN_US_NAME FROM CATEGORY";
return getSimpleJdbcTemplate().query(sql, new CategoryMapper());
}private final static class CategoryMapper implements ParameterizedRowMapper<Category> {
public Category mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
Category account = new Category();
account.setId( rs.getLong(1) );
account.setName( rs.getString(2) );
return account;
}
}}
You can compare this with Douglas's original code that I included in the com.brightworks.langcollab.dao.jdbc package. I think it is apparent that Spring greatly simplifies the code you have to write. You just provide the sql and a means to map the result to an object (in ParameterizedRowMapper).
One thing worth noting, by extending SimpleJdbcDaoSupport you are gaining a dataSource property. Any Spring JDBC class you create in this manner will have a dependency on a DataSource, but this is ok, since at its core, Spring is a Dependency Injection Framework.
Spring is fairly well documented online. To find out more, a good start is the Spring reference documentation.
- We want to define a datasource which will be pooled and managed by the container, in this case Tomcat. To do this, we add a resource to BlazeDS_Step3.xml in %CATALINA_HOME%\conf\Catalina\localhost.
CODE:<Context path="BlazeDS_Step3" docBase="C:\flex\workspace_example\BlazeDS_Step3\WebContent" reloadable="true">
<Resource
auth="Container"
driverClassName="com.mysql.jdbc.Driver"
name="jdbc/LangCollabDataSource"
username="root"
password="mysql"
type="javax.sql.DataSource"
url="jdbc:mysql://localhost:3306/langcollab"/>
</Context>Obviously your password will be different and we should not be using root, but locally this is fine. There are other parameters which can be configured here, but this is just enough to get us up and running. Also, if you are not using MySQL, this configuration could be slightly different.
Now, we have to add one more configuration in web.xml to complete defining the datasource.
CODE:<resource-ref>
<res-ref-name>jdbc/LangCollabDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>Note the resource name, jdbc/LangCollabDataSource, in both of these configurations. You may name this anything you like, but we need to provide this information for our CategoryDAO.
- Now we have to configure our Spring JDBC bean. Modify applicationContext.xml to contain the following.
CODE:<bean id="categoryDAO" class="com.brightworks.langcollab.dao.jdbc.spring.SJDBCCategoryDAO" p:dataSource-ref="langCollabDataSource"/>
<bean id="langCollabDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>java:comp/env/jdbc/LangCollabDataSource</value></property>
</bean>We have added a new Spring bean, langCollabDataSource. It's class is provided by Spring, which will lookup JNDI resources (which is what our database resource is) and expose them in bean references.
For categoryDAO, we are changing the class property to use our new Spring JDBC implementation, SJDBCCategoryDAO. Then we are setting it's dataSource property (p:dataSource-ref=) to the langCollabDataSource bean.
In doing this, we are injecting the dependency on a DataSource for categoryDAO.
- One last thing. We have to add the database driver for MySQL to the %CATALINA_HOME%/lib. Otherwise, Tomcat will not be able to create the database resource when the application starts. You should be able to download it here
That's it. Now we should be able to access our application at http://localhost:8080/BlazeDS_Step1/bfaig/main.html
Step 2 - Adding Spring
For step 2, we are going to integrate Spring with BlazeDS. I have copied the original project and created a new project, BlazeDS_Step2 for this step. Anything referencing BlazeDS_Step1 in step one should be modified to reference BlazeDS_Step2, except for the tomcat config where you might want to create BlazeDS_Step2.xml
That's it! If you change the client configs to reflect BlazeDS_Step2 you should be able to access http://localhost:8080/BlazeDS_Step2/bfaig/main.html. Of course, we are using the same implementation from Step1, so the result will be the same, but now we are using Spring with BlazeDS.
Step 3 - Using Spring JDBC
For step 3, we are going to create a Spring JDBC implementation of our CategoryDAO. I have copied the BlazeDS_Step2 project and created a new project, BlazeDS_Step3 for this step. Anything referencing BlazeDS_Step1 in step 1 should be modified to reference BlazeDS_Step3, except for the tomcat config where you should create BlazeDS_Step3.xml
OK, that was a really long post. I probably should have divided it up a bit.
Hopefully this is helpul and I have not made too many mistakes.
Hi All,
Once again this month there are multiple reasons why you might want to join us for our main monthly meeting:
Reason #1: This month we're looking forward to being joined in person by Michael Labriolla. Michael has joined us a couple of times online but this month he's actually flying in from Chicago to join us at MassArt. Michael is one of the authors of Adobe Flex 2: Training From The Source, Adobe Flex 3: Training From The Source, and the upcoming Breaking Out Of The Web Browser With Adobe AIR. He's also an Adobe Certified Instructor, Community Expert, and Flex Community Champion.
Reason #2: We'll be raffling off an Adobe Software package of your choice, worth up to $2100. At some random point during the meeting we'll add the names of attendees (in-person and online) to the list of potential winners that we started at last month's meeting, then pull one out of a hat. Details on our biannual raffle can be found here.
Reason #3: O'Reilly has generously donated seven books for us to raffle off. We'll do this at the end of the meeting. The books are:
- ActionScript 3.0 Cookbook by Lott, Schall & Peters
- Essential ActionsScript 3.0 by Moock
- Head First Design Patterns by Freeman & Freeman - 2 copies
- Head First Object-Oriented Analysis & Design by McLaughlin, Pollice & West
- Learning ActionScript 3.0 by Shupe & Rosser
- Programming Flex 2 by Kazoun & Lott
Thank you O'Reilly!
Where:
- Massachusetts College Of Art And Design, 621 Huntington Avenue, Boston (map)
- Tower Building, Room T-713
- Also, you can attend online.
- Log in at http://adobechats.adobe.acrobat.com/bfaig20080505/
- You'll find instructions for attending online at http://www.bfaig.org/attending_bfaig.html#how_to_attend_online.
When:
- Monday, May 5, 2008, 7:00-9:00 PM EDT
Parking:
- We have permission to park in MassArt's lot on Ward Street. Simply tell the attendant that you are "here for the Adobe Flex Users Group meeting". No, don't tell them "Boston Flex Application Incubator Group". While this would be more accurate, it will only confuse matters.
Agenda:
- Andy Buttaro will present a demonstration of using BlazeDS in conjunction with the Java Spring framework to access a server-side database.
- Douglas McCarroll will present on his Language Collaborative project. He hasn't decided yet which aspect of his project he'll present, but is inclining towards a review of some custom ActionScript components that he's created.
- We still have time available for other presenters. If you're interested, or would just like to explore presenting in the future, please contact us.
Jamie Ciocco wins logo contest
April 27th, 2008
We're happy to announce that as per a vote taken at our most recent monthly meeting, we've selected Jamie Ciocco's egg as our new logo.
We'd like to say a big thank you to Jamie and to the other four people who submitted logos. Here they are:
Meeting Tomorrow :: MassArt & Online :: 7:00 PM EDT :: Three Extra Reasons to Attend
April 6th, 2008
Hi All,
This month, in addition to the usual excitement that we always feel about sharing knowledge and perspectives on Flex programming, I offer three additional reasons why you might like to attend this week's meeting.
Reason #1: We'll be voting on our group's logo. We are fortunate to have had five fine submissions to our logo contest. If you haven't seen them check them out at our website: http://www.bfaig.org. We'll be selecting one through an open vote shortly after the meeting begins.
Reason #2: You will be added to our list of eligible winners for an Adobe Software package of your choice, worth up to $2100. We'll be raffling this package off within the next couple of months at an ABUG or BFAIG meeting. Names will be collected for addition to the list at some random point partway through the meeting. When this name collection process is announced, make sure that I've got your name! Details on our biannual raffle can be found here.
Reason #3: O'Reilly has once again generously donated six books for us to raffle off. We'll do this at the end of the meeting. The books are:
- ActionScript 3.0 Cookbook by Lott, Schall & Peters - 2 copies
- ActionScript 3.0 Design Patterns by Sanders & Cumaranatunge
- Essential ActionsScript 3.0 by Moock
- Head First Design Patterns by Freeman & Freeman
- Head First Object-Oriented Analysis & Design by McLaughlin, Pollice & West
Thank you O'Reilly!
Where:
- Massachusetts College Of Art And Design, 621 Huntington Avenue, Boston (map)
- Tower Building, Room T-713
- Also, you can attend online.
- Log in at http://adobechats.adobe.acrobat.com/bfaig20080407/
- You'll find instructions for attending online at http://www.bfaig.org/attending_bfaig.html#how_to_attend_online.
When:
- Monday, April 7, 2008, 7:00-9:00 PM EDT
Parking:
- We have permission to park in MassArt's lot on Ward Street. Simply tell the attendant that you are "here for the Adobe Flex Users Group meeting". No, don't tell them "Boston Flex Application Incubator Group". While this would be more accurate, it's not what they've been told to expect and will only confuse matters.
Agenda:
- Max Antinori will present on setting up Modest Maps in a Flex application, and will demonstrate how to use "tiles" from several different providers (e.g. Google & Microsoft) and how to allow the user to toggle between them.
- Douglas McCarroll will present on his Language Collaborative project. He'll talk about how he's setting up his project so that it uses automated processes to create a MySQL server-side database and a SQLite client-side database, why it's useful to automate this process and, if time permits, may delve into some of the issues involved in synchronizing the two databases. He invites Flex community database experts to join in the discussion and advise him.
- We still have time available for other presenters. If you're interested, or would just like to explore presenting in the future, please contact us.
Online Meeting Tomorrow :: 7:00 PM EDT
March 30th, 2008
Note! This week Giorgio Natili will be presenting on his Intelligere SCS application. Intelligere duplicates much of Acrobat Connect's functionality, and we'll be using Intelligere instead of Connect for this meeting. Details below!
Meeting:
- Date: Monday, March 31, 2008
- Time: 7:00 PM EDT
- Where:
- Log into Intelligere at http://www.intelligere.info/intelligereBeta3.0/intelligere.php?id=654 as a guest.
- If we encounter problems using Intelligere for our meeting we'll switch over to Connect at http://adobechats.adobe.acrobat.com/bfaig20080331/
- In either case we'll use our free teleconferencing service for audio - you can find details at the URL below.
- Instructions For Attending: http://www.bfaig.org/attending_bfaig.html#how_to_attend_online
- Agenda:
- Announcements & opening discussion
- Giorgio Natili will present on Intelligere SCS. Giorgio and Matteo Lanzi developed Intelligere in a mere two months. Given the fact that Intelligere duplicates much of Acrobat Connect's funtionality, then adds a bit more, this is a fairly impressive demonstration of a) their programming abilities, and b) the Flex framework's productivity. Giorgio will give a tour of the application, then give an overview of how he and Matteo integrated Flex, XML, Red5 and .NET to create Intelligere. Giorgio has indicated a willingness to offer future presentations that go into more detail on specific aspects of this application so we suggest that you take a look at its source code, attend the presentation, and let us know what aspects of the application you'd like to learn more about.
- We'll discuss our new initiative to create a set of example applications that demonstrate different approaches to retrieving server-side date.
- We still have slots available for other presenters. If you'd like to present you can contact us via our contact form, or just show up with your thoughts and questions.
- If there's time, Douglas McCarroll will show the code he's developing that allows his Language Collaborative player to connect to a MySQL database via BlazeDS.
See you there!
Comparing different approaches to server-side database access
March 30th, 2008
At our meeting last Monday we discussed a few different server-side approaches to making database data available to a Flex client. We decided to implement a couple of different solutions using an identical query to my langcollab MySQL database. This will allow us to compare and contrast the code required for each approach.
- John Luke Mills will implement a ColdFusion solution.
- Andy Buttaro will use Java & Spring.
- Also, I've decided that I'll implement a solution using standard Java data access objects (DAOs) with straight JDBC queries.
I'm hoping that we can create three examples that will be a simple as possible, and as similar as possible, with only the code that really needs to vary varying from project to project.
I'm also imagining other people creating examples that use other approaches in the future. For example, our current 3 examples will all use BlazeDS and transfer the data from server to client using a RemoteObject and the AMF protocol, but it might be neat to have examples that use web services, PHP, Ruby, .NET etc. (Would you like to volunteer?)
With this goal in mind I've created a zip file (download it here) that contains two simple projects - client and server - that implement an extremely simple query using my "simple JDBC/DAO" approach. Andy, John Luke, and others will hopefully be able to install and run these "out of the box", then create copies and modify them. It also contains the SQL script file for creating the langcollab MySQL database that we'll be using for these examples.
Here's a simplified schema diagram of the langcollab database (the query we'll implement, defined below, will only use four of these tables):
Here are some notes on all this:
- I've tried to strip out as much Language Collaborative specific code from the examples as practical but, obviously, given the fact that we'll be using the langcollab DB, significant traces remain.
- Here's a natural language definition of the query that I'm proposing that we implement (let me know if this doesn't seem like a good example for some reason):
- For a given user (user_id = 1) retrieve an ArrayCollection of ModuleVersionVO instances, with each instance representing one of all module_versions that the user is linked to.
- The ModuleVersionVO classes (AS & Java) should have the following properties which should hold information from the module_version and uber_module tables:
- From module_version:
- module_version_id
- uber_module_id
- category_id
- level_id
- native_language_name
- From uber_module:
- native_language_id
- target_language_id
- Note the naming conventions that I'm using for folders and projects:
- Main folder: bfaig_data_access_examples_amf_simpledao
- Client project: bfaig_data_access_examples_amf_simpledao_client
- Server project: bfaig_data_access_examples_amf_simpledao_server
- I suggest that you use similar names, but replace "amf_simpledao" with descriptors that are appropriate for your approach.
- I'm assuming that you have MySQL installed, and are using Tomcat. If you're using a different J2EE server some of the configuration settings in bfaig_data_access_examples_amf_simpledao_server will need to be changed.
- Also note that the client is an AIR app, and that there's some AIR-specific code you'll need to be aware of in main.mxml.
Online Meeting Tomorrow :: 7:00 PM EST
March 23rd, 2008
Meeting:
- Date: Monday, March 24, 2008
- Time: 7:00 PM EST
- Where: http://adobechats.adobe.acrobat.com/bfaig20080324/
- Instructions For Attending: http://www.bfaig.org/attending_bfaig.html#how_to_attend_online
- Agenda:
- Announcements & opening discussion
- Douglas McCarroll will talk about developing the server-side (MySQL) database for his Language Collaborative project. Topics covered will include creating an automated build script for a database, using the MySQL Workbench to create schema diagrams, principles of relational database design and, of course, how he's applying all of this to his project.
- We still have slots available for other presenters. If you'd like to present you can contact us via our contact form, or just show up with your thoughts and questions.
See you there!
Douglas
Online Meeting Tomorrow :: 7:00 PM EST :: Max Antinori’s Species Explorer application + more. :)
March 16th, 2008
Meeting:
- Date: Monday, March 17, 2008
- Time: 7:00 PM EST
- Where: http://adobechats.adobe.acrobat.com/bfaig20080317/
- Instructions For Attending: http://www.bfaig.org/attending_bfaig.html#how_to_attend_online
- Agenda:
- Announcements & opening discussion
- Max Antinori will present his Species Explorer project, "a combination of web-based and mobile tools for recording and sharing nature observations". He's blogged about his presentation at http://www.bfaig.org/blog/?p=55. You'll gain the most from this presentation if you download his code and look into it before the meeting.
- Douglas McCarroll will show the current state of a custom AS component that he's creating for his Language Collaborative project. You can find a prototype, with source code, here.
- If there's time, an open forum - problem solving, tip sharing, discussion of how the group will work, etc.
See you there!
Douglas
Species Explorer presentation for March 17
March 12th, 2008
Max Antinori will be presenting on his independent project, Species Explorer, a combination of web-based and mobile tools for recording and sharing nature observations.
The focus will be on the demo of the web-based component which has been built in Flex 3, and uses various technologies, including:
- Modest Maps
- Flickr API
- PHP on backend
- mySQL for species and observation data
The structure of the application was built based on demos by Alistair Rutherford (for Modest Maps) and Joe Berkovitz (for MVCS). The MVCS structuring of the project is very much a work in progress started over the last couple weeks and so would be nice candidate for input from the group!
If you'd like to peek at the source, click here.
Or, if you'd like to roll up your sleeves a bit more, download the entire project folder here, and import it into Flex Builder. Reader exercise: try changing the map provider to OpenStreetMap or Google (api key required).
I plan to spend about 10 minutes giving a demo of the current application, then 20 minutes or so going over some of the technical issues, and inviting feedback from the group. Some ideas:
- improvement of code to take advantage of MVCS
- shift to use event bubbling instead of controller instance technique?
- ability to upload images from user pc to go with observation data
- ability to export to Google Earth kml format
Hopefully folks will enjoy it. Please reply to this post with any questions/comments before the meeting. Thanks!
-- Max






