[Yanel-commits] rev 20283 - in public/yanel/trunk: conf src/contributions/resources/atom/src/java/org/wyona/yanel/impl/resources src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources src/contributions/resources/davcollection/src/java/org/wyona/yanel/impl/resources src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources src/contributions/resources/zip/src/java/org/wyona/yanel/impl/resources src/core/java/org/wyona/yanel/core src/impl/java/org/wyona/yanel/impl/map src/resources/directory/src/java/org/wyona/yanel/impl/resources src/resources/file/src/java/org/wyona/yanel/impl/resources src/resources/odt/src/java/org/wyona/yanel/impl/resources src/resources/xml/src/java/org/wyona/yanel/impl/resources

josias at wyona.com josias at wyona.com
Thu Nov 23 19:40:28 CET 2006


Author: josias
Date: 2006-11-23 19:40:25 +0100 (Thu, 23 Nov 2006)
New Revision: 20283

Modified:
   public/yanel/trunk/conf/spring-yanel-config.xml
   public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java
   public/yanel/trunk/src/contributions/resources/atom/src/java/org/wyona/yanel/impl/resources/AtomFeedResource.java
   public/yanel/trunk/src/contributions/resources/davcollection/src/java/org/wyona/yanel/impl/resources/DavCollection.java
   public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java
   public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java
   public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
   public/yanel/trunk/src/contributions/resources/zip/src/java/org/wyona/yanel/impl/resources/ZipResource.java
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java
   public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapImpl.java
   public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java
   public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java
   public/yanel/trunk/src/resources/odt/src/java/org/wyona/yanel/impl/resources/ODTResource.java
   public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
Log:
load repository factories through spring, instead of instantiating new factories all the time.

Modified: public/yanel/trunk/conf/spring-yanel-config.xml
===================================================================
--- public/yanel/trunk/conf/spring-yanel-config.xml	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/conf/spring-yanel-config.xml	2006-11-23 18:40:25 UTC (rev 20283)
@@ -2,10 +2,16 @@
 <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
 <beans>
-  <bean id="repositoryFactory" class="org.wyona.yarep.core.RepositoryFactory">
-    <!-- this is just an example so far, it's not really used -->
-    <!-- <property name="someProperty"><value>someValue</value></property> -->
+  <bean id="DefaultRepositoryFactory" class="org.wyona.yarep.core.RepositoryFactory"/>
+  <bean id="RTIRepositoryFactory" class="org.wyona.yarep.core.RepositoryFactory">
+    <constructor-arg type="java.lang.String" value="yanel-rti-yarep.properties"/>
   </bean>
+  <!-- <bean id="ACPoliciesRepositoryFactory" class="org.wyona.yarep.core.RepositoryFactory">
+    <constructor-arg type="java.lang.String" value="ac-policies-yarep.properties"/>
+  </bean>
+  <bean id="ACIdentitiesRepositoryFactory" class="org.wyona.yarep.core.RepositoryFactory">
+    <constructor-arg type="java.lang.String" value="ac-identities-yarep.properties"/>
+  </bean> -->
   <bean id="map" class="org.wyona.yanel.impl.map.MapImpl"/>
   <bean id="policyManager" class="org.wyona.security.impl.PolicyManagerImpl"/>
   <bean id="identityManager" class="org.wyona.security.impl.IdentityManagerImpl"/>

Modified: public/yanel/trunk/src/contributions/resources/atom/src/java/org/wyona/yanel/impl/resources/AtomFeedResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/atom/src/java/org/wyona/yanel/impl/resources/AtomFeedResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/contributions/resources/atom/src/java/org/wyona/yanel/impl/resources/AtomFeedResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -79,7 +79,7 @@
 
         Repository contentRepo = null;
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             contentRepo = rp.getRepo();
 
             // TODO: Do not show the children with suffix .yanel-rti resp. make this configurable!
@@ -273,7 +273,7 @@
         String propertyValue = defaultValue;
         try {
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory ...!
-            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
 
             String property = null;
@@ -301,7 +301,7 @@
             return new org.wyona.yarep.core.Path(entriesPathString);
         } else {
             try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(feedPath.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(feedPath.toString()), getRepositoryFactory());
             Repository repo = rp.getRepo();
             org.wyona.yarep.core.Path entriesPath = rp.getPath();
 
@@ -333,7 +333,7 @@
      */
     public Path createEntry(Path path, java.io.InputStream in) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
 
             org.wyona.yarep.core.Path entryPath = new org.wyona.yarep.core.Path(getEntriesPath(path).toString() + "/" + new Date().getTime() + ".xml");
             java.io.OutputStream out = rp.getRepo().getOutputStream(entryPath);
@@ -389,4 +389,9 @@
     String getEntriesURL(Path path) {
         return getProperty(path, "entries-url", null);
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
 }

Modified: public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/contributions/resources/atom-entry/src/java/org/wyona/yanel/impl/resources/AtomEntryResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -79,7 +79,7 @@
         defaultView.setMimeType(mimeType);
 
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
 
             if (mimeType.equals("application/xml")) {
                 defaultView.setInputStream(getContentXML(rp));
@@ -128,7 +128,7 @@
         String mimeType = null;
         try {
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory ...!
-            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
 
             while ((mimeType = br.readLine()) != null) {
@@ -173,7 +173,7 @@
      *
      */
     public Reader getReader(Path path) throws Exception {
-        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
         return rp.getRepo().getReader(new org.wyona.yarep.core.Path(rp.getPath().toString()));
     }
 
@@ -182,7 +182,7 @@
      */
     public InputStream getInputStream(Path path) throws Exception {
         // TODO: Reuse stuff from getReader ...
-        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
         return rp.getRepo().getInputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
     }
 
@@ -215,7 +215,7 @@
      */
     public OutputStream getOutputStream(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getOutputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -240,7 +240,7 @@
                 entry.setPublished(date);
             }
 
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             OutputStream out = rp.getRepo().getOutputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
 
             org.apache.abdera.writer.Writer writer = abdera.getWriter();
@@ -259,7 +259,7 @@
      */
     public long getLastModified(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getLastModified(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -275,7 +275,7 @@
         String xsltPath = null;
         try {
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory ...!
-            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
 
             while((xsltPath = br.readLine()) != null) {
@@ -317,11 +317,17 @@
      */
     public boolean delete(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().delete(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
             return false;
         }
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
+
 }

Modified: public/yanel/trunk/src/contributions/resources/davcollection/src/java/org/wyona/yanel/impl/resources/DavCollection.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/davcollection/src/java/org/wyona/yanel/impl/resources/DavCollection.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/contributions/resources/davcollection/src/java/org/wyona/yanel/impl/resources/DavCollection.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -62,7 +62,7 @@
         
         Repository contentRepo = null;
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("DefaultRepositoryFactory"));
             contentRepo = rp.getRepo();
             org.wyona.yarep.core.Path p = rp.getPath();
 

Modified: public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -112,7 +112,7 @@
         this.language = language;
         try {
             RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()),
-                    new RepositoryFactory());
+                    getRepositoryFactory());
             repository = rp.getRepo();
 
             nutchView = new View();
@@ -346,7 +346,7 @@
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory
             // ...!
             RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()),
-                    new RepositoryFactory("yanel-rti-yarep.properties"));
+                    yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo()
                     .getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath()
                             .toString())));
@@ -375,7 +375,7 @@
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory
             // ...!
             RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()),
-                    new RepositoryFactory("yanel-rti-yarep.properties"));
+                    yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo()
                     .getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath()
                             .toString())));
@@ -415,4 +415,10 @@
         log.debug("[" + inputString + "] replaced with [" + replacedAmpersand + "]");
         return replacedAmpersand;
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
+
 }

Modified: public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/LinkChecker.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -4,6 +4,7 @@
 import org.apache.log4j.Category;
 import org.wyona.yarep.core.RepositoryFactory;
 import org.wyona.yarep.util.RepoPath;
+import org.wyona.yanel.core.Yanel;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
@@ -89,7 +90,7 @@
         log.debug("checking link --> " + path);
         RepoPath rp;
         try {
-            rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path), new RepositoryFactory());
+            rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path), Yanel.getInstance().getRepositoryFactory("DefaultRepositoryFactory"));
             return rp.getRepo().isResource(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch (Exception e) {
             log.error(e.getMessage(), e);

Modified: public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -78,7 +78,7 @@
     public View getView(Path path, String viewId) {
         View defaultView = new View();
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             repository = rp.getRepo();
             
             
@@ -162,7 +162,7 @@
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory
             // ...!
             RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()),
-                    new RepositoryFactory("yanel-rti-yarep.properties"));
+                    yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo()
                     .getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath()
                             .toString())));
@@ -180,4 +180,10 @@
         }
         return null;
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
+
 }

Modified: public/yanel/trunk/src/contributions/resources/zip/src/java/org/wyona/yanel/impl/resources/ZipResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/zip/src/java/org/wyona/yanel/impl/resources/ZipResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/contributions/resources/zip/src/java/org/wyona/yanel/impl/resources/ZipResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -67,7 +67,7 @@
             org.wyona.yarep.core.Path zipDirPath = new org.wyona.yarep.core.Path(zipDir); 
             
             RepoPath zipRp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(
-                    new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+                    new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             
             Repository zipRepo = zipRp.getRepo();         
             
@@ -169,7 +169,7 @@
         String property = null;
         try {
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory ...!
-            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
 
             while ((property = br.readLine()) != null) {
@@ -185,4 +185,10 @@
 
         return property;
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
+
 }

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/Yanel.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -39,29 +39,26 @@
     * Private constructor
     */
    private Yanel() throws Exception {
-      
 	   applicationContext = new ClassPathXmlApplicationContext(SPRING_CONFIG_FILE);	     
-       // example:
-       //RepositoryFactory repoFactory = (RepositoryFactory)applicationContext.getBean("repositoryFactory");
-	   
        map = (Map) applicationContext.getBean("map");
        rtr = new ResourceTypeRegistry();
-
-      
-  
     }
-
+   
     public static Yanel getInstance() throws Exception {
         if (yanel == null) {
             yanel = new Yanel();
         } 
         return yanel;
     }
-    
+   
     public BeanFactory getBeanFactory() {
         return applicationContext;
     }
     
+    public RepositoryFactory getRepositoryFactory(String id) {
+        return (RepositoryFactory)applicationContext.getBean(id);
+    }
+    
     /**
      *
      */

Modified: public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapImpl.java
===================================================================
--- public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapImpl.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapImpl.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -17,6 +17,7 @@
 package org.wyona.yanel.impl.map;
 
 import org.wyona.yanel.core.Path;
+import org.wyona.yanel.core.Yanel;
 import org.wyona.yanel.core.map.Map;
 import org.wyona.yanel.core.map.Realm;
 import org.wyona.yanel.core.map.RealmConfiguration;
@@ -45,7 +46,7 @@
     public MapImpl() {
         try {
             // NOTE: Separate ResourceTypeIdentifier mapping from whatever else is using yarep ...
-            repoFactory = new RepositoryFactory("yanel-rti-yarep.properties");
+            repoFactory = Yanel.getInstance().getRepositoryFactory("RTIRepositoryFactory");
             //repoFactory = new RepositoryFactory();
 
             realmConfig = new RealmConfiguration();

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	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/resources/directory/src/java/org/wyona/yanel/impl/resources/DirectoryResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -72,7 +72,7 @@
         Repository contentRepo = null;
         try {
             RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path
-                    .toString()), new RepositoryFactory());
+                    .toString()), getRepositoryFactory());
             contentRepo = rp.getRepo();
             org.wyona.yarep.core.Path p = rp.getPath();
 
@@ -174,7 +174,7 @@
             // TODO: Get yanel RTI yarep properties file name from framework
             // resp. use MapFactory ...!
             RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path
-                    .toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+                    .toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(
                     new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
 
@@ -202,7 +202,7 @@
             // TODO: Get yanel RTI yarep properties file name from framework
             // resp. use MapFactory ...!
             RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path
-                    .toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+                    .toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(
                     new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
 
@@ -221,4 +221,10 @@
         // NOTE: Assuming fallback re dir2xhtml.xsl ...
         return "application/xhtml+xml";
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
+
 }

Modified: public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java
===================================================================
--- public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/resources/file/src/java/org/wyona/yanel/impl/resources/FileResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -62,7 +62,8 @@
      */
     public View getView(Path path, String viewId) throws Exception {
         View defaultView = new View();
-            org.wyona.yarep.util.RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+        
+            org.wyona.yarep.util.RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             defaultView.setInputStream(rp.getRepo().getInputStream(new org.wyona.yarep.core.Path(rp.getPath().toString())));
 
             defaultView.setMimeType(getMimeType(path, viewId));
@@ -77,7 +78,7 @@
         String mimeType = null;
         try {
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory ...!
-            org.wyona.yarep.util.RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+            org.wyona.yarep.util.RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
             br.readLine();
             mimeType = br.readLine();
@@ -151,7 +152,7 @@
      *
      */
     public Reader getReader(Path path) throws Exception {
-        org.wyona.yarep.util.RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+        org.wyona.yarep.util.RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
         return rp.getRepo().getReader(new org.wyona.yarep.core.Path(rp.getPath().toString()));
     }
 
@@ -160,7 +161,7 @@
      */
     public InputStream getInputStream(Path path) throws Exception {
         // Reuse stuff from getReader ...
-        org.wyona.yarep.util.RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+        org.wyona.yarep.util.RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
         return rp.getRepo().getInputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
     }
 
@@ -193,7 +194,7 @@
      */
     public OutputStream getOutputStream(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getOutputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -215,7 +216,7 @@
      */
     public long getLastModified(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getLastModified(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -229,11 +230,16 @@
      */
     public boolean delete(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().delete(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
             return false;
         }
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }    
+    
 }

Modified: public/yanel/trunk/src/resources/odt/src/java/org/wyona/yanel/impl/resources/ODTResource.java
===================================================================
--- public/yanel/trunk/src/resources/odt/src/java/org/wyona/yanel/impl/resources/ODTResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/resources/odt/src/java/org/wyona/yanel/impl/resources/ODTResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -74,7 +74,7 @@
         defaultView.setMimeType(mimeType);
 
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
 
             if (mimeType.equals("application/xml")) {
                 defaultView.setInputStream(getContentXML(rp));
@@ -123,7 +123,7 @@
         String mimeType = null;
         try {
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory ...!
-            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
             br.readLine();
             mimeType = br.readLine();
@@ -170,7 +170,7 @@
      */
     public Reader getReader(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getReader(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -207,11 +207,17 @@
      */
     public OutputStream getOutputStream(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getOutputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
         }
         return null;
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
+
 }

Modified: public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
===================================================================
--- public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2006-11-23 18:33:52 UTC (rev 20282)
+++ public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2006-11-23 18:40:25 UTC (rev 20283)
@@ -83,7 +83,7 @@
         Path xsltPath = getXSLTPath(path);
 
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
 
 	    if (xsltPath != null) {
                 TransformerFactory tf = TransformerFactory.newInstance();
@@ -175,7 +175,7 @@
      *
      */
     public Reader getReader(Path path) throws Exception {
-        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
         return rp.getRepo().getReader(new org.wyona.yarep.core.Path(rp.getPath().toString()));
     }
 
@@ -184,7 +184,7 @@
      */
     public InputStream getInputStream(Path path) throws Exception {
         // TODO: Reuse stuff from getReader ...
-        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+        RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
         return rp.getRepo().getInputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
     }
 
@@ -217,7 +217,7 @@
      */
     public OutputStream getOutputStream(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getOutputStream(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -239,7 +239,7 @@
      */
     public long getLastModified(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().getLastModified(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -282,7 +282,7 @@
      */
     public boolean delete(Path path) {
         try {
-            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory());
+            RepoPath rp = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), getRepositoryFactory());
             return rp.getRepo().delete(new org.wyona.yarep.core.Path(rp.getPath().toString()));
         } catch(Exception e) {
             log.error(e);
@@ -297,7 +297,7 @@
         String property = null;
         try {
             // TODO: Get yanel RTI yarep properties file name from framework resp. use MapFactory ...!
-            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), new RepositoryFactory("yanel-rti-yarep.properties"));
+            RepoPath rpRTI = new org.wyona.yarep.util.YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), yanel.getRepositoryFactory("RTIRepositoryFactory"));
             java.io.BufferedReader br = new java.io.BufferedReader(rpRTI.getRepo().getReader(new org.wyona.yarep.core.Path(new Path(rpRTI.getPath().toString()).getRTIPath().toString())));
 
             while ((property = br.readLine()) != null) {
@@ -313,4 +313,9 @@
 
         return property;
     }
+    
+    protected RepositoryFactory getRepositoryFactory() {
+        return yanel.getRepositoryFactory("DefaultRepositoryFactory");
+    }
+    
 }




More information about the Yanel-commits mailing list