7.15
In Part 1, I covered the basic setup of LiveCycle Data Services 3 Beta sitting on a MySQL database. Now, I’ll get into the Flash Builder side of things, and talk about the Modeler plugin and model driven development.
Setup Modeler Plugin
- Get Flash Builder 4 Beta (download)
- Get the LCDS Modeler plugin (download)
- Install the Modeler plugin:
- Unzip to a temp folder, which will create a
plugins
folder - Copy the
plugins
folder’s contents directly into Flash Builder’splugins
folder (typically located in/Applications/Adobe Flash Builder Beta/plugins
if you are on a Mac) - Restart Flash Builder
- Unzip to a temp folder, which will create a
Model Driven Development
- Create a new Flex project
- In Flash Builder, right-click and say New > Flex Project
enlarge - Choose J2EE for Application Server Type, and select LCDS
- Click Next to configure your server
enlarge - Uncheck Use Default Location, and fill in your root folder, url, and context (see screenshot)
- Click Validate Configuration (this will fail if LCDS is not running), and then Finish
- In Flash Builder, right-click and say New > Flex Project
- Create a new data model
- Select the Data/Services tab in the bottom window
- Click the Edit Active Data Model icon in the tab’s menubar (see screenshot)
enlarge - This will create a new data model for your project, and bring up
MyApp.fml
in the Modeler’s design view (see screenshot) - To see the file in the Package Explorer, click the Filters icon (see screenshot), then uncheck
.*
and.model
- Connect to the server
- Switch to the Adobe Data Model perspective
- In the RDS Dataview window, click the RDS Configuration icon
enlarge - Set the Context Root to
myapp
(because our server is running athttp://localhost:8080/myapp/
) - Click Test Connection, and then OK
- Verify the server’s connection to MySQL
- Edit the model
- Just drag tables from the RDS Dataview to add them to the model
enlarge
- Just drag tables from the RDS Dataview to add them to the model
- Browse the generated services and code
- Once the model is updated, the builder automatically generates standard CRUD services. Switch back to the Flash Builder perspective, and you can view them in the Data/Services tab
enlarge - The generated code is available in the Package Explorer. Files you don’t want to touch are prefixed with an underscore. The other files, like
Player.as
andPlayerService.as
are available for you to customize.
enlarge
- Once the model is updated, the builder automatically generates standard CRUD services. Switch back to the Flash Builder perspective, and you can view them in the Data/Services tab
More Docs
- LCDS Modeler Guide (zip)
Conclusion
Once again, that’s it. I’ll have to learn something new about LCDS before I write more.
Core0000
10.20.2009
When I bind to Datagrid, I get the following error message:
Could not initialize Data Service
Missing or invalid configuration for destinations.
I’m running this on Windows XP.
justin
10.20.2009
Hmmm, sounds like a configuration error to me.
Assuming you followed Part 1, can you run a RDS Configuration > Test Connection in the Modeler?
Core000
10.20.2009
Yes, the RDS Configuration test is successful. I am able to have your Part 1 and 2 working correctly. I am able to see the data in the RDS Query viewer.
Core000
10.20.2009
In the Data Model view, I deployed the model to the LCDS server. Now I get the following error:
Unable to invoke a fill operation on destination ‘MyApp.Player’ due to the following error: class org.hibernate.TransactionException:JDBC begin failed: .
null
Core000
10.20.2009
Justin, I got it working! I just had to restart the server. Looking forward to you next tutorials. Keep up the good work!
justin
10.20.2009
I’m glad you got it working. When in doubt, restart!
Expect some new LCDS 3 stuff soon. Unfortunately, these things take time.
santiago
11.25.2009
please help, i’m newbie. when I try to connect to RDS it gives me error. what’s the default username/password, or how do I change them? thanks a lot
justin
11.26.2009
@Santiago:
As I mentioned in Part 1, the easiest way to talk to get FB4 talking to RDS is to edit your LCDS app’s
web.xml
and setuseAppserverSecurity = false
. Once you do that, there’s no need for a username/password.Israel Souza
1.31.2010
Please help me, getting RDS error:
“RDS operation not supported : DBFUNCS”
Israel Souza
1.31.2010
Some ideas:
1. Remember mysql connector jar (
C:\lcds\tomcat\lib\mysql-connector-java-5.1.11-bin.jar
)2. Remember BlazeDS jar (
C:\lcds\tomcat\webapps\lcds\WEB-INF\lib\flex-rds-server.jar
)justin
2.1.2010
@Israel:
First, I recommend reading Part 1 for how to correctly install and configure LCDS. And second, this post is all about LCDS, so I wouldn’t expect RDS to work with BlazeDS.
Israel Souza
2.1.2010
Yes ok.
I was wrong with version, it really was LiveCycle BlazeDS.
I’m having some problems with java mysql connection.
Thanks for the help.
Israel Souza
2.1.2010
Parabéns!
Repeated step-by-step today and it worked.
You’re the man.
Norbert Wassink
2.6.2010
Im getting RDSDispatchServlet: Data source not found: java:/comp/env/jdbc/ error when selecting the tables in the RDSDataView. Any ideas ?
justin
2.6.2010
@Norbert:
First, I recommend re-reading Part 1 for how to correctly install and configure LCDS.
Second, “data source not found” sounds like something is wrong with the db connection to me. So, I’d verify that the mysql db exists and the name is correct in the tomcat context config (in
/tomcat/conf/Catalina/localhost/
).Cong
7.28.2010
Great tutorial and I have re-read parts 1 and 2 many times over but I cannot seem to get it working.
The RDS connection test is successful but when i try and run the application i get a:
Could not initialize DataService
Missing or invalid configuration for destinations: ["MyApp.Player"]
i can’t for the life of me figure it out, i can see the table in data model and see the table data as well but it wont’ show when i run the application.
any thoughts?
saumya
12.6.2010
Hi, Thanks for the post!
Can you tell me where in this setup can I add custom queries for my application ?
I want to define custom database queries to be executed on events.
Where would I define that ?
Many thanks.
justin
12.9.2010
@saumya: I’m not exactly sure what you want to query, but LCDS makes it easy to add derived properties to entities. It also has a straightforward mechanism to build pass-through filters that enable you to write custom JPQL queries to return a set of entities. Beyond that, LCDS 3.1 enables you to write services directly in Java so you can do anything you want.
For derived properties and pass-through filters, see my InsideRIA articles: Getting Real With LCDS 3, Part 1 and Getting Real With LCDS 3, Part 2.