BFAIG Meeting this Tuesday 2010/01/19
January 17th, 2010
Meeting:
- Date: Tuesday, January 19, 2010
- Time: 6:15 PM EDT
- Where:
- Online Only this month!: At http://adobechats.adobe.acrobat.com/bfaig20100119/
- See our Attending BFAIG page for details on attending online.
- Online Only this month!: At http://adobechats.adobe.acrobat.com/bfaig20100119/
- Agenda:
- Our agenda is currently open. Bring your questions, problems and subjects for discussion.
- Attendees will be eligible for our bi-annual software raffle:
- Twice a year Adobe allows us to raffle off a software package – of the winner’s choice – worth up to $2100. Details at http://www.bfaig.org/blog/?p=144!
See you there!
About BFAIG:
BFAIG’s focus is on helping new and intermediate developers with problems and questions that arise in the course of their work and study. While we may occasionally host an expert presenter, for the most part meetings consist of learner presenters presenting to the group and obtaining input and solutions for the issues that they raise. For a fuller explanation of how BFAIG operates, please see our website.
How Our Bi-Annual Software Raffle Works
December 27th, 2009
Twice a year we raffle off an Adobe software package – of the winner’s choice – up to $2100 in value. This page explains how this raffle works.
- Attendees at all monthly meetings have the option to be added to the list of potential winners. Simply make sure that the meeting’s coordinator has your name and email address.
- If you attend multiple monthly meetings within a six-month period you can get your name added to the list multiple times, thus increasing your chances of winning.
- This includes online attendees for those meetings that are combined in-person/online meetings, with one caveat:
- In order to discourage the potential for multiple logins by a single person, the meeting coordinator will have complete discretion to determine who is a “known person” and add only such people to the potential winners list.
- The “potential winners list” is maintained at http://spreadsheets.google.com/ccc?key=0AhLe5ow6grtMdENfVllDNjBmZ3FscDhaTjJfSUZxdFE&hl=en.
- It is the responsibility of attendees to:
- Make sure that the meeting’s coordinator has your name and email address. (Don’t worry, we won’t publish your email address.)
- To check the online list within a week after the meeting, confirm that you’ve been added, and inform the meeting’s coordinator if you haven’t.
- We’ll hold the raffle twice a year, generally some time in the 1st and 3rd quarter of each year, at one of our combined online/in-person meetings.
- The winner will be contacted at their email address. If they can’t be contacted through reasonable means, the software will be re-raffled the following month.
BFAIG Meeting Tuesday
December 13th, 2009
Meeting:
- Date: Tuesday, December 15, 2009
- Time: 6:15 PM EDT
- Where:
- Online, at http://adobechats.adobe.acrobat.com/bfaig20091215/
- See our Attending BFAIG page for details on attending online.
- In-Person, at the Boston office of Broduer Partners, 855 Boylston Street, a short walk from the Hynes & Copley Green Line T stops.
- Online, at http://adobechats.adobe.acrobat.com/bfaig20091215/
- Agenda:
- We’ll be brainstorming with Jack Hotchkiss from The Nature Conservancy about a project that he’s contemplating. Jack works in TNC’s fundraising department and would like to set up a website/wiki that they would use to track “donor prospects”. As part of the website he’d like to use Flex to create a data visualization screen that shows how the site’s pages are linked to one another. He’s considering using Daisy CMS for the website and either the SpringGraph (http://mark-shepherd.com/blog/springgraph-flex-component/) or the Flare (http://flare.prefuse.org/) libraries for the data visualization app. Jack is interested in getting feedback on the feasability and scope of such a project.
- The remainder of our agenda is currently open. Bring your questions, problems and subjects for discussion!
- Attendees will be eligible for our bi-annual software raffle:
- Twice a year Adobe allows us to raffle off a software package – of the winner’s choice – worth up to $2100. Here’s how it works:
- Attend monthly meetings of this group or of ABUG (our parent group)
- Your name will be entered to win the software
- Attend multiple meeting and your name will be added to the raffle list multiple times
- Raffle will occur twice a year, some time in the second and fourth quarters of each year
- Read the fine print at http://www.abug.us/blog/?p=4!
See you there!
About BFAIG:
BFAIG’s focus is on helping new and intermediate developers with problems and questions that arise in the course of their work and study. While we may occasionally host an expert presenter, for the most part meetings consist of learner presenters presenting to the group and obtaining input and solutions for the issues that they raise. For a fuller explanation of how BFAIG operates, please see our website.
BFAIG Meeting Tuesday
November 14th, 2009
Meeting:
- Date: Tuesday, Novermber 17, 2009
- Time: 6:15 PM EDT
- Where:
- Online, at http://adobechats.adobe.acrobat.com/bfaig20091117/
- See our Attending BFAIG page for details on attending online.
- In-Person, at the Boston office of Broduer Partners, 855 Boylston Street, a short walk from the Hynes & Copley Green Line T stops.
- Online, at http://adobechats.adobe.acrobat.com/bfaig20091117/
- Agenda: Our agenda is currently open. Bring your questions, problems and subjects for discussion!
- Attendees will be eligible for our bi-annual software raffle:
- Twice a year Adobe allows us to raffle off a software package – of the winner’s choice – worth up to $2100. Here’s how it works:
- Attend monthly meetings of this group or of ABUG (our parent group)
- Your name will be entered to win the software
- Attend multiple meeting and your name will be added to the raffle list multiple times
- Raffle will occur twice a year, some time in the second and fourth quarters of each year
- Read the fine print at http://www.abug.us/blog/?p=4!
See you there!
About BFAIG:
BFAIG’s focus is on helping new and intermediate developers with problems and questions that arise in the course of their work and study. While we may occasionally host an expert presenter, for the most part meetings consist of learner presenters presenting to the group and obtaining input and solutions for the issues that they raise. For a fuller explanation of how BFAIG operates, please see our website.
BFAIG Meeting Next Tuesday – Online & at our new Boston Location
October 17th, 2009
Meeting:
- Date: Tuesday, October 20, 2009
- Time: 6:15 PM EDT
- Where:
- Online, at http://adobechats.adobe.acrobat.com/bfaig20091020/
- See our Attending BFAIG page for details on attending online.
- In-Person, at the Boston office of Broduer Partners, 855 Boylston Street, a short walk from the Hynes & Copley Green Line T stops.
- Online, at http://adobechats.adobe.acrobat.com/bfaig20091020/
- Agenda:
- Announcements & opening discussion
- The floor will be open to anyone who wishes to present. If you’d like to insure that you’ll get a slot please contact us and we’ll put you on the agenda.
- If time allows, Douglas McCarroll will show how he uses the “strategy” design pattern to sequence audio in his Language Collaborative project.
- Attendees will be eligible for our bi-annual software raffle:
- Twice a year Adobe allows us to raffle off a software package – of the winner’s choice – worth up to $2100. Here’s how it works:
- Attend monthly meetings of this group or of ABUG (our parent group)
- Your name will be entered to win the software
- Attend multiple meeting and your name will be added to the raffle list multiple times
- Raffle will occur twice a year, some time in the second and fourth quarters of each year
- Read the fine print at http://www.abug.us/blog/?p=4!
See you there!
About BFAIG:
BFAIG’s focus is on helping new and intermediate developers with problems and questions that arise in the course of their work and study. While we may occasionally host an expert presenter, for the most part meetings consist of learner presenters presenting to the group and obtaining input and solutions for the issues that they raise. For a fuller explanation of how BFAIG operates, please see our website.
BFAIG Reactivated!
September 7th, 2009
Update (Tuesday): Today’s meeting will be online-only. Please join us online, as detailed below.
Thanks, Douglas
Arising from a rather lengthy slumber, the Boston Flex Application Incubator Group will begin meeting again, starting on Tuesday, September 15th. We’ll be meeting monthly on the third Tuesday of each month, from 5:45 – 7:15 PM, Eastern Time. Meetings will be combined online/in-person meetings, with the in-person part happening at the offices of Metatomix in Dedham, Massachusetts. Please note that the building’s doors are locked at 6:00 PM, so you need to arrive promptly if you will be attending in person.
BFAIG will continue its focus on helping new and intermediate developers with problems and questions that arise in the course of their work and study. While we may occasionally host an expert presenter, for the most part meetings will consist of learner presenters presenting to the group and, hopefully, obtaining useful input and solutions for the issues that they raise.
For a fuller explanation of how BFAIG operates, please see our website.
Meeting:
- Date: Tuesday, September 15, 2009
- Time: 5:45 PM EDT
- Where:
- Online, at http://adobechats.adobe.acrobat.com/bfaig20090915/
- See our Attending BFAIG page for details on attending online.
In-Person, at Metatomix.
- Online, at http://adobechats.adobe.acrobat.com/bfaig20090915/
- Agenda:
- Announcements & opening discussion
- The floor will be opened to anyone who wishes to present. If you’d like to insure that you’ll get a slot please contact us and we’ll schedule you.
- If time allows, I’ll show some of the code that I’ve been working on for my Language Collaborative project.
See you there!
BFAIG team projects
July 17th, 2008
It’s decided – BFAIG will begin team projects!
Our goals:
1. Building Flex applications.
2. Learning various development techniques.
3. Develop skills in collaborating on team projects.
Since O’Reilly very generously provides the group review copies of their books the group thought creating an application around managing the book requests and reviews would be useful.
We have some requirements gathering to do, but our initial thoughts were:
- Interface with Amazon or O’Reilly services as a data source for book info.
- Allow users to search and add books as requests.
- Keep track of who received which books and capture book reviews.
- Include an admin feature to pull the top n most requested books.
Some technical features that I think would be great to include would be.
1. Use an MVC or DI Framework (Cairngorm? Prana? Parsley? other?)
2. Modules
3. BlazeDS / Java for the back end
4. Drag & Drop
5. Internationalization
TODOs to get started:
1. Set up a VCS (google hosting?)
2. Find reasonable $ hosting for a Java back-end
3. Brainstorm feature ideas.
Once we have a better idea of what we want to do, we will assign portions of the application to members who would like to participate. As people complete tasks (or hit a wall) we would begin code reviews to see how the task was completed.
Hopefully this provides a great forum for us to learn how to create better Flex apps!
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.

