You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by es...@apache.org on 2007/08/21 04:28:40 UTC

svn commit: r567913 - /portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentInformationProviderImpl.java

Author: esm
Date: Mon Aug 20 19:28:39 2007
New Revision: 567913

URL: http://svn.apache.org/viewvc?rev=567913&view=rev
Log:
Removed log statements
Some code reformatting
Resolved persistence directory based on class path.
Resolve the castor mapping file using the class path.


Modified:
    portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentInformationProviderImpl.java

Modified: portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentInformationProviderImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentInformationProviderImpl.java?rev=567913&r1=567912&r2=567913&view=diff
==============================================================================
--- portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentInformationProviderImpl.java (original)
+++ portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentInformationProviderImpl.java Mon Aug 20 19:28:39 2007
@@ -64,7 +64,7 @@
 public class ProducerPersistentInformationProviderImpl
         implements ProducerPersistentInformationProvider {
     
-    private static final Log log =
+    private static final Log LOG =
             LogFactory.getLog(ProducerPersistentInformationProviderImpl.class);
     
     // sub directory for descriptions
@@ -115,7 +115,9 @@
     // it should end up looking soemthing like this:
     // c:/Program Files/Tomcat 4.0/webapps/WEB-INF/persistence
     // depending on the installation
-    private static String ROOT_DIR = null;
+    private static String ROOT_DIR = new File ( ProducerPersistentInformationProviderImpl.class.getResource( "/" ).getPath() ).getParent() + 
+        File.separator + "persistence";
+    //private static String ROOT_DIR = "persistence";
     
     // File extension of the portlet persistent file store files
     private static String FILE_EXTENSION = ".xml";
@@ -140,13 +142,7 @@
      * Private constructor
      */
     private ProducerPersistentInformationProviderImpl() {
-        
-        final String MN = "ProducerPersistentInformationProviderImpl";
-        
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strEnter(MN));
-        }
-        
+
         try {
             if (ROOT_DIR == null) {
                 // ROOT_DIR is static, so it only needs to be setup once for all
@@ -170,9 +166,6 @@
                     path = servletContext.getRealPath("/WEB-INF") + 
                             File.separator;
                     
-                    if (log.isDebugEnabled()) {
-                        log.debug("Curret path of servletContext: " + path);
-                    }
                     
                 } catch (Exception e) {
                     // ignore
@@ -191,9 +184,6 @@
             e.printStackTrace();
         }
         
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strExit(MN));
-        }
         
     }
     
@@ -239,6 +229,12 @@
         return mappingFile;
     }
     
+    public String getMappingFileFromClasspath( String mappingBaseName )
+    {
+        String mappingFile = new String( "/" + mappingBaseName + FILE_EXTENSION );
+        return this.getClass().getResource( mappingFile ).getPath();
+    }
+    
     
     
     /**
@@ -251,11 +247,6 @@
     public PersistentInformation getPersistentInformation(
             ServiceDescriptionList serviceDescriptionList) {
         
-        final String MN = "getPersistentInformation";
-        
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strEnter(MN));
-        }
         
         PersistentInformationXML persistentInfo = null;
         
@@ -279,10 +270,6 @@
             makeStoreSubDir(DESCRIPTIONS);
         }
         
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strExit(MN));
-        }
-        
         return persistentInfo;
     }
     
@@ -296,12 +283,6 @@
     public PersistentInformation getPersistentInformation(
             RegistrationList registrationList) {
         
-        final String MN = "getPersistentInformation";
-        
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strEnter(MN));
-        }
-        
         PersistentInformationXML persistentInfo = null;
         
         if (registrationList != null) {
@@ -318,10 +299,6 @@
             makeStoreSubDir(REGISTRIES);
         }
         
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strExit(MN));
-        }
-        
         return persistentInfo;
         
     }
@@ -336,12 +313,6 @@
     public PersistentInformation getPersistentInformation(
             ConsumerConfiguredPortletList cceList) {
         
-        final String MN = "getPersistentInformation";
-        
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strEnter(MN));
-        }
-        
         PersistentInformationXML persistentInfo = null;
         
         if (cceList != null) {
@@ -361,10 +332,6 @@
             
         }
         
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strExit(MN));
-        }
-        
         return persistentInfo;
         
     }
@@ -381,13 +348,7 @@
      * @return PersistentInformation
      */
     public PersistentInformation getPersistentInformation(
-            ConsumerPortletRegistrationList regList) {
-        
-        final String MN = "getPersistentInformation";
-        
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strEnter(MN));
-        }
+            ConsumerPortletRegistrationList regList) {                
         
         PersistentInformationXML persistentInfo = null;
         
@@ -403,10 +364,6 @@
             persistentInfo.setSeparator(SEPARATOR);
             regList.setPersistentInformation(persistentInfo);
             makeStoreSubDir(REGISTRIES);
-        }
-        
-        if (log.isDebugEnabled()) {
-            log.debug(Utility.strExit(MN));
         }
         
         return persistentInfo;