[Yanel-dev] simplifying development of project-specific resource-types and project file-layout

Michael Wechner michael.wechner at wyona.com
Fri Apr 23 09:59:11 CEST 2010


Guillaume Déflache wrote:
> 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.

not really. It happens that one is developing a resource within a realm 
and then realizes that this is quite generic and hence
it is being factored into a more generic location.




> 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

only if referenced as package


> ) 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

you can still have different realms using the same package name hence 
producing collisions. I am mentioning this, because
people should not rely on this



> - 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

again this is a question if one want might want to re-use resource types 
in a more generic way.

It's like defining interfaces and libs. More work, but better re-usability.


> - 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?

I strongly disagree to shape technology after specific IDEs


>
> 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

have you checked re resource types documentation if this still works?

In certain cases (e.g. very specific realm resource types) the above 
might make sense, but I think one has to be aware of the following:

- Re-usability out of realm becomes very hard
- Documentation is needed
- Some features might not be supported anymore (remains to be seen)

Cheers

Michi


>
> HTH,
>    Guillaume



More information about the Yanel-development mailing list