[Yanel-commits] rev 55753 - public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection

michi at wyona.com michi at wyona.com
Sat Dec 25 20:59:25 CET 2010


Author: michi
Date: 2010-12-25 20:59:22 +0100 (Sat, 25 Dec 2010)
New Revision: 55753

Modified:
   public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java
Log:
method calls simplified

Modified: public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java
===================================================================
--- public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java	2010-12-25 18:29:19 UTC (rev 55752)
+++ public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/collection/CollectionResource.java	2010-12-25 19:59:22 UTC (rev 55753)
@@ -51,26 +51,21 @@
 
     private Environment environment;
 
-    public View getView(String viewId) throws Exception {
-        return getView(viewId, null);
-    }
-
     /**
-     * Generates view
+     * @see org.wyona.yanel.core.api.attributes.ViewableV2#getView(java.lang.String)
      */
-    public View getView(String viewId, String revisionName) throws Exception {
-        Repository repo = getRealm().getRepository();
-        String yanelPath = getResourceConfigProperty("yanel-path");
-        InputStream xmlInputStream = getContentXML(repo, yanelPath, revisionName);
-        return getXMLView(viewId, xmlInputStream);
+    public View getView(String viewId) throws Exception {
+        return getXMLView(viewId, getContentXML());
     }
 
     /**
-     *
+     * Get collection (directory listing) as XML
      */
-    public InputStream getContentXML(Repository repo, String yanelPath, String revisionName) {
+    private InputStream getContentXML() throws Exception {
+        String yanelPath = getResourceConfigProperty("yanel-path");
+        Repository repo = getRealm().getRepository();
         environment = getEnvironment();
-        StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
+        StringBuilder sb = new StringBuilder("<?xml version=\"1.0\"?>");
         String path = getPath();
         try {
             if (yanelPath != null) {
@@ -91,7 +86,7 @@
             // TODO: Add realm prefix, e.g. realm-prefix="ulysses-demo"
             // NOTE: The schema is according to
             // http://cocoon.apache.org/2.1/userdocs/directory-generator.html
-            sb.append("<dir:directory yanel:path=\"" + getPath() + "\" dir:name=\"" + repo.getNode(path).getName() + "\" dir:path=\"" + path + "\" xmlns:dir=\"http://apache.org/cocoon/directory/2.0\" xmlns:yanel=\"http://www.wyona.org/yanel/resource/directory/1.0\">");
+            sb.append("<dir:directory yanel:repository-configuration-file=\"" + repo.getConfigFile() + "\" yanel:path=\"" + getPath() + "\" dir:name=\"" + repo.getNode(path).getName() + "\" dir:path=\"" + path + "\" xmlns:dir=\"http://apache.org/cocoon/directory/2.0\" xmlns:yanel=\"http://www.wyona.org/yanel/resource/directory/1.0\">");
             // TODO: Do not show the children with suffix .yanel-rti resp. make
             // this configurable!
             // NOTE: Do not hardcode the .yanel-rti, but rather use
@@ -259,8 +254,8 @@
     }
 
     /**
-    *
-    */
+     * @see
+     */
    public void create(HttpServletRequest request) {
        try {
            Repository repo = getRealm().getRepository();



More information about the Yanel-commits mailing list