5. Guice Sample Project Installation
What It Does
The Guice/Warp sample application in GraniteDS is a basic CRUD cars manager. You may create, read, update, and delete cars from the Flex interface, and all those operations will be persisted in a database.
More specifically, this sample illustrates:
- Guice service factory and destination configuration in a services-config.xml file.
- Warp persistent filter configuration in a web.xml file.
- Guice Injector creation and configuration in a specific InitNDestroy servlet context listener, registered in a web.xml file.
- Guice Cars service example with the injection of an EntityManager and Warp @Transactional annotation usage.
- EJB 3 entity beans externalization, via the HibernateExternalizer class, with Gas3 generated ActionScript3 classes.
Guice/Warp support and sample application is a contribution made by Matt GIACOMI.
Requirements
Follow general requirements here, then:
- Download JBoss 4.2+.
- Download org.granite.gas3_1.2.0.zip.
- Download graniteds-guice-1.2.0.zip.
Installation & Deployment
Follow these steps:
- Unzip the JBoss binary distribution somewhere on your computer; for example /jboss-4.2.2.GA.
- Unzip the org.granite.gas3_1.2.0.zip archive in your Eclipse plugin directory.
- (Re)start Eclipse, right-click in the Package Explorer view, choose Import, then General / Existing Projects into Workspace, choose Select archive file, browse to graniteds-guice-1.2.0.zip, and click on Finish.
- Edit the env.properties file found in the root directory of the graniteds_guice project and adjust the following variables:
# Set 'FLEX_HOME' property to your flex2 sdk installation directory and # 'FLEX_TASKS_JAR' to your flexTasks.jar location. # WARNING: This property must have this exact name ('FLEX_HOME'). FLEX_HOME=/flex_sdk_2 FLEX_TASKS_JAR=${FLEX_HOME}/lib/flexTasks.jar # Set 'JBOSS_HOME' property to your JBoss installation directory and # 'JBOSS_HOME_DEPLOY' to your deploy directory. JBOSS_HOME=/jboss-4.2.2.GA JBOSS_HOME_DEPLOY=${JBOSS_HOME}/server/default/deployThe JBOSS_HOME_DEPLOY variable should be ok without modification.
- Open an Eclipse Ant view (Window / Show View / Ant), drag and drop the build.xml file, found in the root directory of the graniteds_guice project, on it, and double-click the Deploy target. This should compile, package, and deploy the Guice sample application in JBoss.
- Start JBoss (run.bat or run.sh in /jboss-4.2.2.GA/bin).
- Point your browser to http://localhost:8080/graniteds-guice/.
You should now see the Guice sample application running.
