[Yanel-dev] Create new page (resource-creator Resource Contribution)
Cedric Staub
cedric.staub at wyona.com
Wed Feb 9 16:04:52 CET 2011
Hello
On Wed, Feb 09, 2011 at 03:37:05PM +0100, Balz Schreier wrote:
> - Is there a way how you can configure it?
Not that I know of.
> If not:
> I wrote the attached patch, so that you can configure the resource whether
> it should create the RC file too.
> If you are happy with the extension, please commit :-)
I like the idea, but you're patch doesn't compile. Your try-block is
missing a catch-clause ;-). I tried to fix it, see attachment.
Review of the patch otherwise:
- It builds (now).
- Formatting is correct.
- It's backwards-compatible (default is old behaviour).
- Can be reverted easily.
- No automatic test.
Seems like a good idea to me, I vote for committing it.
> In the realm I am working for we do not want that RC file because we have a
> default resource dealing with any kind of static content.
Yeah, I do that too. It's much nicer.
Cheers
Cedric
-------------- next part --------------
Index: src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/rescreator/ResourceCreatorResource.java
===================================================================
--- src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/rescreator/ResourceCreatorResource.java (working copy)
+++ src/contributions/resources/resource-creator/src/java/org/wyona/yanel/impl/resources/rescreator/ResourceCreatorResource.java (working copy)
@@ -493,3 +493,16 @@
if (pathOfNewResource != null) {
- createResourceConfiguration(newResource);
+ boolean createRC = true;
+ try {
+ String createRCString = getResourceConfigProperty("createRC");
+ if (createRCString != null && "false".equals(createRCString)) {
+ createRC = false;
+ }
+ } catch (Exception e) {
+ log.error(e, e);
+ log.error("Unable to read createRC setting, falling back to default (=true).");
+ createRC = true;
+ }
+ if (createRC == true) {
+ createResourceConfiguration(newResource);
+ }
addToSitetree(newResource, type);
More information about the Yanel-development
mailing list