Details
-
Type:
New Feature
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.9.2
-
Fix Version/s: 1.9.2
-
Component/s: Tools - AppGen
-
Labels:None
Description
Extend what has been started with AppGen and Middlegen to prompt for an app.module.
If supplied, the app.module will be used to create a new sub-package within the generated code:
base package: org.appfuse
app.module: commerce
object.name: widget
org.appfuse.commerce.model.widget would be created in conjunction with all of the supporting classes if requested.
-
- appfuse_appmodule_20060516.patch
- 16/May/06 5:33 PM
- 65 kB
- Doug Hays
-
Hide
- appfuse_appmodule_patch_files.zip
- 13/May/06 12:56 AM
- 40 kB
- Doug Hays
-
- build.xml 66 kB
- extras/appgen/build.xml 39 kB
- extras/appgen/test/.../model/Department.java 3 kB
- extras/jsf/extras/.../model/Department.java 2 kB
- extras/spring/.../src/ControllerTest.xdt 1 kB
- extras/spring/.../src/FormControllerTest.xdt 3 kB
- extras/spring/.../model/Department.java 3 kB
- extras/tapestry/.../model/Department.java 2 kB
- extras/webwork/extras/.../src/xwork.xdt 1 kB
- extras/webwork/.../model/Department.java 2 kB
-
- appfuse_appmodule.patch
- 10/May/06 3:27 PM
- 79 kB
- Doug Hays
-
- build.xml
- 12/May/06 12:59 PM
- 38 kB
- Doug Hays
-
- Department.java
- 12/May/06 12:59 PM
- 3 kB
- Doug Hays
Activity
Nice work Doug. One question - will it be possible for users to use POJOs like they are in AppFuse right now? I realize that using this submodule feature will require additional XDoclet code on the users part, but I'd also like to maintain backwards compatiblity. Hopefully we won't need to change any existing documention, just add some to explain this feature.
I'd like to release AppFuse 1.9.2 this week or this weekend (at the lastest). If you think you'll get it done before the release, let me know. I'd be great to include this feature.
Thanks, Matt. AppGen will work with POJOs and tables with my additions. In terms of the POJO, no additional XDoclet code is needed to use the 'app.module' addition. XDoclet code is still necessary, of course, but the 'app.module' is caputred as an ANT input.
I have had time this morning to work on the Spring implementation of this feature and should be able to tackle JSF tonight. Do you need me to write anything for the documentation? Also, I hope someone on the AppFuse team can give it a test drive and bless some of my decisions on project layout, etc.
Seeing all of the different implementations (Struts, WebWork, Spring...) has been very educational. (I am glad I chose WebWork for my particular project!)
BTW, I have been pushing AppFuse to everyone that cares to listen as a way to learn these technologies. Great job!
As far as documentation - I would add something to extras/appgen/README.txt and also to the AppGen wiki page (http://raibledesigns.com/wiki/AppGen.html). If you need a wiki account, let me know and I'll create one for you. I'd also add any documentation as a comment to this issue since a link to this will be included in the release notes. As far as testing, you might want to add an additional test to extras/appgen/build.xml. At the bottom, there are some tests targets - including some that copy/use custom POJOs from the "test" directory.
OK, I'm ready to push my changes to you... what's the best way for me to do that?
I added a test-appmodule target to appgen/build.xml.
Also, I have updated the Readme file with the following additional line:
3. Finally, you will be asked to enter an application module or sub-package
name. This is an optional feature that will allow you to organize your
classes into sub-packages. For example, for a POJO "model" package of
"org.appfuse.foo.model", just enter foo when prompted.
Not sure how much detail I should go into, but that seemed right.
I will need a wiki account. And let me know what sort of detail you want on the wiki.
Thanks!
Doug.
The best way is to create a patch for CVS. TortoiseCVS and Eclipse make this pretty easy to do.
Simple is good - on the wiki you probably only need a sentence or two. I'll create you an account and send the information to your e-mail account.
I tried applying this patch. There were some issues b/c I've changed this in CVS recently, but I think I got everything. However, there's a crucial thing that's missing: the package names. In my patched version of AppFuse, there's nothing in the .xdt templates that changes the package names to reflect the module. Is this a mistake or am I missing something?
To make things easier, I've uploaded the patched version of AppFuse to http://static.appfuse.org/downloads/appfuse.zip. If you can take a look at it, that'd be great. Just so you know, I did modify "test-appmodule" in appgen/build.xml to use the Person object instead of PersonPlus.
The patch is uploading now, should be done by 11:45 PM PDT.
Matt,
The package names in the .xdt templates didn't change because I changed the package names going into middlegen. Thus, the parentPackageName includes the app.module.
This is why I added the basePackageName XDoclet configParameterValue for use on imports like Constants and other Base classes.
I will download the patched appfuse zip and give that a try...
OK... there were some things in appgen/build.xml that I was being an idiot about. I think we need to introduce a new pojo for test-appmodule. In /extras/appgen/test/dao/org/appfuse, I created a new organization/model directory path with a new pojo called Department.java
The test-appmodule target has to be changed to reference this new pojo. The changed and added files are attached
Not sure how test-appmodule passed under the JSF implemenation with the way I had written the ant target...
But, I ran test-appmodule under a Struts implemenation and it passed with the above changes.
Other implementations are not working and I have found the problem. When the appgen/build.xml file is changed for the various other implementations, the replacement of the Generic Action xdoclet template is not happening. I have confirmed this under webwork and tapestry. When comparing the <replacetoken> with the original code, I could find no differences so that's where I reached a dead end.
Thoughts?
Thanks,
Doug.
<quote>
When the appgen/build.xml file is changed for the various other implementations, the replacement of the Generic Action xdoclet template is not happening. I have confirmed this under webwork and tapestry. When comparing the <replacetoken> with the original code, I could find no differences so that's where I reached a dead end.
</quote>
The reason for this is usually because of Unix vs. DOS line endings. Since I uploaded from OS X, it's likely that appgen/build.xml has UNIX line endings and you need to change those to Windows line endings. I usually fix this by opening build.xml in Wordpad and saving it.
Who knew WordPad could be useful... that fixed that problem!
I am running my final tests now in every implementation and will attach a zip with the changes.
I had to change AppFuse's build.xml file because in the struts/webdoclet area there were two tabs that didn't exist in each implementation's build.xml file so that replacetoken wasn't matching.
In WebWork, my change to xwork.xdt didn't make it into the patched AppFuse zip last night, so I'll include the updated file.
I would hope to be able to deliver another patch sometime tomorrow...
Thanks,
Doug.
Excellent - thanks Doug. I hope to release 1.9.2 on Sunday, so you have some time.
Struts, WebWork, JSF and Spring all test out using test-appmodule.
Tapestry fails test-appmodule in test-web because MockRequestCycle.getPage assumes the page's package to be the same as MockRequestCycle. Not sure what to do here, but I double checked and everything runs fine in tomcat, its just a testing issue.
OK. The attached file has the following changes:
/build.xml - Removed erroneous tab characters
/extras/appgen/build.xml - Fixed test-appmodule to use the following new Department pojos in /extras:
appgen/test/dao/org/appfuse/organization/model/Department.java
jsf/extras/appgen/test/dao/org/appfuse/organization/model/Department.java
spring/extras/appgen/test/dao/org/appfuse/organization/model/Department.java
tapestry/extras/appgen/test/dao/org/appfuse/organization/model/Department.java
webwork/extras/appgen/test/dao/org/appfuse/organization/model/Department.java
/extras/spring/extras/appgen/src/ControllerTest.xdt - Added app.module for test against getViewName()
/extras/spring/extras/appgen/src/FormControllerTest.xdt - Added app.module for test against getViewName()
/extras/webwork/extras/appgen/src/xwork.xdt - this file didn't make it into the patch .zip file
I realize that a CVS patch file would be optimal, but I don't really have a CVS base to build that on, do I?
Finally, I'm assuming that I'll add my change to the Wiki after you release 1.9.2? Or is there a different process?
Thanks,
Doug.
I should be able to work with this - let me get back to you after I've tried. As far as modifying the wiki - feel free to do that at any time.
Matt
I tried this applying this patch by using Beyond Compare and modifying "extras" to match the one you attached to this bug. I couldn't get it to work. In fact, it fails to compile when I simply run "ant test-appmodule". I'm trying to release 1.9.2 before tomorrow, so I'm on a tight deadline now. If you can create a patch against CVS HEAD, I can apply it. Otherwise, we can include it in a 1.9.3 release, or make an "appgen-with-module" download.
BTW, does this apply the module feature to ibatis as well?
I have attached a patch from CVS HEAD for my changes.
This should support iBATIS, but I haven't tested the iBATIS changes since merging my changes with CVS HEAD.
This patch file references some additional files:
? extras/appgen/test/dao/org/appfuse/organization/model
? extras/jsf/extras/appgen/src/menu-config.xdt
? extras/jsf/extras/appgen/test/dao/org/appfuse/organization
? extras/spring/extras/appgen/test/dao/org/appfuse/organization
? extras/tapestry/extras/appgen/test/dao/org/appfuse/organization
? extras/webwork/extras/appgen/test/dao/org/appfuse/organization
All of the /test/dao/org... files reference the new Department.java POJO I added for test-appmodule.
I couldn't figure out how to have the patch file include the content of these files since I don't have CVS Add rights
But, all of these should be available in previous attachments.
Here's next problem... in testing CVS HEAD + my changes with test-appmodule, only the Struts implementation worked straight up.
JSF was throwing errors concerning missing JavaScript files in web/scripts... I found an old copy of the JS files and re-ran the test with them, and test-appmodule passed.
Tapestry's test-appmodule worked as well as it did last Friday up unitl the ClassCastException mentioned in an earlier comment. Do you want me to look into fixing MockRequestCycle?
WebWork both throws errors during the Cantoo tests, so I ran AppGen's ant test target on a clean copy of CVS HEAD and it failed as well so I don't think it has to do with the appmodule additions.
Spring fails during the JUnit test for UserControllerTest... BaseControllerTestCase NoClassDefFoundError
So, I wanted to get this patch to you so that the CVS source doesn't slide too much more before the patch is applied but do with it what you want in terms of the release of 1.9.2 or later.
Thanks,
Doug.
Thanks Doug - I was successfully able to integrate this patch. As far as the other web frameworks breaking - that's expected as I'm integrating the CSS Framework now, and I only have it done for Struts. You can see the CruiseControl status of the project at http://home.raibledesigns.com:8080. If you can fix any of the non-installation issues (i.e. with Tapestry or Spring MVC), that'd be great.
Matt
Matt,
Glad that last patch worked. Sorry that it wasn't a complete patch with the new Department.java and menu-config.xdt files. Hope that wasn't too much of a pain.
In terms of the Tapestry fix, I looked into it more tonight and want some guidance before I dive in. The issue is with the MockRequestCycle.getPage() method. When it goes to instantiate the page class, it uses MockRequestCycle's package + the page class name to build out a fully qualified class name.
With AppModule, there is a sub-package missing from that equation, it throws a ClassNotFound exception, and then instantiates the BasePage class as a fallback. (I know that you know all of this but I want to make sure that what I'm saying is the truth)
My first thought was to pass the sub-package name into getPage but that's no good because of the IRequestCycle implementation.
I know that we could start dropping classes that extend MockRequestCycle into each sub-package's test.*.webapp.action package and that should work. But that seems a little kluge.
I looked through the Tapestry source and couldn't really find a clean way to load a page by name even though the pageName -> class name is available in the *.page files.
Any thoughts?
Thanks,
Doug.
Doug - everything is checked into CVS now, in an incomplete state. I'll be trying to fix the CSS Framework integration issues with week, and moving onto the modules issues you listed above when I'm done with that. Unfortunately, I'm at a client all week, so I'll likely only be working on this 1-2 hours per day. I'm guessing I'll get to this on Wed or Thurs.
Doug - I'd like to put a beta or release candidate out today, and this bug is the last major one I'd like to fix before I do this. Unfortunately, I'm having a difficult time testing it. I'm sure it's something so small I just can't see it.
When I cd into appfuse/extas/ibatis and run "ant test-appgen", the first two tests work, but the module one fails. If I cd into the generated appfuse-appmodule/extras/appgen and run "ant" with all the same parameters from there, it works fine. It's likely an Ant issue I just can't figure out. Here's the output from this particular test failure:
test-appmodule:
[delete] Deleting directory /Users/mraible/Work/appfuse-appmodule
clean:
[echo] Cleaning build and distribution directories
init:
new:
[echo]
[echo] -------------------------------------------------------------
[echo] | – Welcome to the AppFuse New Application Wizard! – |
[echo] | |
[echo] | To create a new application, please answer the following |
[echo] | questions. |
[echo] -------------------------------------------------------------
[input] skipping input as property app.name has already been set.
[input] skipping input as property db.name has already been set.
[input] skipping input as property new.pkg.name has already been set.
[input] skipping input as property web.framework has already been set.
[echo] Creating new application named 'appfuse-appmodule'...
[copy] Copying 333 files to /Users/mraible/Work/appfuse-appmodule
[copy] Copying 109 files to /Users/mraible/Work/appfuse-appmodule/extras
[copy] Copying 1 file to /Users/mraible/Work/appfuse-appmodule
[copy] Copying 1 file to /Users/mraible/Work/appfuse-appmodule
[echo]
[echo] -------------------------------------------------------------
[echo] | – Application created successfully! – |
[echo] | |
[echo] | Now you should be able to cd to your application and run: |
[echo] | > ant setup test-all |
[echo] -------------------------------------------------------------
[copy] Copying 1 file to /Users/mraible/Work/appfuse-appmodule/src
Trying to override old definition of task emmajava
Trying to override old definition of task emma
Overriding previous definition of reference to xdoclet.classpath
clean:
[delete] Deleting directory /Users/mraible/Work/appfuse-appmodule/extras/appgen/build
init:
[mkdir] Created dir: /Users/mraible/Work/appfuse-appmodule/extras/appgen/build
[echo]
[echo] -------------------------------------------------------
[echo] | – Welcome to the AppGen! – |
[echo] | |
[echo] | Use the "install" target to use the generic DAO and |
[echo] | Manager, or use "install-detailed" to general a DAO |
[echo] | and Manager specifically for your model object. |
[echo] -------------------------------------------------------
[input] skipping input as property appgen.type has already been set.
[input] skipping input as property object.name has already been set.
[input] skipping input as property app.module has already been set.
Trying to override old definition of task bool
compile:
[javac] Compiling 2 source files to /Users/mraible/Work/appfuse-appmodule/extras/appgen/build
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
gen:
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
[xdoclet] (XDocletMain.start 48 ) Running <template/>
BUILD FAILED
/Users/mraible/Work/appfuse/extras/ibatis/build.xml:485: The following error occurred while executing this line:
/Users/mraible/Work/appfuse-ibatisgen/extras/appgen/build.xml:709: The following error occurred while executing this line:
/Users/mraible/Work/appfuse-ibatisgen/extras/appgen/build.xml:697: The following error occurred while executing this line:
/Users/mraible/Work/appfuse-appmodule/extras/appgen/build.xml:323: Warning: Could not find file /Users/mraible/Work/appfuse-appmodule/extras/appgen/build/gen/web/pages/PersonListTemp.jsp to copy.
Total time: 3 minutes 34 seconds
alotta:~/dev/appfuse/extras/ibatis mraible$
Nevermind, I got it figured out. For each of the frameworks in extras, I had to change their test-appgen logic to exclude the model.name. For example, I changed this:
<ant dir="../../../$
{app.name}/extras/appgen" target="test-all" inheritAll="false"><property name="web.framework" value="tapestry"/>
<property name="appgen.type" value="pojo"/>
<property name="model.name" value="Person"/>
</ant>
To this:
<ant dir="../../../${app.name}
/extras/appgen" target="test-all" inheritAll="false">
<property name="web.framework" value="tapestry"/>
</ant>
And now the tests are working. ![]()
I have already made the changes to support 'app.module' for the following technologies:
WebWork
Struts
iBATIS
Hibernate
I'll continue to build out the code for the remaining AppFuse-supported technologies.