[Yanel-commits] rev 20293 - public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map

josias at wyona.com josias at wyona.com
Fri Nov 24 09:31:09 CET 2006


Author: josias
Date: 2006-11-24 09:31:07 +0100 (Fri, 24 Nov 2006)
New Revision: 20293

Modified:
   public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapImpl.java
Log:
don't call Yanel.getInstance() in the constructor of MapImpl to prevent StackOverflowError.

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-24 08:26:48 UTC (rev 20292)
+++ public/yanel/trunk/src/impl/java/org/wyona/yanel/impl/map/MapImpl.java	2006-11-24 08:31:07 UTC (rev 20293)
@@ -37,7 +37,6 @@
 
     private static Category log = Category.getInstance(MapImpl.class);
 
-    RepositoryFactory repoFactory;
     RealmConfiguration realmConfig;
 
     /**
@@ -46,14 +45,17 @@
     public MapImpl() {
         try {
             // NOTE: Separate ResourceTypeIdentifier mapping from whatever else is using yarep ...
-            repoFactory = Yanel.getInstance().getRepositoryFactory("RTIRepositoryFactory");
-            //repoFactory = new RepositoryFactory();
 
             realmConfig = new RealmConfiguration();
         } catch(Exception e) {
             log.error(e.getMessage(), e);
         }
     }
+    
+    protected RepositoryFactory getRepositoryFactory() throws Exception {
+        return Yanel.getInstance().getRepositoryFactory("RTIRepositoryFactory");
+        //repoFactory = new RepositoryFactory();
+    }
 
     /**
      *
@@ -68,7 +70,7 @@
     public String getResourceTypeIdentifier(Path path) {
         log.debug("Original path: " + path);
         try {
-            RepoPath rp = new YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()),repoFactory);
+            RepoPath rp = new YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()),getRepositoryFactory());
             Repository repo = rp.getRepo();
             log.debug("Repo Name: " + repo.getName());
             log.debug("New path: " + rp.getPath());
@@ -91,6 +93,7 @@
      */
     public Realm[] getRealms() {
         try {
+            RepositoryFactory repoFactory = getRepositoryFactory();
             String[] repoIds = repoFactory.getRepositoryIDs();
             Repository root = repoFactory.firstRepository();
             Realm[] realms = new Realm[repoIds.length];
@@ -120,6 +123,7 @@
      */
     public Realm getRealm(Path path) {
         try {
+            RepositoryFactory repoFactory = getRepositoryFactory();
             RepoPath rp = new YarepUtil().getRepositoryPath(new org.wyona.yarep.core.Path(path.toString()), repoFactory);
             Realm realm = null;
             Repository root = repoFactory.firstRepository();




More information about the Yanel-commits mailing list