Castle Windsor Project Includes in Config - web-config

I want the properties section of the Castle config to be included from another file. I.e:
<castle>
<include uri="file://properties.config" />
</castle>
The properties.config would then look like:
<properties>
<smtp>10.10.10.10</smtp>
<username>john</username>
</properties>
I can get the include to work for components but not for properties. If I try to do this with properties I get an exception thrown. Is this a limitation of Castle?

This was a misunderstanding about how I should be entering the xml into the configuration. I wasn't starting with the castle element and working down, i.e. I was using properties as the root node.

Related

How to exclude sub-nodes in an AEM package using filters

I am creating an AEM content package and the resulting zip has the requisite META-INF directory with the filter.xml.
The package has content which is organized like so:
/jcr_root/apps/appgroup/myapp/components
/jcr_root/apps/appgroup/myapp/i18n/en_us.xml
/jcr_root/apps/appgroup/myapp/i18n/es_mx.xml
/jcr_root/apps/appgroup/myapp/templates
The filter.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/appgroup/myapp">
<exclude pattern="/apps/appgroup/myapp/i18n(/.*)?" />
</filter>
</workspaceFilter>
Despite having the exclude pattern, the i18n node still gets deployed into the CRX when the package is installed. Shouldn't the filter exclude the i18n node?
Ultimately, I would like to deploy just the en_us node and have the filters block any other languages.
My understanding is that the filter taken into consideration during install and not during compilation. Is this correct?
Filters are applied when the package is built rather than installed. With an exclusion, it shouldn't get installed by your package, but it also means if already present, it also won't get removed either! It should behave as if the package doesn't touch the area covered by the exclude filter.
From the documentation*:
To include all scripts of my application but the forms component:
Root path: /apps/myapp
Rules: Exclude: /apps/myapp/components/form(/.*)?
The form component is not included in the package. If such a component
already existed when installing the package, CRX would not remove it,
because it is not defined by the filters.
…
When building the package, all the content defined by each filter is included. When extracting the package, all existing content that matches the filter is removed or replaced.
Edit: Working from a Maven bundle, you could use specify elements as excluded using a resource declaration, to avoid the content being added to the Zip e.g.:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>jcr_root/apps/appgroup/myapp/i18n</exclude>
<exclude>jcr_root/apps/appgroup/myapp/i18n/**/*.*</exclude>
</excludes>
</resource>
</resources>
</build>
It's possible that the filter.xml is getting ignored by Maven on build & once the content is in the package, it's getting installed by CQ regardless.
EDIT2: * Initial example is no longer in the documentation now that Day.com is down, but should still hold true. Updated documentation is now available here

GWT Compiler cannot find Collect.gwt.xml, but I have Guava as a dependency

I'm moving over to a new computer, and in the processing I'm creating new Intellij 12 projects from my git source.
I have a gwt module file containing the following:
<!-- Other module inherits -->
<inherits name="com.google.common.collect.Collect" />
<inherits name="com.google.common.base.Base" />
<inherits name="com.bdl.message.Message" />
<inherits name="com.bdl.universal.Universal" />
<inherits name="com.bdl.appengine.AppEngine" />
<inherits name="com.bdl.gwt.BdlGwt" />
<inherits name="com.google.gwt.inject.Inject"/>
The com.bdl.* entries are from another library I've written and I have their jar files (and sources) in the module dependencies. I can confirm that removing those dependencies causes the corresponding inherits nameto turn red, indicating an error.
I also have as a dependency, a global library Guava (GWT) which contains:
classes:
guava-14.0-rc2.jar
sources:
guava-14.0-rc2-sources.jar
guava-gwt-14.0-rc2.jar
javadoc
guava-14.0-rc2-javadoc.jar
But despite this, the inherits for Collect and Base are red and the GWT compiler fails, saying it can't find Collect.gwt.xml.
On my old system I have an Intellij 11 project, which is set up the same way (there must be some difference somewhere, but I've been looking for hours to find it and can't)
That also has the same library as a dependency, and the inherits lines in my app's module are still red, but the GWT compiler succeeds, finding the Collect.gwt.xml right where it should be, at:
jar:file:/[path-to-guava]/guava-gwt-14.0-rc2.jar!/com/google/common/collect/Collect.gwt.xml
There must be something simple and stupid that I'm missing, but I can't find it.
You probably need to add guava-gwt-14.0-rc2.jar to your dependencies. Notice that the name has -gwt- embedded in it and you said that you have just these as dependencies:guava-14.0-rc2.jar sources: guava-14.0-rc2-sources.jar guava-gwt-14.0-rc2.jar javadoc guava-14.0-rc2-javadoc.jar
You can check that the jar is the appropriate one because when you open it (it is just a zip file) you should see the Collect.gwt.xml file somwhere within.

Buckminster RCP simple project materialization

After watching the webinar, skimming over the BuckyBook PDF, and following the Eclipse RCP build tutorial, I still don't know how to materialize a simple RCP plug-in project from CVS into an eclipse workspace.
Does anyone have an example with a CQUERY and an RMAP file, for a simple one project workspace?
Its actually easy.
Here is a sample CSPEC:
<?xml version="1.0" encoding="UTF-8"?>
<cq:componentQuery xmlns:cq="http://www.eclipse.org/buckminster/CQuery-1.0" resourceMap="example-site.rmap">
<cq:rootRequest name="example-site" componentType="eclipse.feature"/>
</cq:componentQuery>
Note the root request name property points to a component. If you have an RCP app which has a main bundle (say one that is the launching point to your app), then you would point to this component using the name property above. This CSPEC will then download all dependent components using the RMAP below, using search paths, providers etc.
The RMAP:
<searchPath name="default">
<provider
readerType="cvs"
componentTypes="osgi.bundle,eclipse.feature"
source="true"
mutable="true">
<uri format=":pserver:anon#cvs.local:/opt/data/cvsroot,{0}/">
<bc:propertyRef key="buckminster.component" />
</uri>
</provider>
</searchPath>
<searchPath name="galileo">
<provider readerType="eclipse.import" componentTypes="osgi.bundle,eclipse.feature"
mutable="false" source="false">
<uri format="http://download.eclipse.org/releases/galileo?importType=binary"/>
</provider>
</searchPath>
<locator searchPathRef="default" pattern="^example\-.*" />
<locator searchPathRef="galileo" failOnError="false" />

Maven assembly plugin: run only one descriptor

I have a project which has several custom descriptors written for the assembly plugin. Is there a way to run only one of those descriptors at a time instead of the whole bunch? I tried using the descriptors switch as documented here, passing in the full path to the one descriptor that I wanted to run, but instead it's running all of the descriptors in my app's main pom file, seeming to ignore the switch I specified.
Probably the easiest way to do so, is by using Maven Profiles.
Define some profiles in your pom.xml:
<profiles>
<profile>
<id>profile-1</id>
<properties>
<assembly-config>assem1.xml</assembly-config>
</properties>
</profile>
<profile>
<id>profile-2</id>
<properties>
<assembly-config>assem2.xml</assembly-config>
</properties>
</profile>
</profiles>
Then you use that particular property for the configuration of the assembly plugin:
...
<descriptor>src/main/assembly/${assembly-config}</descriptor>
...
Then run your maven build with the -P option: mvn -P profile-1 compile
So, summarized, if you choose a profile at buildtime, the property assembly-config will be set depending on the defined profile. The assembly configuration depends in that case on the chosen profile.
Hope this helps!

Is it possible to override nant targets from included buildfile?

I have a generic common.xml file that holds a number of generic nant targets that are re-used among multiple builds. What I want to do is 'override' some of these nant targets and include additional steps either before or after the existing target is executed.
Are nant targets used from the current file first? ie. If i create a nant target in the current buildfile with the same name as a target in an included file does that one get called and the included one ignored? If that's the case I can just do and call the included target but it would seem like then that would be a recursive call rather then to an included task.
Thoughts?
I had the same question (and found the same results), but I also found a workaround. Allow me to illustrate with an example.
You have a ProjectFile.build and a CommonFile.build. Let's say you want to overwrite a target called "Clean".
You would need to create a new file (call it CommonFile_Clean.build) which contains:
<?xml version="1.0"?>
<project>
<target name="Clean">
<echo message="Do clean stuff here" />
</target>
</project>
In CommonFile.build, you conditionally include CommonFile_Clean.build:
<?xml version="1.0"?>
<project>
<echo message="checking Clean definition..." />
<if test="${not target::exists('Clean')}">
<echo message="Clean target not defined." />
<include buildfile="CommonFile_Clean.build" />
</if>
</project>
In ProjectFile.build, you can either define the Clean target (in which case CommonFile_Clean.build will not be used) or use the default implementation as defined in CommonFile_Clean.build.
Of course, if you have a large number of targets, this will be quite a bit of work.
Hope that helps.
No, I've just tried it for you, as I have a similar set-up, in that I have all of the build targets we use in a commonFile.build and then use the following code to bring it in...
<include buildfile="../commonFile.build"/>
In my newFile.build (that includes the commonFile.build at the top of the file), I added a new target called 'build', as it exists in the commonFile, and here's the error message you get in response...
BUILD FAILED
Duplicate target named 'build'!
Nice idea, probably bourne of OO principles, but sadly it doesn't work.
Any good?