svn commit: r565135 - /lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: nettings
Date: Sun Aug 12 13:24:54 2007
New Revision: 565135

URL: http://svn.apache.org/viewvc?view=rev&rev=565135
Log:
whitenoise, reorganized source code.
no functional change.

Modified:
    lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java

Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java?view=diff&rev=565135&r1=565134&r2=565135
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/publication/ResourceTypeImpl.java Sun Aug 12 13:24:54 2007
@@ -47,6 +47,11 @@
 public class ResourceTypeImpl extends AbstractLogEnabled implements Configurable, ThreadSafe,
         ResourceType, Serviceable {
 
+    /**
+     * The default sample name.
+     */
+    public static final String DEFAULT_SAMPLE_NAME = "Default Sample";
+
     protected static final String ATTRIBUTE_URI = "uri";
     protected static final String ATTRIBUTE_NAME = "name";
     protected static final String ELEMENT_SCHEMA = "schema";
@@ -55,21 +60,40 @@
     protected static final String ATTRIBUTE_XPATH = "xpath";
     protected static final String ELEMENT_SAMPLES = "samples";
     protected static final String ELEMENT_SAMPLE = "sample";
-    protected static final String ATTRIBUTE_SAMPLE_MIME_TYPE = "mime-type";
+    protected static final String ATTRIBUTE_MIME_TYPE = "mime-type";
     protected static final String ELEMENT_FORMAT = "format";
-    protected static final String EXPIRES_ELEMENT = "expires";
-    protected static final String SECONDS_ATTRIBUTE = "seconds";
-
-    /**
-     * The default sample name.
-     */
-    public static final String DEFAULT_SAMPLE_NAME = "Default Sample";
+    protected static final String ELEMENT_EXPIRES = "expires";
+    protected static final String ATTRIBUTE_SECONDS = "seconds";
 
     private Schema schema = null;
-    private Map samples;
     private String[] linkAttributeXPaths;
-    private long expires = 0;
+    private Map samples;
     private String samplesUri = null;
+    private Map formats = new HashMap();
+    private long expires = 0;
+    private String name;
+    private ServiceManager manager;
+
+    /**
+     * A format.
+     */
+    public static class Format {
+        private String uri;
+        /**
+         * @param uri The uri.
+         */
+        public Format(String uri) {
+            Assert.notNull("uri", uri);
+            this.uri = uri;
+        }
+        /**
+         * @return The uri.
+         */
+        public String getURI() {
+            return this.uri;
+        }
+    }
+
 
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
@@ -111,9 +135,9 @@
                 this.formats.put(name, new Format(uri));
             }
 
-            Configuration expiresConf = config.getChild(EXPIRES_ELEMENT, false);
+            Configuration expiresConf = config.getChild(ELEMENT_EXPIRES, false);
             if (expiresConf != null) {
-                this.expires = expiresConf.getAttributeAsLong(SECONDS_ATTRIBUTE);
+                this.expires = expiresConf.getAttributeAsLong(ATTRIBUTE_SECONDS);
             }
             
         } catch (Exception e) {
@@ -127,7 +151,7 @@
         Map samples = new LinkedHashMap();
         for (int i = 0; i < samplesConf.length; i++) {
             String name = samplesConf[i].getAttribute(ATTRIBUTE_NAME, DEFAULT_SAMPLE_NAME);
-            String mimeType = samplesConf[i].getAttribute(ATTRIBUTE_SAMPLE_MIME_TYPE);
+            String mimeType = samplesConf[i].getAttribute(ATTRIBUTE_MIME_TYPE);
             String uri = samplesConf[i].getAttribute(ATTRIBUTE_URI);
             samples.put(name, new Sample(name, mimeType, uri));
         }
@@ -205,15 +229,10 @@
         this.name = name;
     }
 
-    private String name;
-
     public String getName() {
         return this.name;
     }
 
-    private Map formats = new HashMap();
-    private ServiceManager manager;
-
     public String[] getFormats() {
         Set names = this.formats.keySet();
         return (String[]) names.toArray(new String[names.size()]);
@@ -229,31 +248,6 @@
         return ((Format) this.formats.get(format)).getURI();
     }
     
-    /**
-     * A format.
-     */
-    public static class Format {
-
-        private String uri;
-
-        /**
-         * Ctor.
-         * @param uri The uri.
-         */
-        public Format(String uri) {
-            Assert.notNull("uri", uri);
-            this.uri = uri;
-        }
-
-        /**
-         * @return The uri.
-         */
-        public String getURI() {
-            return this.uri;
-        }
-
-    }
-
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.