[ 
http://issues.apache.org/jira/browse/FOR-681?page=comments#action_12330777 ] 

Alex Batlin commented on FOR-681:
---------------------------------

I have been playing around with this, and looking at cocoon.xconf, it does 
allow includes of either files or directories. In fact forrest's cocoon.xconf 
includes forrest's own xconf file. So I thought it would real simple to change 
the ant deploy target to copy the xconf files along with the rest of the files 
in conf dir (currently it excludes them and then xpatches them) to a conf dir 
(instead of root) and then simply change the plugin.xconf in main/var to 
include the conf dir pattern matching *.xconf. 

This does not work. If I include a specific file e.g. <include 
src="resource://conf/my.xconf"/> it works just fine. If I however include a 
directory, it does not work:

 <include dir="resource://conf" pattern="*.xconf"/>
 
    [java] [DEBUG] Logger for category cocoon not defined in configuration. New 
Logger created and returned
    [java] [DEBUG] CommandlineContext: 
getRealPath=//WEB-INF/xconf/forrest-core.xconf
    [java] Exception in thread "main" 
org.apache.avalon.framework.configuration.ConfigurationException: Include.dir 
must point to a directory, 'resource://conf' is not a directory.'
    [java]     at 
org.apache.cocoon.core.container.CoreServiceManager.handleInclude(Unknown 
Source)
    [java]     at 
org.apache.cocoon.core.container.CoreServiceManager.parseConfiguration(Unknown 
Source)
    [java]     at 
org.apache.cocoon.core.container.CoreServiceManager.configure(Unknown Source)
    [java]     at 
org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:201)
    [java]     at org.apache.cocoon.Cocoon.configure(Unknown Source)
    [java]     at org.apache.cocoon.Cocoon.initialize(Unknown Source)
    [java]     at 
org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:244)
    [java]     at org.apache.cocoon.core.CoreUtil.createCocoon(Unknown Source)
    [java]     at org.apache.cocoon.bean.CocoonWrapper.initialize(Unknown 
Source)
    [java]     at org.apache.cocoon.bean.CocoonBean.initialize(Unknown Source)
    [java]     at org.apache.cocoon.Main.main(Unknown Source)


Whilst if I include a real URL (e.g.   <include 
dir="file:///C:/alpha/forrest/plugins/com.batlin.forrest.plugin.internal.profile/build/conf"
 pattern="*.xconf"/>  ), it does work, but breaks other internal dependencies 
i.e. if I load authentication.xconf it inside call for session.xconf using 
resource:, but by loading the it from plugins.xconf using real URL causes 
cocoon to complain. Any ideas?


> Include xconf files in plugins using includes, not XPatch
> ---------------------------------------------------------
>
>          Key: FOR-681
>          URL: http://issues.apache.org/jira/browse/FOR-681
>      Project: Forrest
>         Type: Improvement
>   Components: Plugins (general issues)
>     Versions: 0.8-dev
>  Environment: Windows XP Home
>     Reporter: Alex Batlin
>     Priority: Blocker

>
> See http://marc.theaimsgroup.com/?l=forrest-dev&m=112781600212715&w=2
> > I was excited to see the addition of xconf capability into plugins. See
> > http://svn.apache.org/viewcvs?rev=227190&view=rev.
> > 
> > I rebuild cocoon with authentication and session blocks, and added the jars
> > to 'plugin/lib' and the xconf files from the
> > 'cocoon-2.2.0-dev\build\webapp\WEB-INF\xconf' to 'plugin/conf'.
> ...
> > So am bit confused, on two counts:
> > 1. if xpatch is required, how do I generate this file?
> > 2. why are we using xpatch, when the current cocoon.xconf uses includes,
> > can't we do the same here?
> This was a rather hasty commit of mine that I have not yet fixed, even 
> though David spotted it as soon as I committed. Sorry that it has stung you.
> My original solution for including config files for plugins was to use 
> the XPatch utility. This sat on my hard drive for some time because I 
> had a few minor issues to iron out before committing. Then somebody 
> needed some functionlaity from my local "branch" that also contained the 
> XConf code. I committed in a hurry, not noticing that I still used the 
> XPatch method.
> The good news is that I have also enabled the XConf includes 
> functionality. But this has not yet been leveraged for plugins.
> There are two short term workarounds for you:
> 1) Use the XPatch facility (see Cocoon docs on XPatch)
> 2) is to edit the main/webapp/cocoon.xconf and add the include you need, 
> it will work ust fine.
> If you opt for one be aware that we will be removing this in favour of 
> using the includes at some point before the 0.8 release.
> The long term solution to the problem is to create a plugin.xconf file 
> that s built each time Forrest is run, much the same as we do with the 
> sitemap mounts for plugins. We would welcome a patch for this, I can 
> help point you in the right direction if you fancy tackling it.
> Could you please create an issue for this and point to this thread in 
> the archives so I do not forget again.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to