[Yanel-commits] rev 24289 -
public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources
michi at wyona.com
michi at wyona.com
Wed May 9 15:05:04 CEST 2007
Author: michi
Date: 2007-05-09 15:05:02 +0200 (Wed, 09 May 2007)
New Revision: 24289
Modified:
public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java
Log:
resource config implemented
Modified: public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java
===================================================================
--- public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java 2007-05-09 12:16:38 UTC (rev 24288)
+++ public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java 2007-05-09 13:05:02 UTC (rev 24289)
@@ -18,6 +18,7 @@
import org.wyona.yanel.core.Path;
import org.wyona.yanel.core.Resource;
+import org.wyona.yanel.core.ResourceConfiguration;
import org.wyona.yanel.core.api.attributes.ViewableV2;
import org.wyona.yanel.core.attributes.viewable.View;
import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
@@ -107,14 +108,21 @@
// NOTE: Do not hardcode the .yanel-rti, but rather use
// Path.getRTIPath ...
org.wyona.yarep.core.Path[] children = contentRepo.getChildren(p);
- for (int i = 0; i < children.length; i++) {
- if (contentRepo.isResource(children[i])) {
- sb.append("<dir:file path=\"" + children[i] + "\" name=\"" + children[i].getName() + "\"/>");
- } else if (contentRepo.isCollection(children[i])) {
- sb.append("<dir:directory path=\"" + children[i] + "\" name=\"" + children[i].getName() + "\"/>");
- } else {
- sb.append("<yanel:exception yanel:path=\"" + children[i] + "\"/>");
+ if (children != null) {
+ for (int i = 0; i < children.length; i++) {
+ if (contentRepo.isResource(children[i])) {
+ sb.append("<dir:file path=\"" + children[i] + "\" name=\"" + children[i].getName() + "\"/>");
+ } else if (contentRepo.isCollection(children[i])) {
+ sb.append("<dir:directory path=\"" + children[i] + "\" name=\"" + children[i].getName() + "\"/>");
+ } else {
+ sb.append("<yanel:exception yanel:path=\"" + children[i] + "\"/>");
+ }
}
+ if (children.length < 1) {
+ sb.append("<yanel:no-children/>");
+ }
+ } else {
+ sb.append("<yanel:no-children/>");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -199,15 +207,23 @@
/**
* Get XSLT
*/
- private String[] getXSLTprop() {
+ private String[] getXSLTprop() throws Exception {
+ ResourceConfiguration rc = getConfiguration();
+ if (rc != null) return rc.getProperties("xslt");
return getRTI().getProperties("xslt");
}
/**
* Get mime type
*/
- public String getMimeType(String viewId) {
- String mimeType = getRTI().getProperty("mime-type");
+ public String getMimeType(String viewId) throws Exception {
+ String mimeType = null;
+ ResourceConfiguration rc = getConfiguration();
+ if (rc != null) {
+ mimeType = rc.getProperty("mime-type");
+ } else {
+ mimeType = getRTI().getProperty("mime-type");
+ }
if (mimeType != null) return mimeType;
// NOTE: Assuming fallback re dir2xhtml.xsl ...
More information about the Yanel-commits
mailing list