[onebusaway] r5502 committed - Edited wiki page ModuleWebapp through web user interface.

7 views
Skip to first unread message

onebu...@googlecode.com

unread,
Feb 19, 2012, 12:16:21 PM2/19/12
to onebusawa...@googlegroups.com
Revision: 5502
Author: bdfe...@onebusaway.org
Date: Sun Feb 19 09:14:25 2012
Log: Edited wiki page ModuleWebapp through web user interface.
http://code.google.com/p/onebusaway/source/detail?r=5502

Modified:
/wiki/ModuleWebapp.wiki

=======================================
--- /wiki/ModuleWebapp.wiki Tue Jun 28 15:32:52 2011
+++ /wiki/ModuleWebapp.wiki Sun Feb 19 09:14:25 2012
@@ -1,205 +1,2 @@
-#summary The `onebusaway-webapp` module, which provides all the web-based
user interface code: standard, iphone, and text-only
-#labels GettingStarted,Tutorials,UserInterface
-
-<wiki:toc depth="2"/>
-
-= Introduction =
-
-The `onebusaway-webapp` module provides all the web-based user
interfaces. That includes:
-
- * standard web interface
- * iPhone-optimized web interface
- * text-only web interface
-
-= Technologies Used =
-
-We use the [http://struts.apache.org/2.x/ Apache Struts 2.x framework] for
mapping incoming web requests to Java action handlers and mapping action
results for rendering the response. For the most part, we use standard JSP
for generating HTML responses.
-
-For much of the AJAX-ified tools in the standard web interface, we use the
[http://code.google.com/webtoolkit/ Google Web Tool], which compiles Java
code into optimized javascript. See some specific notes on [WorkingWithGWT
working with GWT], as well as documentation for specific modules below.
-
-= Running the Webapp =
-
-To run the OneBusAway webapp, you need to follow a couple of steps:
-
- # Check out the OneBusAway source into Eclipse:
ImportingTheSourceIntoEclipse
- # Setup a server instance to run the `onebusaway-webapp` module:
[SettingUpATomcatServerInEclipse]
- # Be sure to add the `onebusaway-webapp` project to the server you
setup
- # Configure appropriate data sources for the webapp:
[#Configuring_Data_Sources_for_the_Webapp Configuring Data Sources...]
- # Start the server and check for exceptions
- # Browse to the results at http://localhost:8080/onebusaway-webapp
-
-= Configuring Data Sources for the Webapp =
-
-The webapp module won't just run out of the box. You need to configure
the various data sources it will use to retrieve transit data, user data,
and other configuration information.
-
-Because this configuration information is typically specific to each
developer, many of the files controlling configuration are not included in
the source tree. However, default files that should serve as a good
starting point can be found in
-
-{{{
-onebusaway-webapp/src/main/default-resources
-}}}
-
-== data-sources.xml ==
-
-The bulk of configuration is performed in the file:
-
-{{{
-onebusaway-webapp/src/main/resources/data-sources.xml
-}}}
-
-Again, by default, this file is not actually included in the source tree.
We do, however, provide a default starting point in
`onebusaway-webapp/src/main/default-resources/data-sources.xml`. Simply
copy the `data-sources.xml` file into the `src/main/resources` and begin
editing. We'll walk through the sections in that default file, describing
what they are up to.
-
-First, we specify out transit data source (more details at
AdminTransitDataServiceConfiguration):
-
-{{{
-<bean id="transitDataService"
class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
- <property name="serviceUrl"
value="http://soak-transit-data.onebusaway.org/puget_sound/remoting/transit-data-service"
/>
- <property name="serviceInterface"
value="org.onebusaway.transit_data.services.TransitDataService" />
-</bean>
-}}}
-
-Next, we specify a database data source that will be used by various
components (user profiles, etc):
-
-{{{
-<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
- <property name="url"
value="jdbc:hsqldb:file:/tmp/org_onebusaway_database" />
- <property name="username" value="sa" />
- <property name="password" value="" />
-</bean>
-
-<bean id="webappHibernateProperties"
class="org.onebusaway.container.spring.PropertiesBeanPostProcessor">
- <property name="target" value="hibernateProperties" />
- <property name="properties">
- <props>
- <prop
key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
- </props>
- </property>
-</bean>
-}}}
-
-By default, we specify an in-process HSQLDB, because it's the easiest to
setup. However, this convenience comes with a loss of flexibility (can't
connect to the db with command-line tools, can't share the db between
multiple processes), so feel free to switch the datasource to something
different (a stand-alone HSQLDB instance, a MySQL database, your favorite
database...). Note that you'll need to update the `hibernate.dialect`
property to match the Hibernate dialect appropriate for your data source.
-
-The next entry sets up a geocoder used by the SMS interface. The default
geocoder implementation has VERY limited functionality, but is sufficient
for testing.
-
-{{{
-<bean id="externalGeocoderImpl"
class="org.onebusaway.geocoder.impl.DefaultGeocoderImpl" />
-}}}
-
-The final entry specifies a default search location object:
-
-{{{
-<bean id="serviceArea"
class="org.onebusaway.presentation.impl.DefaultServiceAreaServiceImpl" />
-}}}
-
-= Google Web Toolkit =
-
-We use [http://code.google.com/webtoolkit/ Google Web Toolkit] (GWT) for
writing much of the AJAX-ified tools and pages in the [ModuleWebapp
OneBusAway webapp]. GWT development involves writing Java code that gets
compiled to optimized Javascript. It's a development model that too
complicated to explain in specific detail here, so definitely check out the
docs at the GWT website.
-
-The one complication is that we are using a beta release of GWT 2.0. The
upcoming release adds a lot of cool features, but brings some changes in
development that we'll be discussing here.
-
-
-== Out-of-Process-Hosted-Mode (OOPHM) ==
-
-The biggest change in GWT 2.0 is the addition of
Out-of-Process-Hosted-Mode (OOPHM). Traditionally, when developing a GWT
application, you ran the application in "hosted-mode", a custom web-browser
component from Google that handled interleaving standard web elements
(HTML, Javascript) with the dynamically compiled Java code. Hosted-mode
let you debug your code using standard Java debugging tools (cool!). While
that worked well enough, it made it a hassle when you wanted to easily
debug your application within your standard browser using tools like
Firebug for tweaking CSS and what not.
-
-Google recognized these complaints and developed OOPHM. OOPHM works by
using a browser-plugin to allow your GWT code to be run within your
favorite browser while still allowing you to debug your GWT code using
standard Java debugging tools.
-
-This is a welcome change. Unfortunately, since GWT 2.0 hasn't officially
been released yet, getting the OOPHM browser plugin installed and working
can be a little tricky. Google has a wiki page with the latest:
-
-http://code.google.com/p/google-web-toolkit/wiki/UsingOOPHM
-
-Try the plugins and instructions listed there and let us know if you run
into problems.
-
-
-== !OneBusAway GWT Applications and Modules ==
-
-Most of the GWT application and module code can be found in the
-
-{{{
-org.onebusaway.webapp.gwt
-}}}
-
-package of the `onebusaway-webapp` source tree. Specific modules:
-
- # `WhereStopFinderStandardApplication.gwt.xml` - application entry point
for the [http://onebusaway.org/where/standard/index.html standard map-based
web interface]
- # `MobileApplication.gwt.xml` - application entry point for the
[http://soak.onebusaway.org/where/mobile/index.html experimental
mobile-optimized web interface]
- # `OneBusAwayStandardApplication.gwt.xml` - application entry point for
the [http://onebusaway.org/explore/onebusaway/ explore tool]
-
-
-== GWT + Maven ==
-
-To help make it easier to perform common GWT tasks, we are using the
[http://mojo.codehaus.org/gwt-maven-plugin/ gwt-maven-plugin]. The plugin
takes care of normally tricky tasks like setting up your classpath for
compiling and running GWT applications.
-
-The module can be used from the maven command line (see the
[http://mojo.codehaus.org/gwt-maven-plugin/plugin-info.html list of
supported goals]), but many of you will be running it from within Eclipse.
-
-To do so, you need to setup a Maven run tasks. To run a specific Maven
goal, right click on the `onebusaway-webapp` project, select "Run As" and
then "Maven build...":
-
-http://onebusaway.googlecode.com/svn/wiki/images/ModuleWebapp/RunProjectMavenBuild.png
-
-This will bring up a screen where you can configure a specific Maven build
task. More details on tasks you might like to run follow:
-
-
-== Running a GWT Application in Hosted Mode ==
-
-The general pattern for running a GWT application in hosted mode is to use
the "gwt:run" Maven goal. Configure a new Maven build task as specified in
the previous section. Set the goal to "gwt:run" and then add the following
parameters:
-
- * gwt.noserver = true
- * gwt.module = name of the gwt module to run
- * runTarget = url of application entry point
-
-For example, say we want to run the mobile-optimized gwt webapp
MobileApplication. The full path of the module is
`org.onebusaway.webapp.gwt.MobileApplication` and the URL entry point is
`http://localhost:8080/onebusaway-webapp/where/mobile/index.html`. The
configure Maven build task would then be:
-
-http://onebusaway.googlecode.com/svn/wiki/images/ModuleWebapp/GwtRunExample.png
-
-When you run the task, it will launch a Swing-based debug console and
print a message like the following to the console:
-
-{{{
-Using a browser with the GWT Development Plugin, please browse to
-the following URL:
-
http://localhost:8080/onebusaway-webapp/where/mobile/index.html?gwt.hosted=192.168.2.103:9997
-}}}
-
-Copy the URL into your browser and the browser will load the
`/onebusaway-webapp/where/mobile/index.html` file like any other HTML
file. However, that files references a GWT javascript module:
-
-{{{
-<script type="text/javascript"
- src="org.onebusaway.webapp.gwt.MobileApplication.nocache.js"></script>
-}}}
-
-The OOPHM GWT Development Plugin detects that you are loading GWT code and
makes the appropriate connections back to the Hosted Mode process.
-
-Note that you will already need to be running the general
`onebusaway-webapp` as a server process to serve both static HTML files
like the one above and also respond to incoming remote-procedure-calls from
the GWT app.
-
-== Running a GWT Application in off the Soak Development Server ==
-
-The examples above assume you are running a onebusaway-webapp server
instance locally at http://localhost:8080/onebusaway-webapp/. That's a
reasonable way to set things up if you need to edit data and resources from
the webapp itself, such as RPC methods, or if you need to run with your own
data source.
-
-If you just want to tweak the functionality of a GWT app and don't care so
much about the back-end data source, you can work directly from our soak
development server: http://soak.onebusaway.org/
-
-The key here is to replace the http://localhost:8080/onebusaway-webapp/ in
the above urls with http://soak.onebusaway.org/. That way, GWT will read
initial data files from the soak webserver, but still run Java code
locally. Additionally, RPC calls will go back to the soak server as well,
freeing you from having to configure a datasource.
-
-== Deploying Compiled GWT to your Dev Webapp ==
-
-If you are doing development work with `onebusaway-webapp` and want to use
the GWT modules in your running webapp (as opposed to modifying the GWT
modules and running them within GWT dev mode), things are unfortunately
more complicated than they could be. The GWT modules are included in
source form, which means they are not compiled by default. To compile
them, you need to run the following from the root
`onebusaway-application-modules` parent module:
-
-{{{
-mvn -am -pl onebusaway-webapp package
-}}}
-
-This will compile and package the GWT modules in the
`onebusaway-webapp/target/gwt` directory.
-
-Once compiled, you need to copy them into your deployed webapp .
Unfortunately, I haven't found a great way of automating this. I've
introduced a helper Java class to assist in the task:
-
-{{{
-org.onebusaway.presentation.impl.CopyCompiledGwtResourcesMain
-}}}
-
-By running this class from within Eclipse, the class will examine the
`onebusaway-webapp/pom.xml` and figure out where to copy GWT resources into
the deployed webapp, where the single argument to the app is the path to
your deployed webapp. For example, mine is:
-
-{{{
-/Users/bdferris/oba/apache-tomcat-config/onebusaway-webapp/wtpwebapps/onebusaway-webapp
-}}}
-
-*CRITICAL*: For this to work properly, you must setting the Project to
`onebusaway-webapp` in the Eclipse run dialog to make sure the
`CopyCompiledGwtResourcesMain` is run relative to the `onebusaway-webapp`
directory.
-
-If you have ideas for improving this, I'm all ears.
+#labels Deprecated
+Moved to
https://github.com/OneBusAway/onebusaway-application-modules/wiki/onebusaway-webapp

Reply all
Reply to author
Forward
0 new messages