[Yanel-dev] simplifying development of project-specific
resource-types and project file-layout
Guillaume Déflache
guillaume.deflache at wyona.com
Thu Apr 22 13:39:49 CEST 2010
Hi!
For some time now it has been possible in Yanel to specific
project-specific resource-types (RTs) in a resource-types.xml in your
realm-directory, cf.
http://yanel.wyona.org/en/documentation/configuration/resource-types_xml.html
Also even before that it was already possible to gather several RTs
under a single directory, using resource-*.xml files alongside the usual
resource.xml file (unfortunately it may not be documented anywhere ATM :/).
AFAICU this was done to avoid having to create and adapt a lot of files
and directories (to the very minimal build.xml,
src/build/build.properties, src/build/dependencies.xml, htdocs/,
src/java/tld/project/) just to define some new routing logic in Java, in
addition to the absolutely needed *Resource.java Java source file and
resource*.xml resource-type definition XML file.
IMHO project-specific RTs that are unlikely to be reused elsewhere (in
Yanel or in other projects) do not need the kind of file-based
modularity that generic Yanel RTs do.
So in the project I am currently working on I tried to make it even
simpler by putting the Java source file and the XML definition file for
project-specific RTs simply under their own package (as one must always
do anyway) along with the other Java sources of the project (for example
next to the Java source file for the project-specific Yanel toolbar menu).
Advantages:
- project-specific Java source files are all located under the same
source directory (but in can still arrange them by feature as you would
otherwise do)
- it is impossible for project-specific RTs to "collide" because they
use the same package: there can only be one "resource.xml" per
directory, so only one RT per Java package
- one does not need to declare dependencies between project-specific RTs
and/or the realm, because they all are available together in the same
realm JAR
- under Eclipse as all sources live in the same Eclipse project, one can
source-debug and do hot-code replacement the whole application without
any glitches (cf in
http://yanel.wyona.org/en/documentation/development/build_setup_eclipse_ide.html
the final TODO: "Document how to create a debug configuration andhow to
debug across multiple resource-types, which may still be tricky.")
- it is easier to move code from one RT to another or to and from the
common project code
- maybe more?
Disadvantages:
- one does not have one separate "htdocs" per directory, but this was
already the case when putting several resource-types under a single
directory
- it needs getting used to
- probably more I didn't think about, but I think it's well worth trying
HTH,
Guillaume
More information about the Yanel-development
mailing list