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 dl...@apache.org on 2006/05/10 18:46:30 UTC

svn commit: r405794 [1/2] - in /portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons: exception/ persistence/driver/ util/ ws/

Author: dlouzan
Date: Wed May 10 09:46:24 2006
New Revision: 405794

URL: http://svn.apache.org/viewcvs?rev=405794&view=rev
Log:
commons-logging integration

Modified:
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/messages.properties
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/persistence/driver/PersistentAccess.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/util/ParameterChecker.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/util/Utility.java
    portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/ws/WSFactoryFinder.java

Modified: portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java?rev=405794&r1=405793&r2=405794&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java (original)
+++ portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java Wed May 10 09:46:24 2006
@@ -57,6 +57,9 @@
     int CONSUMER_REGISTRY_FACTORY_NOT_FOUND  = 2003;
     int PERSISTENT_FACTORY_NOT_FOUND         = 2004;
     
+    // WS Factory
+    int WS_FACTORY_NOT_FOUND                 = 2005;
+    
     
     /************ Error Codes Provider ************/
     
@@ -86,7 +89,7 @@
     int CONSUMER_PROPERTY_FILE_NOT_FOUND     = 6000;
     int INSTANTIATION_OF_CONSUMER_ENV_FAILED = 6001;
     int COULD_NOT_ADD_REQUEST_PARAM          = 6002;
-    int MISSING_SERVCICE_DESC_PORT           = 6003;
+    int MISSING_SERVICE_DESC_PORT            = 6003;
     int INIT_OF_SERVICE_DESC_PORT_FAILED     = 6004;
     int INVALID_URL_OF_SERVICE_DESC_PORT     = 6005;
     int INIT_OF_REGISTRATION_PORT_FAILED     = 6006;

Modified: portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java?rev=405794&r1=405793&r2=405794&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java (original)
+++ portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java Wed May 10 09:46:24 2006
@@ -18,8 +18,8 @@
 import java.io.InputStream;
 import java.util.Properties;
 
-import org.apache.wsrp4j.commons.log.LogManager;
-import org.apache.wsrp4j.commons.log.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Holds all exception messages
@@ -28,30 +28,29 @@
  */
 public class Messages {
 
+    private static Log log = LogFactory.getLog(Messages.class);
+    
     /** defines the lowest message code for common messages */
     public static final int COMMON_LOWER_BOUND = 1000;
-
     /** defines the highest message code for common messages */
     public static final int COMMON_UPPER_BOUND = 1999;
 
     /** defines the lowest message code for producer messages */
     public static final int PRODUCER_LOWER_BOUND = 2000;
-
     /** defines the highest message code for producer messages */
     public static final int PRODUCER_UPPER_BOUND = 2999;
 
     /** defines the lowest message code for provider messages */
     public static final int PROVIDER_LOWER_BOUND = 3000;
-
     /** defines the highest message code for provider messages */
     public static final int PROVIDER_UPPER_BOUND = 3999;
 
     /** defines the lowest message code for consumer messages */
     public static final int CONSUMER_LOWER_BOUND = 6000;
-
     /** defines the highest message code for consumer messages */
     public static final int CONSUMER_UPPER_BOUND = 6999;
 
+
     private static final String FILE_MSG_PROPERTIES = 
             "org/apache/wsrp4j/commons/exception/messages.properties";
     private static final String MSG_EXCEPTION_ON_LOAD =
@@ -61,8 +60,6 @@
     private static final String METHOD_INIT = "<init>";
     private static final String METHOD_GET = "get()";
 
-    private static Logger logger = 
-            LogManager.getLogManager().getLogger(Messages.class);
     private static Properties msgMap = new Properties();
 
     /**
@@ -77,7 +74,9 @@
                     getResourceAsStream(FILE_MSG_PROPERTIES);
             msgMap.load(in);
         } catch (Exception e) {
-            logger.text(Logger.ERROR, METHOD_INIT, e, MSG_EXCEPTION_ON_LOAD);
+            if (log.isErrorEnabled()) {
+                log.error(MSG_EXCEPTION_ON_LOAD, e);
+            }
         }
     }
 
@@ -87,17 +86,15 @@
      * @return String representing a message
      */
     public static String get(int msgCode) {
-        String msg = (String)msgMap.get(new Integer(msgCode).toString());
+        String msg = (String) msgMap.get(new Integer(msgCode).toString());
         if (msg == null) {
             msg = MSG_NO_MSG_FOUND;
-            if (logger.isLogging(Logger.TRACE_LOW)) {
-                logger.text(
-                    Logger.TRACE_LOW,
-                    METHOD_GET,
-                    MSG_NO_MSG_FOUND_FOR + msgCode + " in " + 
+            if (log.isDebugEnabled()) {
+                log.debug(MSG_NO_MSG_FOUND_FOR + msgCode + " in " +
                         FILE_MSG_PROPERTIES + ".");
             }
         }
         return msg;
     }
+    
 }

Modified: portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java?rev=405794&r1=405793&r2=405794&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java (original)
+++ portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java Wed May 10 09:46:24 2006
@@ -27,27 +27,11 @@
     /**
      * Holds the message identifier - enables a  more comfortable error handling
      */
-    private int errCode = 0;
+    private int errorCode = 0;
 
-    private Throwable nestedThrowable;
-
-    /** exception is in the common range */
-    private static final int COMMON_EXCEPTION = 1;
-
-    /** exception is in the consumer range */
-    private static final int CONSUMER_EXCEPTION = 2;
-
-    /** exception is in the producer range */
-    private static final int PRODUCER_EXCEPTION = 4;
-
-    /** exception is in the provider range */
-    private static final int PROVIDER_EXCEPTION = 8;
-
-    /** type (range) of the exception */
-    private int exceptionRange = 0;
 
     /**
-     * Creates a new common excpetion. The message to be passed will be ignored
+     * Creates a new common exception. The message to be passed will be ignored
      * @param errorCode integer representing an error code
      */
     public WSRPException(int errorCode) {
@@ -61,8 +45,7 @@
      */
     public WSRPException(int errorCode, Throwable t) {
         super(Messages.get(errorCode), t);
-        errCode = errorCode;
-        nestedThrowable = t;
+        this.errorCode = errorCode;
     }
 
     /**
@@ -70,104 +53,44 @@
      * @return integer representing an error code
      */
     public int getErrorCode() {
-        return errCode;
+        return errorCode;
     }
-
-    /**
-     * Returns a nested Throwable
-     * @return Throwable if a nested Throwable exists or null
-     */
-    public Throwable getNestedThrowable() {
-        return nestedThrowable;
-    }
-
-    /**
-     * Returns  the exception as String
-     */
-    public String toString() {
-        StringBuffer s = new StringBuffer(this.getClass().getName());
-        s.append(": ");
-        s.append(getMessage());
-        if (nestedThrowable != null) {
-            s.append("\n\nNested Throwable is:\n");
-            s.append(nestedThrowable.toString());
-        }
-        return s.toString();
-    }
-
+    
     /**
      * Returns the Exception in the HTML string format. Nested
      * exceptions are included in the report.
-     * 
-     * @returns exception message formatted as HTML string
+     *
+     * @ returns exception message formatted as HTML string
      */
     public String toHTMLString() {
-
+        
         StringBuffer s = new StringBuffer();
-
-        s.append("<H2>Exception occured!</H2><br>");
-        s.append("<b>" + this.getClass().getName() + "</><br>");
-        s.append("   Message = " + getMessage() + "<br>");
-        s.append("   Type    = " + getExceptionRange() + "<br>");
-
-        if (this.nestedThrowable != null) {
-
-            Throwable t = nestedThrowable;
-            s.append("<H3>Exception stack:</H3>");
-
+        
+        s.append("<h2>Exception occured!</h2><br>");
+        s.append("<b>" + this.getClass().getName() + "</b><br>");
+        s.append("    Message = " + getMessage() + "<br>");
+        
+        if (getCause() != null) {
+            
+            Throwable t = getCause();
+            s.append("<h3>Exception stack:</h3>");
+            
             while (t != null) {
-                s.append("<br><b>" + t.getClass().getName() + "</><br>");
+                s.append("<br><b>" + t.getClass().getName() +
+                        "</b><br>");
                 if (t instanceof WSRPException) {
-                    s.append("   Message = " + 
-                            ((WSRPException)t).getMessage() + "<br>");
-                    s.append("   Type    = " + 
-                            ((WSRPException)t).getExceptionRange() + "<br>");
-                    t = ((WSRPException)t).getNestedThrowable();
+                    s.append("    Message = " +
+                            ((WSRPException) t).getMessage() + "<br>");
+                    t = ((WSRPException) t).getCause();
                 } else {
-                    s.append("   Message = " + t.getMessage() + "<br>");
+                    s.append("    Message = " + t.getMessage() + "<br>");
                     t = null;
                 }
             }
         }
-
+        
         return s.toString();
+        
     }
 
-    /**
-     * Returns the range identifier of this exception. E.g.
-     * Common, Consumer, Producer or Provider range. 
-     * 
-     * @return the exception range id
-     */
-    public int getExceptionRange() {
-        return exceptionRange;
-    }
-
-    /**
-     * Assign the exception to the common range
-     */
-    public void setCommonExceptionRange() {
-        exceptionRange = COMMON_EXCEPTION;
-    }
-
-    /**
-     * Assign the exception to the consumer range
-     */
-    public void setConsumerExceptionRange() {
-        exceptionRange = CONSUMER_EXCEPTION;
-    }
-
-    /**
-     * Assign the exception to the producer range
-     */
-    public void setProducerExceptionRange() {
-        exceptionRange = PRODUCER_EXCEPTION;
-    }
-
-    /**
-     * Assign the exception to the provider range
-     */
-    public void setProviderExceptionRange() {
-        exceptionRange = PROVIDER_EXCEPTION;
-    }
 }

Modified: portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java?rev=405794&r1=405793&r2=405794&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java (original)
+++ portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java Wed May 10 09:46:24 2006
@@ -21,6 +21,8 @@
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import java.rmi.RemoteException;
+
 import javax.xml.namespace.QName;
 
 import oasis.names.tc.wsrp.v1.types.AccessDeniedFault;
@@ -39,16 +41,18 @@
 import oasis.names.tc.wsrp.v1.types.UnsupportedModeFault;
 import oasis.names.tc.wsrp.v1.types.UnsupportedWindowStateFault;
 
-import org.apache.axis.AxisFault;
-import org.apache.axis.utils.XMLUtils;
-import org.apache.wsrp4j.commons.log.Logger;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.wsrp4j.commons.util.Constants;
+import org.apache.wsrp4j.commons.ws.WSFactory;
+import org.apache.wsrp4j.commons.ws.WSFactoryFinder;
 
 /**
- * Handles the throwing of exceptions. 
+ * Handles the throwing of exceptions.
  * Instead of calling <code> throw(new WSRPException("exception text")) </code>
  * simply type <code>ExceptionHelper throwX(1234)</code>
  * So the appropriate messages can be handled in a central place.
@@ -57,635 +61,309 @@
  * @version $Id$
  */
 public class WSRPXHelper {
-
-    private static final String EMPTY_STRING = "";
-
-    // the name of the .properties file
-    private static String EXCEPTION_MAPPING_FILE = 
+    
+    private static final Log log = LogFactory.getLog(WSRPXHelper.class);
+    
+    // the name of the .properties file which contains exception mappings
+    private static String EXCEPTION_MAPPING_FILE =
             "ExceptionMapping.properties";
+    private static final String MSG_EXCEPTION_MAPPING_ON_LOAD =
+            "Error while loading exception mappings from " +
+            EXCEPTION_MAPPING_FILE + ".";
     // the content of the .properties file
     private static HashMap exceptionMapping;
-
-    /**
-     * Throws a new exception with a specific message 
-     * identified by an error code without logging
-     * 
-     * @param errorCode integer specifying an error message
-     * @exception WSRPException
-     */
-    public static void throwX(int errorCode) throws WSRPException {
-        WSRPException e = getException(errorCode, null);
-        throw e;
+    
+    private static final String EMPTY_STRING = "";
+    
+    private static WSFactory wsFactory;
+    
+    
+    static {
+        //load properties file
+        try {
+            exceptionMapping = new HashMap();
+            
+            InputStream in = WSRPXHelper.class.getClassLoader().
+                    getResourceAsStream(EXCEPTION_MAPPING_FILE);
+            Properties props = new Properties();
+            props.load(in);
+            
+            // convert read Properties to a more useful representation
+            Enumeration keys = props.propertyNames();
+            StringTokenizer tokenizer = null;
+            
+            while (keys.hasMoreElements()) {
+                
+                String value = null;
+                String currentKey = (String) keys.nextElement();
+                exceptionMapping.put(currentKey, new Integer(currentKey));
+                
+                value = props.getProperty(currentKey);
+                if (value != null && value.length() > 0) {
+                    tokenizer = new StringTokenizer(value, ",");
+                    String token = null;
+                    
+                    while (tokenizer.hasMoreTokens()) {
+                        token = tokenizer.nextToken();
+                        
+                        if (token != null) {
+                            exceptionMapping.put(
+                                    token, new Integer(currentKey));
+                        }
+                        
+                    }
+                    
+                }
+            }
+            if (log.isInfoEnabled()) {
+                log.info("Loaded exception mappings from file: " +
+                        EXCEPTION_MAPPING_FILE);
+            }
+            
+            wsFactory = WSFactoryFinder.getFactory();
+            
+        } catch (Exception e) {
+            if (log.isErrorEnabled()) {
+                log.error(MSG_EXCEPTION_MAPPING_ON_LOAD, e);
+            }
+        }
     }
-
-    /**
-     * Throws a new exception with a specific message 
-     * identified by an error code without logging
-     * 
-     * @param errorCode integer specifying an error message
-     * @param t         the nested exception
-     * @exception WSRPException
-     */
-    public static void throwX(int errorCode, Throwable t) throws WSRPException {
-        WSRPException e = getException(errorCode, t);
+    
+    public static void throwX(int errorCode)
+    throws WSRPException {
+        
+        WSRPException e = new WSRPException(errorCode);
         throw e;
+        
     }
-
-    /**
-     * Throws a new exception with a specific message
-     * identified by an error code and logs the exception
-     * to a logger.
-     * 
-     * @param logger    an appropriate logger
-     * @param logLevel  requested logging level (ERROR,WARN,INFO,
-     *                  TRACE_LOW,
-     *                  TRACE_MEDIUM,
-     *                  TRACE_HIGH)
-     * @param method    the method in that an Exception is thrown
-     * @param errorCode integer specifying an error message
-     * @exception WSRPException
-     */
-    public static void throwX(Logger logger, int logLevel, String method, 
-            int errorCode)
+    
+    public static void throwX(Log extLog, int errorCode)
     throws WSRPException {
-        WSRPException e = getException(errorCode, null);
-        //log stack trace
-        if (logger != null) {
-            logger.text(logLevel, method, e, EMPTY_STRING);
-        }
+        
+        WSRPException e = new WSRPException(errorCode);
+        
+        extLog.error(EMPTY_STRING, e);
+        
         throw e;
+        
     }
-
-    /**
-     * Throws a new exception with a specific message
-     * identified by an error code and logs the exception
-     * to a logger.
-     * 
-     * @param logger    an appropriate logger
-     * @param logLevel  requested logging level (ERROR,WARN,INFO,
-     *                  TRACE_LOW,
-     *                  TRACE_MEDIUM,
-     *                  TRACE_HIGH)
-     * @param method    the method in that an Exception is thrown
-     * @param errorCode integer specifying an error message
-     * @param t         the nested exception
-     * @exception WSRPException
-     */
-    public static void throwX(Logger logger, int logLevel, String method, 
-            int errorCode, Throwable t)
+    
+    public static void throwX(Log extLog, int errorCode, Throwable t)
     throws WSRPException {
-        WSRPException e = getException(errorCode, t);
-        //log exception
-        if (logger != null) {
-            if (t instanceof WSRPException) {
-                //log NO trace
-                logger.text(logLevel, method, e.getMessage());
-            } else {
-                //log stack trace
-                logger.text(logLevel, method, e, EMPTY_STRING);
-            }
+        
+        WSRPException e = new WSRPException(errorCode, t);
+        
+        if (t instanceof WSRPException) {
+            extLog.error(e.getMessage());
+        } else {
+            extLog.error(EMPTY_STRING, e);
         }
+        
         throw e;
+        
     }
-
+    
+    
     /**
      * This method translates a WSRP exception into an
      * apropriate WSRP fault according to the error code
-     * 
+     *
      * @param exception the WSRPException to be translated
      * @exception java.rmi.RemoteException the translated fault
      */
     public static void handleWSRPException(WSRPException exception)
-    throws java.rmi.RemoteException {
-        if (exceptionMapping == null) {
-            loadExceptionMapping();
-        }
-
-        AxisFault fault = null;
-        int errorCode = ((Integer)exceptionMapping.get(
+    throws RemoteException {
+        
+        RemoteException fault = null;
+        int errorCode = ((Integer) exceptionMapping.get(
                 String.valueOf(exception.getErrorCode()))).intValue();
-
+        String parentNamespaceURI = Fault.getTypeDesc().getXmlType().
+                getNamespaceURI();
+        
         if (errorCode == ErrorCodes.ACCESS_DENIED) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.ACCESS_DENIED_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element = doc.createElementNS(
-                        AccessDeniedFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.ACCESS_DENIED_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = AccessDeniedFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.ACCESS_DENIED_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.INCONSISTENT_PARAMETERS) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.INCONSISTENT_PARAMETERS_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        InconsistentParametersFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.INCONSISTENT_PARAMETERS_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = InconsistentParametersFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.INCONSISTENT_PARAMETERS_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.INVALID_REGISTRATION) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.INVALID_REGISTRATION_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        InvalidRegistrationFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.INVALID_REGISTRATION_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = InvalidRegistrationFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.INVALID_REGISTRATION_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.INVALID_COOKIE) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.INVALID_COOKIE_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        InvalidCookieFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.INVALID_COOKIE_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = InvalidCookieFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.INVALID_COOKIE_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.INVALID_HANDLE) {
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.INVALID_HANDLE_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        InvalidHandleFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.INVALID_HANDLE_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+ 
+            String namespaceURI = InvalidHandleFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.INVALID_HANDLE_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.INVALID_SESSION) {
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.INVALID_SESSION_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        InvalidSessionFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.INVALID_SESSION_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
 
+            String namespaceURI = InvalidSessionFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.INVALID_SESSION_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.INVALID_USER_CATEGORY) {
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.INVALID_USER_CATEGORY_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        InvalidUserCategoryFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.INVALID_USER_CATEGORY_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
 
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
+            String namespaceURI = InvalidUserCategoryFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.INVALID_USER_CATEGORY_FAULT, exception);
 
         } else if (errorCode == ErrorCodes.MISSING_PARAMETERS) {
 
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.MISSING_PARAMETERS_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        MissingParametersFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.MISSING_PARAMETERS_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
+            String namespaceURI = MissingParametersFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.MISSING_PARAMETERS_FAULT, exception);
 
         } else if (errorCode == ErrorCodes.OPERATION_FAILED) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.OPERATION_FAILED_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        OperationFailedFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.OPERATION_FAILED_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
+        
+            String namespaceURI = OperationFailedFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.OPERATION_FAILED_FAULT, exception);
 
         } else if (errorCode == ErrorCodes.PORTLET_STATE_CHANGE_REQUIRED) {
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.PORTLET_STATE_CHANGE_REQUIRED_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        PortletStateChangeRequiredFault.getTypeDesc().
-                            getXmlType().getNamespaceURI(),
-                        Constants.PORTLET_STATE_CHANGE_REQUIRED_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = PortletStateChangeRequiredFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.PORTLET_STATE_CHANGE_REQUIRED_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.UNSUPPORTED_LOCALE) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.UNSUPPORTED_LOCALE_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        UnsupportedLocaleFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.UNSUPPORTED_LOCALE_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = UnsupportedLocaleFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.UNSUPPORTED_LOCALE_FAULT, exception);
+                        
         } else if (errorCode == ErrorCodes.UNSUPPORTED_MIME_TYPE) {
 
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.UNSUPPORTED_MIME_TYPE_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        UnsupportedMimeTypeFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-						Constants.UNSUPPORTED_MIME_TYPE_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            String namespaceURI = UnsupportedMimeTypeFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.UNSUPPORTED_MIME_TYPE_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.UNSUPPORTED_MODE) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.UNSUPPORTED_MODE_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        UnsupportedModeFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.UNSUPPORTED_MODE_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = UnsupportedModeFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.UNSUPPORTED_MODE_FAULT, exception);
+            
         } else if (errorCode == ErrorCodes.UNSUPPORTED_WINDOW_STATE) {
-
-            fault = new AxisFault();
-            QName qname = new QName(
-                    Fault.getTypeDesc().getXmlType().getNamespaceURI(),
-                    Constants.UNSUPPORTED_WINDOW_STATE_FAULT);
-            fault.setFaultCode(qname);
-            fault.setFaultString(exception.getMessage());
-
-            try {
-
-                Document doc = XMLUtils.newDocument();
-                Element element =
-                    doc.createElementNS(
-                        UnsupportedWindowStateFault.getTypeDesc().getXmlType().
-                            getNamespaceURI(),
-                        Constants.UNSUPPORTED_WINDOW_STATE_FAULT);
-                fault.clearFaultDetails();
-                fault.setFaultDetail(new Element[] { element });
-
-            } catch (Exception e) {
-
-                // do nothing and keep the fault details as serialized by axis 
-            }
-
+            
+            String namespaceURI = UnsupportedWindowStateFault.getTypeDesc().
+                    getXmlType().getNamespaceURI();
+            fault = wsFactory.getFault(parentNamespaceURI, namespaceURI,
+                    Constants.UNSUPPORTED_WINDOW_STATE_FAULT, exception);
+            
         } else {
-
-            throw new java.rmi.RemoteException();
-
+            throw new RemoteException();
         }
-
+        
         throw fault;
-
+        
     }
-
-    private static void loadExceptionMapping() {
-        try {
-            exceptionMapping = new HashMap();
-
-            // read in .properties-file
-            InputStream in = WSRPXHelper.class.getClassLoader().
-                    getResourceAsStream(EXCEPTION_MAPPING_FILE);
-            Properties props = new Properties();
-            props.load(in);
-
-            // convert read Properties to a more useful representation
-            Enumeration keys = props.propertyNames();
-            StringTokenizer tokenizer = null;
-
-            while (keys.hasMoreElements()) {
-
-                String value = null;
-                String currentKey = (String)keys.nextElement();
-                exceptionMapping.put(currentKey, new Integer(currentKey));
-
-                value = props.getProperty(currentKey);
-                if (value != null && value.length() > 0) {
-                    tokenizer = new StringTokenizer(value, ",");
-                    String token = null;
-
-                    while (tokenizer.hasMoreTokens()) {
-                        token = tokenizer.nextToken();
-
-                        if (token != null) {
-                            exceptionMapping.put(
-                                    token, new Integer(currentKey));
-                        }
-
-                    }
-
-                }
-            }
-
-        } catch (Exception e) {
-
-            // TODO
-            e.printStackTrace();
-
-        }
-
-    }
-
+    
     /**
-     * This method translates a WSRP fault into a WSRP 
+     * This method translates a WSRP fault into a WSRP
      * exception containing a corresponding error code
      * and logs the occurence of the exception
-     * 
+     *
      * @param logger the logger to be used
      * @param wsrpFault the fault to be translated
      * @exception WSRPException this is the translated exception
      */
-    public static void handleWSRPFault(Logger logger,
-            java.rmi.RemoteException wsrpFault)
+    public static void handleWSRPFault(Log extLog, RemoteException wsrpFault)
     throws WSRPException {
-
+        
+        int errorCode = 0;
+        
         if (wsrpFault instanceof AccessDeniedFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1100, wsrpFault);
-
+            
+            errorCode = ErrorCodes.ACCESS_DENIED;
+            
         } else if (wsrpFault instanceof InconsistentParametersFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1101, wsrpFault);
-
+            
+            errorCode = ErrorCodes.INCONSISTENT_PARAMETERS;
+            
         } else if (wsrpFault instanceof InvalidRegistrationFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1102, wsrpFault);
-
+            
+            errorCode = ErrorCodes.INVALID_REGISTRATION;
+            
         } else if (wsrpFault instanceof InvalidCookieFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1103, wsrpFault);
-
+            
+            errorCode = ErrorCodes.INVALID_COOKIE;
+            
         } else if (wsrpFault instanceof InvalidHandleFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1104, wsrpFault);
-
+            
+            errorCode = ErrorCodes.INVALID_HANDLE;
+            
         } else if (wsrpFault instanceof InvalidSessionFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1105, wsrpFault);
-
+            
+            errorCode = ErrorCodes.INVALID_SESSION;
+            
         } else if (wsrpFault instanceof InvalidUserCategoryFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1106, wsrpFault);
-
+            
+            errorCode = ErrorCodes.INVALID_USER_CATEGORY;
+            
         } else if (wsrpFault instanceof MissingParametersFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1107, wsrpFault);
-
+            
+            errorCode = ErrorCodes.MISSING_PARAMETERS;
+            
         } else if (wsrpFault instanceof OperationFailedFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1108, wsrpFault);
-
+            
+            errorCode = ErrorCodes.OPERATION_FAILED;
+            
         } else if (wsrpFault instanceof PortletStateChangeRequiredFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1109, wsrpFault);
-
+            
+            errorCode = ErrorCodes.PORTLET_STATE_CHANGE_REQUIRED;
+            
         } else if (wsrpFault instanceof UnsupportedLocaleFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1110, wsrpFault);
-
+            
+            errorCode = ErrorCodes.UNSUPPORTED_LOCALE;
+            
         } else if (wsrpFault instanceof UnsupportedMimeTypeFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1111, wsrpFault);
-
+            
+            errorCode = ErrorCodes.UNSUPPORTED_MIME_TYPE;
+            
         } else if (wsrpFault instanceof UnsupportedModeFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1112, wsrpFault);
-
+            
+            errorCode = ErrorCodes.UNSUPPORTED_MODE;
+            
         } else if (wsrpFault instanceof UnsupportedWindowStateFault) {
-
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1113, wsrpFault);
-
-        } else {
-
-            // its any other java.rmi.RemoteException
-            WSRPXHelper.throwX(
-                    logger, Logger.ERROR, EMPTY_STRING, 1116, wsrpFault);
-
-        }
-
-    }
-
-    /**
-     * Returns an Exception. The type of the Exception depends on the error 
-     * code that is passed to the method.
-     * @param errorCode integer specifying an error message
-     * @return Exception. The type depends on the error code
-     */
-    protected static WSRPException getException(int errorCode, Throwable t) {
-        WSRPException e = null;
-        if (errorCode >= Messages.PRODUCER_LOWER_BOUND &&
-            errorCode <= Messages.PRODUCER_UPPER_BOUND) {
-            e = new WSRPException(errorCode, t);
-            e.setProducerExceptionRange();
-        } else if (errorCode >= Messages.PROVIDER_LOWER_BOUND &&
-                   errorCode <= Messages.PROVIDER_UPPER_BOUND) {
-            e = new WSRPException(errorCode, t);
-            e.setProviderExceptionRange();
-        } else if (errorCode >= Messages.CONSUMER_LOWER_BOUND &&
-                   errorCode <= Messages.CONSUMER_UPPER_BOUND) {
-            e = new WSRPException(errorCode, t);
-            e.setConsumerExceptionRange();
-        } else if (errorCode >= Messages.COMMON_LOWER_BOUND &&
-                   errorCode <= Messages.COMMON_UPPER_BOUND) {
-            e = new WSRPException(errorCode, t);
-            e.setCommonExceptionRange();
+            
+            errorCode = ErrorCodes.UNSUPPORTED_WINDOW_STATE;
+            
         } else {
-            e = new WSRPException(errorCode, t);
+            
+            errorCode = ErrorCodes.INTERNAL_ERROR;
+            
         }
-        return e;
+        
+        WSRPXHelper.throwX(extLog, errorCode, wsrpFault);
+        
     }
+    
 }

Modified: portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/messages.properties
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/messages.properties?rev=405794&r1=405793&r2=405794&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/messages.properties (original)
+++ portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/exception/messages.properties Wed May 10 09:46:24 2006
@@ -19,6 +19,7 @@
 # Remember ranges:
 #
 # 1000 - 1999 common messages
+#
 # 2000 - 2999 producer messages
 # 3000 - 3999 provider messages
 #
@@ -50,7 +51,8 @@
 1111=The portlet does not support generating markup for the requested mimeType.
 1112=The portlet does not support generating markup for the requested mode.
 1113=The portlet does not support generating markup for the requested window state.
-1116=Unknown Exception.
+
+1200=Internal Error.
 
 ###############################################################################
 # producer messages 2000-2999
@@ -61,6 +63,8 @@
 2003=ConsumerRegistry-factory not found.
 2004=Persistent-factory not found.
 
+2005=Error instantiating 'wsrp4j.ws.factory' implementation class.
+
 ###############################################################################
 # provider messages 3000-3999
 ###############################################################################
@@ -76,6 +80,10 @@
 
 # Portlet Pool
 3020=Could not find portlet with the given portlet handle.
+
+# Portlet Invoker
+3030=Portlet Invoker service class not found.
+3031=Portlet Invoker instantiation failed.
 
 # URL-Composer
 3040=URL-Template provided by the consumer contains an unknown replace-token.

Modified: portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/persistence/driver/PersistentAccess.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/persistence/driver/PersistentAccess.java?rev=405794&r1=405793&r2=405794&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/persistence/driver/PersistentAccess.java (original)
+++ portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/persistence/driver/PersistentAccess.java Wed May 10 09:46:24 2006
@@ -18,11 +18,13 @@
 import java.io.InputStream;
 import java.util.Properties;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.wsrp4j.commons.exception.ErrorCodes;
 import org.apache.wsrp4j.commons.exception.WSRPException;
 import org.apache.wsrp4j.commons.exception.WSRPXHelper;
-import org.apache.wsrp4j.commons.log.LogManager;
-import org.apache.wsrp4j.commons.log.Logger;
+
 import org.apache.wsrp4j.commons.persistence.ConsumerPersistentFactory;
 import org.apache.wsrp4j.commons.persistence.ProducerPersistentFactory;
 import org.apache.wsrp4j.commons.persistence.ProxyPersistentFactory;
@@ -35,6 +37,8 @@
  * @version $Id$
  */
 public class PersistentAccess {
+    
+    private static Log log = LogFactory.getLog(PersistentAccess.class);
 
     // the name of the .properties file for the server
     private static String PRODUCER_PROPERTIES = "WSRPServices.properties";
@@ -63,7 +67,6 @@
 
     private static ProxyPersistentFactory proxyPersistentFactory;
     // log and trace support
-    private static Logger logger = LogManager.getLogManager().getLogger(getThisClass());
 
     /**
      * Fetches a server factory-instance.
@@ -71,22 +74,20 @@
      * @return ProducerPersistentFactory
      * @throws WSRPException
      */
-    public static ProducerPersistentFactory getProducerPersistentFactory() throws WSRPException {
-        String MN = "getProducerPersistentFactory";
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.entry(Logger.TRACE_HIGH, MN);
-        }
+    public static ProducerPersistentFactory getProducerPersistentFactory() 
+    throws WSRPException {
 
         if (producerPersistentFactory == null) {
             producerPersistentFactory = (ProducerPersistentFactory) getFactory(
                     PRODUCER_PERSISTENT_FACTORY, PRODUCER_PROPERTIES);
         }
-
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.exit(Logger.TRACE_HIGH, MN);
+        
+        if (log.isDebugEnabled()) {
+            log.debug("Loaded ProducerPersistentFactory");
         }
 
         return producerPersistentFactory;
+        
     }
 
     /**
@@ -95,39 +96,33 @@
      * @return ConsumerPersistentFactory
      * @throws WSRPException
      */
-    public static ConsumerPersistentFactory getConsumerPersistentFactory() throws WSRPException {
-        String MN = "getConsumerPersistentFactory";
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.entry(Logger.TRACE_HIGH, MN);
-        }
+    public static ConsumerPersistentFactory getConsumerPersistentFactory()
+    throws WSRPException {
 
         if (consumerPersistentFactory == null) {
             consumerPersistentFactory = (ConsumerPersistentFactory) getFactory(
                     CONSUMER_PERSISTENT_FACTORY, CONSUMER_PROPERTIES);
         }
 
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.exit(Logger.TRACE_HIGH, MN);
+        if (log.isDebugEnabled()) {
+            log.debug("Loaded ConsumerPersistentFactory");
         }
 
         return consumerPersistentFactory;
     }
     
-    public static ProxyPersistentFactory getProxyPersistentFactory() throws WSRPException {
-        String MN = "getProxyPersistentFactory";
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.entry(Logger.TRACE_HIGH, MN);
-        }
+    public static ProxyPersistentFactory getProxyPersistentFactory()
+    throws WSRPException {
 
         if (proxyPersistentFactory == null) {
             proxyPersistentFactory = (ProxyPersistentFactory) getFactory(
                     PROXY_PERSISTENT_FACTORY, PROXY_PROPERTIES);
         }
 
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.exit(Logger.TRACE_HIGH, MN);
+        if (log.isDebugEnabled()) {
+            log.debug("Loaded ProxyPersistentFactory");
         }
-
+        
         return proxyPersistentFactory;
     }
 
@@ -140,11 +135,8 @@
      *            name of the property file as string value
      * @throws WSRPException
      */
-    private static Object getFactory(String type, String propertyFile) throws WSRPException {
-        String MN = "getFactory";
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.entry(Logger.TRACE_HIGH, MN);
-        }
+    private static Object getFactory(String type, String propertyFile) 
+    throws WSRPException {
 
         Object obj = null;
 
@@ -155,14 +147,14 @@
 
             Class cl = Class.forName(factoryName);
 
-            if (logger.isLogging(Logger.TRACE_HIGH)) {
-                logger.exit(Logger.TRACE_HIGH, MN);
+            if (log.isDebugEnabled()) {
+                log.debug("Successfully loaded factory: " + factoryName);
             }
 
             obj = cl.newInstance();
 
         } catch (Exception e) {
-            WSRPXHelper.throwX(logger, Logger.ERROR, MN, ErrorCodes.PERSISTENT_FACTORY_NOT_FOUND);
+            WSRPXHelper.throwX(log, ErrorCodes.PERSISTENT_FACTORY_NOT_FOUND, e);
         }
 
         return obj;
@@ -176,21 +168,21 @@
      *            name of the property file as string value
      * @throws WSRPException
      */
-    private static void loadPropertyFile(String propertyFile) throws WSRPException {
-
-        String MN = "loadPropertyFile";
-        if (logger.isLogging(Logger.TRACE_HIGH)) {
-            logger.entry(Logger.TRACE_HIGH, MN);
-        }
+    private static void loadPropertyFile(String propertyFile) 
+    throws WSRPException {
 
         try {
             // read in .properties-file
             InputStream in = getThisClass().getClassLoader().getResourceAsStream(propertyFile);
             pFactories = new Properties();
             pFactories.load(in);
+            
+            if (log.isDebugEnabled()) {
+                log.debug("Successfully loaded property file: " + propertyFile);
+            }
 
         } catch (Exception e) {
-            WSRPXHelper.throwX(logger, Logger.ERROR, MN, ErrorCodes.PROPERTY_FILE_NOT_FOUND);
+            WSRPXHelper.throwX(log, ErrorCodes.PROPERTY_FILE_NOT_FOUND, e);
         }
     }
 

Modified: portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java?rev=405794&r1=405793&r2=405794&view=diff
==============================================================================
--- portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java (original)
+++ portals/wsrp4j/trunk/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java Wed May 10 09:46:24 2006
@@ -73,58 +73,58 @@
     
     // fault names as they appear on the wire
     public static final String ACCESS_DENIED_FAULT = "AccessDenied";
-	public static final String INCONSISTENT_PARAMETERS_FAULT = 
+    public static final String INCONSISTENT_PARAMETERS_FAULT = 
             "InconsistenParameters";
-	public static final String INVALID_REGISTRATION_FAULT = 
+    public static final String INVALID_REGISTRATION_FAULT = 
             "InvalidRegistration";
-	public static final String INVALID_COOKIE_FAULT = "InvalidCookie";
-	public static final String INVALID_HANDLE_FAULT = "InvalidHandle";
-	public static final String INVALID_SESSION_FAULT = "InvalidSession";
-	public static final String INVALID_USER_CATEGORY_FAULT = 
+    public static final String INVALID_COOKIE_FAULT = "InvalidCookie";
+    public static final String INVALID_HANDLE_FAULT = "InvalidHandle";
+    public static final String INVALID_SESSION_FAULT = "InvalidSession";
+    public static final String INVALID_USER_CATEGORY_FAULT = 
             "InvalidUserCategory";
-	public static final String MISSING_PARAMETERS_FAULT = "MissingParameters";
-	public static final String OPERATION_FAILED_FAULT = "OperationFailed";
-	public static final String PORTLET_STATE_CHANGE_REQUIRED_FAULT = 
+    public static final String MISSING_PARAMETERS_FAULT = "MissingParameters";
+    public static final String OPERATION_FAILED_FAULT = "OperationFailed";
+    public static final String PORTLET_STATE_CHANGE_REQUIRED_FAULT = 
             "PortletStateChangeRequired";
-	public static final String UNSUPPORTED_LOCALE_FAULT = "UnsupportedLocale";
-	public static final String UNSUPPORTED_MIME_TYPE_FAULT = 
+    public static final String UNSUPPORTED_LOCALE_FAULT = "UnsupportedLocale";
+    public static final String UNSUPPORTED_MIME_TYPE_FAULT = 
             "UnsupportedMimeType";
-	public static final String UNSUPPORTED_MODE_FAULT = "UnsupportedMode";
-	public static final String UNSUPPORTED_WINDOW_STATE_FAULT = 
+    public static final String UNSUPPORTED_MODE_FAULT = "UnsupportedMode";
+    public static final String UNSUPPORTED_WINDOW_STATE_FAULT = 
             "UnsupportedWindowState";
 
-	private static final String[] knownParams =
-		new String[] {
-			Constants.NAVIGATIONAL_STATE,
-			Constants.INTERACTION_STATE,
-			Constants.PORTLET_MODE,
-			Constants.WINDOW_STATE,
-			Constants.URL,
-			Constants.FRAGMENT_ID,
-			Constants.SECURE_URL,
-			Constants.URL_TYPE,
-			Constants.PORTLET_HANDLE,
-			Constants.PORTLET_INSTANCE_KEY,
-			Constants.SESSION_ID,
-			Constants.USER_CONTEXT_KEY,
-			Constants.REWRITE_RESOURCE };
+    private static final String[] knownParams =
+        new String[] {
+            Constants.NAVIGATIONAL_STATE,
+            Constants.INTERACTION_STATE,
+            Constants.PORTLET_MODE,
+            Constants.WINDOW_STATE,
+            Constants.URL,
+            Constants.FRAGMENT_ID,
+            Constants.SECURE_URL,
+            Constants.URL_TYPE,
+            Constants.PORTLET_HANDLE,
+            Constants.PORTLET_INSTANCE_KEY,
+            Constants.SESSION_ID,
+            Constants.USER_CONTEXT_KEY,
+            Constants.REWRITE_RESOURCE };
 
-	public static boolean isWsrpURLParam(String param) {
-		if (!param.startsWith("wsrp-")) {
-			return false;
+    public static boolean isWsrpURLParam(String param) {
+        if (!param.startsWith("wsrp-")) {
+            return false;
         }
 
-		for (int i = 0; i < knownParams.length; i++) {
-			if (param.equalsIgnoreCase(knownParams[i])) {
-				return true;
+        for (int i = 0; i < knownParams.length; i++) {
+            if (param.equalsIgnoreCase(knownParams[i])) {
+                return true;
             }
         }
 
-		return false;
-	}
+        return false;
+    }
     
-	public static String[] getWsrpParameters(){
-		return knownParams;
-	}
+    public static String[] getWsrpParameters(){
+        return knownParams;
+    }
 
 }