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 cz...@apache.org on 2006/02/03 13:08:08 UTC
svn commit: r374648 [1/2] - in /portals/wsrp4j/trunk/sandbox/wsrp4j:
commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/
commons/ commons/src/java/org/apache/wsrp4j/commons/exception/
commons/src/java/org/apache/wsrp4j/commons...
Author: cziegeler
Date: Fri Feb 3 04:06:44 2006
New Revision: 374648
URL: http://svn.apache.org/viewcvs?rev=374648&view=rev
Log:
Apply changes from trunk and format code of commons
Modified:
portals/wsrp4j/trunk/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/URLComposerImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/project.xml
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LogManager.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/Logger.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LoggerImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/ClientPersistentFactory.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentDataObject.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentFactory.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentHandler.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentInformation.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/PersistentInformationProvider.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/ServerPersistentFactory.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/driver/PersistentAccess.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/driver/WSRPServiceDescription.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/AuthenticationInfoHelper.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Constants.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/HandleGenerator.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/HandleGeneratorFactory.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/LocaleHelper.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Modes.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/ParameterChecker.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/StateChangedEvent.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/StateChangedListener.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/StateChangedService.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/Utility.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/WindowStates.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorFactoryImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl/HandleGeneratorImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/util/impl/StateChangedServiceImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/consumer-swingconsumer/src/java/org/apache/wsrp4j/consumer/swingconsumer/driver/URLGeneratorImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/consumer/src/java/org/apache/wsrp4j/consumer/proxyportlet/impl/ResourceProxy.java
portals/wsrp4j/trunk/sandbox/wsrp4j/etc/artifact-versions.ent
portals/wsrp4j/trunk/sandbox/wsrp4j/producer/src/java/org/apache/wsrp4j/producer/provider/pluto/driver/DescriptionHandlerImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/producer/src/java/org/apache/wsrp4j/producer/provider/pluto/driver/DynamicInformationProviderImpl.java
portals/wsrp4j/trunk/sandbox/wsrp4j/producer/src/java/org/apache/wsrp4j/producer/provider/pluto/driver/ResourceURLProviderImpl.java
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/URLComposerImpl.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/URLComposerImpl.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/URLComposerImpl.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons-producer/src/java/org/apache/wsrp4j/commons/producer/provider/driver/URLComposerImpl.java Fri Feb 3 04:06:44 2006
@@ -17,7 +17,6 @@
package org.apache.wsrp4j.commons.producer.provider.driver;
import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
import oasis.names.tc.wsrp.v1.types.PortletContext;
import oasis.names.tc.wsrp.v1.types.RuntimeContext;
@@ -34,11 +33,12 @@
import org.apache.wsrp4j.commons.producer.provider.interfaces.URLComposer;
import org.apache.wsrp4j.commons.util.Constants;
+import org.apache.wsrp4j.commons.util.Utility;
/**
- * <p>This class implements the URLComposer interface providing methods to g
- * enerate URLs or namespace tokens.</p>
+ * <p>This class implements the URLComposer interface providing methods to generate
+ * URLs or namespace tokens.</p>
* <p>There are two kinds of methods:
* <ul>
* <li>Methods defining URLs or tokens to be rewritten by the consumer.</li>
@@ -424,7 +424,7 @@
resultURL.append(Constants.NEXT_PARAM_AMP);
try {
resultURL.append(appendNameValuePair(
- Constants.URL, URLEncoder.encode(url, "utf-8")));
+ Constants.URL, Utility.encode(url, "utf-8")));
} catch (UnsupportedEncodingException uee) {
// this should never happen
resultURL.append(appendNameValuePair(Constants.URL, url));
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/project.xml
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/project.xml?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/project.xml (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/project.xml Fri Feb 3 04:06:44 2006
@@ -78,6 +78,11 @@
<groupId>junit</groupId>
<version>&junit-version;</version>
</dependency>
+ <dependency>
+ <artifactId>commons-lang</artifactId>
+ <groupId>commons-lang</groupId>
+ <version>&commons-lang-version;</version>
+ </dependency>
</dependencies>
<reports>
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/ErrorCodes.java Fri Feb 3 04:06:44 2006
@@ -13,92 +13,88 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.exception;
-
-/*
+/**
* @version $Id$
*/
-public interface ErrorCodes
-{
+public interface ErrorCodes {
// Persistence
- public static final int STORE_OBJECT_ERROR = 1000;
- public static final int RESTORE_OBJECT_ERROR = 1001;
- public static final int DELETE_OBJECT_ERROR = 1002;
- public static final int UNMARSHAL_ERROR = 1003;
- public static final int MARSHAL_ERROR = 1004;
+ int STORE_OBJECT_ERROR = 1000;
+ int RESTORE_OBJECT_ERROR = 1001;
+ int DELETE_OBJECT_ERROR = 1002;
+ int UNMARSHAL_ERROR = 1003;
+ int MARSHAL_ERROR = 1004;
// Faults defined by the WSRP Specification
- public static final int ACCESS_DENIED = 1100;
- public static final int INCONSISTENT_PARAMETERS = 1101;
- public static final int INVALID_REGISTRATION = 1102;
- public static final int INVALID_COOKIE = 1103;
- public static final int INVALID_HANDLE = 1104;
- public static final int INVALID_SESSION = 1105;
- public static final int INVALID_USER_CATEGORY = 1106;
- public static final int MISSING_PARAMETERS = 1107;
- public static final int OPERATION_FAILED = 1108;
- public static final int PORTLET_STATE_CHANGE_REQUIRED = 1109;
- public static final int UNSUPPORTED_LOCALE = 1110;
- public static final int UNSUPPORTED_MIME_TYPE = 1111;
- public static final int UNSUPPORTED_MODE = 1112;
- public static final int UNSUPPORTED_WINDOW_STATE = 1113;
+ int ACCESS_DENIED = 1100;
+ int INCONSISTENT_PARAMETERS = 1101;
+ int INVALID_REGISTRATION = 1102;
+ int INVALID_COOKIE = 1103;
+ int INVALID_HANDLE = 1104;
+ int INVALID_SESSION = 1105;
+ int INVALID_USER_CATEGORY = 1106;
+ int MISSING_PARAMETERS = 1107;
+ int OPERATION_FAILED = 1108;
+ int PORTLET_STATE_CHANGE_REQUIRED = 1109;
+ int UNSUPPORTED_LOCALE = 1110;
+ int UNSUPPORTED_MIME_TYPE = 1111;
+ int UNSUPPORTED_MODE = 1112;
+ int UNSUPPORTED_WINDOW_STATE = 1113;
// Error Codes Producer
// Access to factories
- public static final int PROVIDER_FACTORY_NOT_FOUND = 2001;
- public static final int PROPERTY_FILE_NOT_FOUND = 2002;
- public static final int CONSUMER_REGISTRY_FACTORY_NOT_FOUND = 2003;
- public static final int PERSISTENT_FACTORY_NOT_FOUND = 2004;
+ int PROVIDER_FACTORY_NOT_FOUND = 2001;
+ int PROPERTY_FILE_NOT_FOUND = 2002;
+ int CONSUMER_REGISTRY_FACTORY_NOT_FOUND = 2003;
+ int PERSISTENT_FACTORY_NOT_FOUND = 2004;
// Description Handler
- public static final int SAVE_SERVICEDESCRIPTION_FAILED = 3000;
- public static final int LOAD_SERVICEDESCRIPTION_FAILED = 3001;
- public static final int MISSING_DEFAULT_LOCALE = 3002;
- public static final int MISSING_DEFAULT_LANGUAGE = 3003;
- public static final int NO_PORTLETDESCRIPTIONS_FOUND = 3004;
- public static final int MISSING_PORTLET_DEFINITION = 3005;
- public static final int PORTLET_PORTLET_NOT_FOUND = 3006;
+ int SAVE_SERVICEDESCRIPTION_FAILED = 3000;
+ int LOAD_SERVICEDESCRIPTION_FAILED = 3001;
+ int MISSING_DEFAULT_LOCALE = 3002;
+ int MISSING_DEFAULT_LANGUAGE = 3003;
+ int NO_PORTLETDESCRIPTIONS_FOUND = 3004;
+ int MISSING_PORTLET_DEFINITION = 3005;
+ int PORTLET_PORTLET_NOT_FOUND = 3006;
// Portlet Pool
- public static final int GET_PORTLET_FAILED = 3020;
+ int GET_PORTLET_FAILED = 3020;
// Portlet Invoker
public final static int SERVICE_CLASS_NOT_FOUND = 3030;
public final static int INSTANTIATION_OF_SERVICE_FAILED = 3031;
// URL Composer
- public static final int UNKNOWN_TOKEN_IN_TEMPLATE = 3040;
- public static final int SYNTAX_ERROR_IN_TEMPLATE = 3041;
+ int UNKNOWN_TOKEN_IN_TEMPLATE = 3040;
+ int SYNTAX_ERROR_IN_TEMPLATE = 3041;
// Error Codes Consumer
- public static final int CONSUMER_PROPERTY_FILE_NOT_FOUND = 6000;
- public static final int INSTANTIATION_OF_CONSUMER_ENV_FAILED = 6001;
- public static final int COULD_NOT_ADD_REQUEST_PARAM = 6002;
- public static final int MISSING_SERVCICE_DESC_PORT = 6003;
- public static final int INIT_OF_SERVICE_DESC_PORT_FAILED = 6004;
- public static final int INVALID_URL_OF_SERVICE_DESC_PORT = 6005;
- public static final int INIT_OF_REGISTRATION_PORT_FAILED = 6006;
- public static final int INVALID_URL_OF_REGISTRATION_PORT = 6007;
- public static final int INVALID_LINK_WITHIN_MARKUP = 6008;
- public static final int NO_VALID_URL_TYPE_PARAM_FOUND = 6009;
- public static final int INVALID_PORTLET_HANDLE = 6010;
- public static final int INVALID_SERVICE_DESCRIPTION = 6011;
- public static final int COULD_NOT_FOLLOW_REDIRECT = 6012;
- public static final int PRODUCER_DOES_NOT_EXIST = 6013;
- public static final int INIT_OF_PORTLET_MGMT_PORT_FAILED = 6014;
- public static final int INVALID_URL_OF_PORTLET_MGMT_PORT = 6015;
- public static final int MISSING_MARKUP_PORT = 6016;
- public static final int INIT_OF_MARKUP_PORT_FAILED = 6017;
- public static final int INVALID_URL_OF_MARKUP_PORT = 6018;
- public static final int PORTLET_DESC_NOT_FOUND = 6019;
- public static final int USER_SESSION_NOT_FOUND = 6020;
- public static final int GROUP_SESSION_NOT_FOUND = 6021;
- public static final int PORTLET_SESSION_NOT_FOUND = 6022;
- public static final int WINDOWS_SESSION_NOT_FOUND = 6023;
-
+ 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 INIT_OF_SERVICE_DESC_PORT_FAILED = 6004;
+ int INVALID_URL_OF_SERVICE_DESC_PORT = 6005;
+ int INIT_OF_REGISTRATION_PORT_FAILED = 6006;
+ int INVALID_URL_OF_REGISTRATION_PORT = 6007;
+ int INVALID_LINK_WITHIN_MARKUP = 6008;
+ int NO_VALID_URL_TYPE_PARAM_FOUND = 6009;
+ int INVALID_PORTLET_HANDLE = 6010;
+ int INVALID_SERVICE_DESCRIPTION = 6011;
+ int COULD_NOT_FOLLOW_REDIRECT = 6012;
+ int PRODUCER_DOES_NOT_EXIST = 6013;
+ int INIT_OF_PORTLET_MGMT_PORT_FAILED = 6014;
+ int INVALID_URL_OF_PORTLET_MGMT_PORT = 6015;
+ int MISSING_MARKUP_PORT = 6016;
+ int INIT_OF_MARKUP_PORT_FAILED = 6017;
+ int INVALID_URL_OF_MARKUP_PORT = 6018;
+ int PORTLET_DESC_NOT_FOUND = 6019;
+ int USER_SESSION_NOT_FOUND = 6020;
+ int GROUP_SESSION_NOT_FOUND = 6021;
+ int PORTLET_SESSION_NOT_FOUND = 6022;
+ int WINDOWS_SESSION_NOT_FOUND = 6023;
}
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/Messages.java Fri Feb 3 04:06:44 2006
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.exception;
-
import java.io.InputStream;
import java.util.Properties;
@@ -27,9 +25,8 @@
* Holds all exception messages
*
* @version $Id$
-*/
-public class Messages
-{
+ */
+public class Messages {
/** defines the lowest message code for common messages */
public static final int COMMON_LOWER_BOUND = 1000;
@@ -69,38 +66,31 @@
private static Properties msgMap = new Properties();
/**
- Private constructor loads messages from <code>messages.properties</code>
+ * Private constructor loads messages from <code>messages.properties</code>
* file in
- <code>org.apache.wsrp4j.exception</code>
- */
- static
- {
-
+ * <code>org.apache.wsrp4j.exception</code>
+ */
+ static {
//load properties file
- try
- {
+ try {
InputStream in = Messages.class.getClassLoader().
getResourceAsStream(FILE_MSG_PROPERTIES);
msgMap.load(in);
- } catch (Exception e)
- {
+ } catch (Exception e) {
logger.text(Logger.ERROR, METHOD_INIT, e, MSG_EXCEPTION_ON_LOAD);
}
}
/**
- Returns an error message for a message code
- @param msgCode code that identifies a message
- @return String representing a message
- */
- public static String get(int msgCode)
- {
+ * Returns an error message for a message code
+ * @param msgCode code that identifies a message
+ * @return String representing a message
+ */
+ public static String get(int msgCode) {
String msg = (String)msgMap.get(new Integer(msgCode).toString());
- if (msg == null)
- {
+ if (msg == null) {
msg = MSG_NO_MSG_FOUND;
- if (logger.isLogging(Logger.TRACE_LOW))
- {
+ if (logger.isLogging(Logger.TRACE_LOW)) {
logger.text(
Logger.TRACE_LOW,
METHOD_GET,
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPException.java Fri Feb 3 04:06:44 2006
@@ -13,55 +13,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.exception;
+import org.apache.commons.lang.exception.NestableException;
/**
* Common Exception class within the WSRP environment
*
* @version $Id$
*/
-public class WSRPException extends Exception
-{
+public class WSRPException extends NestableException {
- /*
- Holds the message identifier - enables a more comfortable error handling
- */
+ /**
+ * Holds the message identifier - enables a more comfortable error handling
+ */
private int errCode = 0;
- private Throwable nestedThrowable = null;
+ private Throwable nestedThrowable;
- // exception is in the common range
+ /** exception is in the common range */
private static final int COMMON_EXCEPTION = 1;
- // exception is in the consumer range
+ /** exception is in the consumer range */
private static final int CONSUMER_EXCEPTION = 2;
- // exception is in the producer range
+ /** exception is in the producer range */
private static final int PRODUCER_EXCEPTION = 4;
- // exception is in the provider range
+ /** exception is in the provider range */
private static final int PROVIDER_EXCEPTION = 8;
- // type (range) of the exception
+ /** type (range) of the exception */
private int exceptionRange = 0;
- /*
- Creates a new common exception
- @deprecated
- */
- public WSRPException()
- {
- this(0, null);
- }
-
/**
- Creates a new common excpetion. The message to be passed will be ignored
- @param errorCode integer representing an error code
- */
- public WSRPException(int errorCode)
- {
+ * Creates a new common excpetion. The message to be passed will be ignored
+ * @param errorCode integer representing an error code
+ */
+ public WSRPException(int errorCode) {
this(errorCode, null);
}
@@ -70,42 +59,36 @@
@param errorCode integer representing an error code
@param t Throwable to be wrapped
*/
- public WSRPException(int errorCode, Throwable t)
- {
- //String message = Messages.get(errorCode);
- super(Messages.get(errorCode),t);
+ public WSRPException(int errorCode, Throwable t) {
+ super(Messages.get(errorCode), t);
errCode = errorCode;
nestedThrowable = t;
}
/**
- Returns an error code
- @return integer representing an error code
- */
- public int getErrorCode()
- {
+ * Returns an error code
+ * @return integer representing an error code
+ */
+ public int getErrorCode() {
return errCode;
}
/**
- Returns a nested Throwable
- @return Throwable if a nested Throwable exists or null
- */
- public Throwable getNestedThrowable()
- {
+ * 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()
- {
+ public String toString() {
StringBuffer s = new StringBuffer(this.getClass().getName());
s.append(": ");
s.append(getMessage());
- if (nestedThrowable != null)
- {
+ if (nestedThrowable != null) {
s.append("\n\nNested Throwable is:\n");
s.append(nestedThrowable.toString());
}
@@ -118,8 +101,7 @@
*
* @returns exception message formatted as HTML string
*/
- public String toHTMLString()
- {
+ public String toHTMLString() {
StringBuffer s = new StringBuffer();
@@ -128,24 +110,20 @@
s.append(" Message = " + getMessage() + "<br>");
s.append(" Type = " + getExceptionRange() + "<br>");
- if (this.nestedThrowable != null)
- {
+ if (this.nestedThrowable != null) {
Throwable t = nestedThrowable;
s.append("<H3>Exception stack:</H3>");
- while (t != null)
- {
+ while (t != null) {
s.append("<br><b>" + t.getClass().getName() + "</><br>");
- if (t instanceof WSRPException)
- {
+ if (t instanceof WSRPException) {
s.append(" Message = " +
((WSRPException)t).getMessage() + "<br>");
s.append(" Type = " +
((WSRPException)t).getExceptionRange() + "<br>");
t = ((WSRPException)t).getNestedThrowable();
- } else
- {
+ } else {
s.append(" Message = " + t.getMessage() + "<br>");
t = null;
}
@@ -161,45 +139,35 @@
*
* @return the exception range id
*/
- public int getExceptionRange()
- {
-
+ public int getExceptionRange() {
return exceptionRange;
}
/**
* Assign the exception to the common range
*/
- public void setCommonExceptionRange()
- {
-
+ public void setCommonExceptionRange() {
exceptionRange = COMMON_EXCEPTION;
}
/**
* Assign the exception to the consumer range
*/
- public void setConsumerExceptionRange()
- {
-
+ public void setConsumerExceptionRange() {
exceptionRange = CONSUMER_EXCEPTION;
}
/**
* Assign the exception to the producer range
*/
- public void setProducerExceptionRange()
- {
-
+ public void setProducerExceptionRange() {
exceptionRange = PRODUCER_EXCEPTION;
}
/**
* Assign the exception to the provider range
*/
- public void setProviderExceptionRange()
- {
-
+ public void setProviderExceptionRange() {
exceptionRange = PROVIDER_EXCEPTION;
}
}
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/exception/WSRPXHelper.java Fri Feb 3 04:06:44 2006
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.exception;
import java.io.InputStream;
@@ -57,8 +56,7 @@
*
* @version $Id$
*/
-public class WSRPXHelper
-{
+public class WSRPXHelper {
private static final String EMPTY_STRING = "";
@@ -75,8 +73,7 @@
* @param errorCode integer specifying an error message
* @exception WSRPException
*/
- public static void throwX(int errorCode) throws WSRPException
- {
+ public static void throwX(int errorCode) throws WSRPException {
WSRPException e = getException(errorCode, null);
throw e;
}
@@ -89,8 +86,7 @@
* @param t the nested exception
* @exception WSRPException
*/
- public static void throwX(int errorCode, Throwable t) throws WSRPException
- {
+ public static void throwX(int errorCode, Throwable t) throws WSRPException {
WSRPException e = getException(errorCode, t);
throw e;
}
@@ -111,12 +107,10 @@
*/
public static void throwX(Logger logger, int logLevel, String method,
int errorCode)
- throws WSRPException
- {
+ throws WSRPException {
WSRPException e = getException(errorCode, null);
//log stack trace
- if (logger != null)
- {
+ if (logger != null) {
logger.text(logLevel, method, e, EMPTY_STRING);
}
throw e;
@@ -139,18 +133,14 @@
*/
public static void throwX(Logger logger, int logLevel, String method,
int errorCode, Throwable t)
- throws WSRPException
- {
+ throws WSRPException {
WSRPException e = getException(errorCode, t);
//log exception
- if (logger != null)
- {
- if (t instanceof WSRPException)
- {
+ if (logger != null) {
+ if (t instanceof WSRPException) {
//log NO trace
logger.text(logLevel, method, e.getMessage());
- } else
- {
+ } else {
//log stack trace
logger.text(logLevel, method, e, EMPTY_STRING);
}
@@ -166,11 +156,8 @@
* @exception java.rmi.RemoteException the translated fault
*/
public static void handleWSRPException(WSRPException exception)
- throws java.rmi.RemoteException
- {
-
- if (exceptionMapping == null)
- {
+ throws java.rmi.RemoteException {
+ if (exceptionMapping == null) {
loadExceptionMapping();
}
@@ -178,8 +165,7 @@
int errorCode = ((Integer)exceptionMapping.get(
String.valueOf(exception.getErrorCode()))).intValue();
- if (errorCode == ErrorCodes.ACCESS_DENIED)
- {
+ if (errorCode == ErrorCodes.ACCESS_DENIED) {
fault = new AxisFault();
QName qname = new QName(
@@ -188,8 +174,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element = doc.createElementNS(
@@ -199,14 +184,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.INCONSISTENT_PARAMETERS)
- {
+ } else if (errorCode == ErrorCodes.INCONSISTENT_PARAMETERS) {
fault = new AxisFault();
QName qname = new QName(
@@ -215,8 +198,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -227,14 +209,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.INVALID_REGISTRATION)
- {
+ } else if (errorCode == ErrorCodes.INVALID_REGISTRATION) {
fault = new AxisFault();
QName qname = new QName(
@@ -243,8 +223,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -255,14 +234,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.INVALID_COOKIE)
- {
+ } else if (errorCode == ErrorCodes.INVALID_COOKIE) {
fault = new AxisFault();
QName qname = new QName(
@@ -271,8 +248,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -283,14 +259,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.INVALID_HANDLE)
- {
+ } else if (errorCode == ErrorCodes.INVALID_HANDLE) {
fault = new AxisFault();
QName qname = new QName(
Fault.getTypeDesc().getXmlType().getNamespaceURI(),
@@ -298,8 +272,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -310,14 +283,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.INVALID_SESSION)
- {
+ } else if (errorCode == ErrorCodes.INVALID_SESSION) {
fault = new AxisFault();
QName qname = new QName(
Fault.getTypeDesc().getXmlType().getNamespaceURI(),
@@ -325,8 +296,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -337,14 +307,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.INVALID_USER_CATEGORY)
- {
+ } else if (errorCode == ErrorCodes.INVALID_USER_CATEGORY) {
fault = new AxisFault();
QName qname = new QName(
Fault.getTypeDesc().getXmlType().getNamespaceURI(),
@@ -352,8 +320,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -364,14 +331,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.MISSING_PARAMETERS)
- {
+ } else if (errorCode == ErrorCodes.MISSING_PARAMETERS) {
fault = new AxisFault();
QName qname = new QName(
@@ -380,8 +345,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -392,14 +356,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.OPERATION_FAILED)
- {
+ } else if (errorCode == ErrorCodes.OPERATION_FAILED) {
fault = new AxisFault();
QName qname = new QName(
@@ -408,8 +370,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -420,14 +381,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.PORTLET_STATE_CHANGE_REQUIRED)
- {
+ } else if (errorCode == ErrorCodes.PORTLET_STATE_CHANGE_REQUIRED) {
fault = new AxisFault();
QName qname = new QName(
Fault.getTypeDesc().getXmlType().getNamespaceURI(),
@@ -435,9 +394,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
-
+ try {
Document doc = XMLUtils.newDocument();
Element element =
doc.createElementNS(
@@ -447,14 +404,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.UNSUPPORTED_LOCALE)
- {
+ } else if (errorCode == ErrorCodes.UNSUPPORTED_LOCALE) {
fault = new AxisFault();
QName qname = new QName(
@@ -463,8 +418,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -475,14 +429,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.UNSUPPORTED_MIME_TYPE)
- {
+ } else if (errorCode == ErrorCodes.UNSUPPORTED_MIME_TYPE) {
fault = new AxisFault();
QName qname = new QName(
@@ -491,8 +443,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -503,14 +454,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.UNSUPPORTED_MODE)
- {
+ } else if (errorCode == ErrorCodes.UNSUPPORTED_MODE) {
fault = new AxisFault();
QName qname = new QName(
@@ -519,8 +468,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -531,14 +479,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else if (errorCode == ErrorCodes.UNSUPPORTED_WINDOW_STATE)
- {
+ } else if (errorCode == ErrorCodes.UNSUPPORTED_WINDOW_STATE) {
fault = new AxisFault();
QName qname = new QName(
@@ -547,8 +493,7 @@
fault.setFaultCode(qname);
fault.setFaultString(exception.getMessage());
- try
- {
+ try {
Document doc = XMLUtils.newDocument();
Element element =
@@ -559,14 +504,12 @@
fault.clearFaultDetails();
fault.setFaultDetail(new Element[] { element });
- } catch (Exception e)
- {
+ } catch (Exception e) {
// do nothing and keep the fault details as serialized by axis
}
- } else
- {
+ } else {
throw new java.rmi.RemoteException();
@@ -576,10 +519,8 @@
}
- private static void loadExceptionMapping()
- {
- try
- {
+ private static void loadExceptionMapping() {
+ try {
exceptionMapping = new HashMap();
// read in .properties-file
@@ -592,25 +533,21 @@
Enumeration keys = props.propertyNames();
StringTokenizer tokenizer = null;
- while (keys.hasMoreElements())
- {
+ 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)
- {
+ if (value != null && value.length() > 0) {
tokenizer = new StringTokenizer(value, ",");
String token = null;
- while (tokenizer.hasMoreTokens())
- {
+ while (tokenizer.hasMoreTokens()) {
token = tokenizer.nextToken();
- if (token != null)
- {
+ if (token != null) {
exceptionMapping.put(
token, new Integer(currentKey));
}
@@ -620,8 +557,7 @@
}
}
- } catch (Exception e)
- {
+ } catch (Exception e) {
// TODO
e.printStackTrace();
@@ -641,95 +577,79 @@
*/
public static void handleWSRPFault(Logger logger,
java.rmi.RemoteException wsrpFault)
- throws WSRPException
- {
+ throws WSRPException {
- if (wsrpFault instanceof AccessDeniedFault)
- {
+ if (wsrpFault instanceof AccessDeniedFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1100, wsrpFault);
- } else if (wsrpFault instanceof InconsistentParametersFault)
- {
+ } else if (wsrpFault instanceof InconsistentParametersFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1101, wsrpFault);
- } else if (wsrpFault instanceof InvalidRegistrationFault)
- {
+ } else if (wsrpFault instanceof InvalidRegistrationFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1102, wsrpFault);
- } else if (wsrpFault instanceof InvalidCookieFault)
- {
+ } else if (wsrpFault instanceof InvalidCookieFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1103, wsrpFault);
- } else if (wsrpFault instanceof InvalidHandleFault)
- {
+ } else if (wsrpFault instanceof InvalidHandleFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1104, wsrpFault);
- } else if (wsrpFault instanceof InvalidSessionFault)
- {
+ } else if (wsrpFault instanceof InvalidSessionFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1105, wsrpFault);
- } else if (wsrpFault instanceof InvalidUserCategoryFault)
- {
+ } else if (wsrpFault instanceof InvalidUserCategoryFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1106, wsrpFault);
- } else if (wsrpFault instanceof MissingParametersFault)
- {
+ } else if (wsrpFault instanceof MissingParametersFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1107, wsrpFault);
- } else if (wsrpFault instanceof OperationFailedFault)
- {
+ } else if (wsrpFault instanceof OperationFailedFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1108, wsrpFault);
- } else if (wsrpFault instanceof PortletStateChangeRequiredFault)
- {
+ } else if (wsrpFault instanceof PortletStateChangeRequiredFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1109, wsrpFault);
- } else if (wsrpFault instanceof UnsupportedLocaleFault)
- {
+ } else if (wsrpFault instanceof UnsupportedLocaleFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1110, wsrpFault);
- } else if (wsrpFault instanceof UnsupportedMimeTypeFault)
- {
+ } else if (wsrpFault instanceof UnsupportedMimeTypeFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1111, wsrpFault);
- } else if (wsrpFault instanceof UnsupportedModeFault)
- {
+ } else if (wsrpFault instanceof UnsupportedModeFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1112, wsrpFault);
- } else if (wsrpFault instanceof UnsupportedWindowStateFault)
- {
+ } else if (wsrpFault instanceof UnsupportedWindowStateFault) {
WSRPXHelper.throwX(
logger, Logger.ERROR, EMPTY_STRING, 1113, wsrpFault);
- } else
- {
+ } else {
// its any other java.rmi.RemoteException
WSRPXHelper.throwX(
@@ -740,72 +660,31 @@
}
/**
- Returns an Exception. The type of the Exception depends on the error
+ * 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)
- {
+ * @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)
- {
- if (t == null)
- {
-
- e = new WSRPException(errorCode);
- } else
- {
- e = new WSRPException(errorCode, t);
- }
+ errorCode <= Messages.PRODUCER_UPPER_BOUND) {
+ e = new WSRPException(errorCode, t);
e.setProducerExceptionRange();
} else if (errorCode >= Messages.PROVIDER_LOWER_BOUND &&
- errorCode <= Messages.PROVIDER_UPPER_BOUND)
- {
- if (t == null)
- {
-
- e = new WSRPException(errorCode);
- } else
- {
- e = new WSRPException(errorCode, t);
- }
+ errorCode <= Messages.PROVIDER_UPPER_BOUND) {
+ e = new WSRPException(errorCode, t);
e.setProviderExceptionRange();
} else if (errorCode >= Messages.CONSUMER_LOWER_BOUND &&
- errorCode <= Messages.CONSUMER_UPPER_BOUND)
- {
- if (t == null)
- {
-
- e = new WSRPException(errorCode);
- } else
- {
- e = new WSRPException(errorCode, t);
- }
+ errorCode <= Messages.CONSUMER_UPPER_BOUND) {
+ e = new WSRPException(errorCode, t);
e.setConsumerExceptionRange();
} else if (errorCode >= Messages.COMMON_LOWER_BOUND &&
- errorCode <= Messages.COMMON_UPPER_BOUND)
- {
- if (t == null)
- {
-
- e = new WSRPException(errorCode);
- } else
- {
- e = new WSRPException(errorCode, t);
- }
+ errorCode <= Messages.COMMON_UPPER_BOUND) {
+ e = new WSRPException(errorCode, t);
e.setCommonExceptionRange();
- } else
- {
- if (t == null)
- {
-
- e = new WSRPException(errorCode);
- } else
- {
- e = new WSRPException(errorCode, t);
- }
+ } else {
+ e = new WSRPException(errorCode, t);
}
return e;
}
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LogManager.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LogManager.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LogManager.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LogManager.java Fri Feb 3 04:06:44 2006
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.log;
import java.io.InputStream;
@@ -23,8 +22,7 @@
* Logger factory return an appropriate implementation of a Logger.
* @version $Id$
*/
-public class LogManager
-{
+public class LogManager {
private static final String LOG_PROPERTIES_FILE =
"wsrp4j-logger.properties";
@@ -37,22 +35,18 @@
/**
* Use this method to initialize the log4j support
*/
- private void initLog4j()
- {
- try
- {
+ private void initLog4j() {
+ try {
InputStream propertiesInputStream;
propertiesInputStream = this.getClass().getClassLoader().
getResourceAsStream(LOG_PROPERTIES_FILE);
wsrp4jLevels.load(propertiesInputStream);
- } catch (Exception e)
- {
+ } catch (Exception e) {
System.err.println("LogManager: Error while initializing log " +
"properties. StackTrace follows.");
e.printStackTrace(System.err);
}
- try
- {
+ try {
//load log4j configuration from properties
org.apache.log4j.PropertyConfigurator.configure(wsrp4jLevels);
@@ -64,8 +58,7 @@
int userDefinedGlobalLevel =
getLevelFromString(wsrp4jLevels.getProperty(
GLOBAL_LOG_LEVEL_PROPERTY));
- if (userDefinedGlobalLevel != 0)
- {
+ if (userDefinedGlobalLevel != 0) {
globalLogLevel = userDefinedGlobalLevel;
}
@@ -73,8 +66,7 @@
org.apache.log4j.Logger.getLogger(this.getClass()).info(
"Global log level: " + this.getLevelAsString(globalLogLevel));
- } catch (Exception e)
- {
+ } catch (Exception e) {
System.err.println("LogManager: Error while initializing Logger.");
// StackTrace follows.");
//e.printStackTrace(System.err);
@@ -82,14 +74,12 @@
}
/**
- Returns the LogManager instance
-
- @return LogManager instance
- */
- public static LogManager getLogManager()
- {
- if ( logManager == null )
- {
+ * Returns the LogManager instance
+ *
+ * @return LogManager instance
+ */
+ public static LogManager getLogManager() {
+ if ( logManager == null ) {
logManager = new LogManager();
logManager.initLog4j();
}
@@ -99,19 +89,17 @@
/**
* Sets a different LogManager implementation
*/
- public static void setLogManager(LogManager manager)
- {
+ public static void setLogManager(LogManager manager) {
logManager = manager;
}
/**
- Returns a Logger instance for the calling class
-
- @param aClass The class that requests the logger instance.
- @return instance of <CODE>Logger</CODE>.
- */
- public Logger getLogger(Class aClass)
- {
+ * Returns a Logger instance for the calling class
+ *
+ * @param aClass The class that requests the logger instance.
+ * @return instance of <CODE>Logger</CODE>.
+ */
+ public Logger getLogger(Class aClass) {
//create a Logger
org.apache.log4j.Logger logger =
org.apache.log4j.Logger.getLogger(aClass);
@@ -121,72 +109,55 @@
int level = globalLogLevel;
int userDefinedLevel = getLevelFromString(
wsrp4jLevels.getProperty(propertyName));
- if (userDefinedLevel != 0)
- {
+ if (userDefinedLevel != 0) {
level = userDefinedLevel;
}
return new LoggerImpl(logger, level);
}
- /*
- Returns an int LogLevel defined by a String {ERROR, WARN, INFO,
- TRACE_HIGH, TRACE_MEDIUM, TRACE_LOW}.
- Use this method to convert levels defined in a properties file
- If the string does not represent a correct level this method returns 0
- */
- private int getLevelFromString(String s)
- {
- if (s != null)
- {
- if (s.equalsIgnoreCase("ERROR"))
- {
+ /**
+ * Returns an int LogLevel defined by a String {ERROR, WARN, INFO,
+ * TRACE_HIGH, TRACE_MEDIUM, TRACE_LOW}.
+ * Use this method to convert levels defined in a properties file
+ * If the string does not represent a correct level this method returns 0
+ */
+ private int getLevelFromString(String s) {
+ if (s != null) {
+ if (s.equalsIgnoreCase("ERROR")) {
return Logger.ERROR;
- } else if (s.equalsIgnoreCase("WARN"))
- {
+ } else if (s.equalsIgnoreCase("WARN")) {
return Logger.WARN;
- } else if (s.equalsIgnoreCase("INFO"))
- {
+ } else if (s.equalsIgnoreCase("INFO")) {
return Logger.INFO;
- } else if (s.equalsIgnoreCase("TRACE_LOW"))
- {
+ } else if (s.equalsIgnoreCase("TRACE_LOW")) {
return Logger.TRACE_LOW;
- } else if (s.equalsIgnoreCase("TRACE_MEDIUM"))
- {
+ } else if (s.equalsIgnoreCase("TRACE_MEDIUM")) {
return Logger.TRACE_MEDIUM;
- } else if (s.equalsIgnoreCase("TRACE_HIGH"))
- {
+ } else if (s.equalsIgnoreCase("TRACE_HIGH")) {
return Logger.TRACE_HIGH;
- } else
- {
+ } else {
return 0;
}
}
return 0;
}
- /*
- Translates a int logLevel to a String
- */
- private String getLevelAsString(int level)
- {
+ /**
+ * Translates a int logLevel to a String
+ */
+ private String getLevelAsString(int level) {
String sLevel;
- if (level < Logger.WARN)
- {
+ if (level < Logger.WARN) {
sLevel = "ERROR";
- } else if (level < Logger.INFO)
- {
+ } else if (level < Logger.INFO) {
sLevel = "WARN";
- } else if (level < Logger.TRACE_LOW)
- {
+ } else if (level < Logger.TRACE_LOW) {
sLevel = "INFO";
- } else if (level < Logger.TRACE_MEDIUM)
- {
+ } else if (level < Logger.TRACE_MEDIUM) {
sLevel = "TRACE_LOW";
- } else if (level < Logger.TRACE_HIGH)
- {
+ } else if (level < Logger.TRACE_HIGH) {
sLevel = "TRACE_MEDIUM";
- } else
- {
+ } else {
sLevel = "TRACE_HIGH";
}
return sLevel;
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/Logger.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/Logger.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/Logger.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/Logger.java Fri Feb 3 04:06:44 2006
@@ -13,297 +13,283 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.log;
-
/**
- <CODE>Logger</CODE> defines the methods which are used to create logging
- messages.
- <P>
- Logging levels are: <BR>
- <DL>
- <DT><CODE>ERROR</CODE>
- <DD>A serious failure in the execution of the application
- <DT><CODE>WARN</CODE>
- <DD>An abnormal condition has been detected.
- The user may have to take action, but the
- running code is able to handle this condition without ultimately failing.
- <DT><CODE>INFO</CODE>
- <DD>A condition that is worth noting but that does not require the user to
- perform
- an action.
- <DT><CODE>TRACE_LOW</CODE>
- <DD>A low-detail trace message.
- <DT><CODE>TRACE_MEDIUM</CODE>
- <DD>A medium-detail trace message.
- <DT><CODE>TRACE_HIGH</CODE>
- <DD>A high-detail trace message.
- </DL>
- <BR>
-
- Plain-text messages can be logged through the <CODE>text(...)</CODE>
- methods. These
- messages are generally hard-coded into the application.<BR>
- These methods should only be used for logging trace data.
- <P>
- In addition, the following specialized methods are available to log trace
- information.
- Each of these trace methods is a convenience to the application programmer:
- <DL>
- <DT><CODE>entry</CODE>
- <DD>Logs entry into a method.
- <DT><CODE>exit</CODE>
- <DD>Logs exit from a method.
- <DT><CODE>stackTrace</CODE>
- <DD>Logs the call stack.
- </DL>
- <P>
- For performance reasons the method <CODE>isLogging(int logLevel)</CODE>
- should be used
- to check if a given logging level is written at all to the output. The
- method should
- be used for the log message level entries, but is absolutely required to be
- called for
- trace messages to avoid unnecessary round-trips and object creation.<BR>
- <P>
- */
-
-/*
+ *
+ * <CODE>Logger</CODE> defines the methods which are used to create logging messages.
+ * <P>
+ * Logging levels are: <BR>
+ * <DL>
+ * <DT><CODE>ERROR</CODE>
+ * <DD>A serious failure in the execution of the application
+ * <DT><CODE>WARN</CODE>
+ * <DD>An abnormal condition has been detected. The user may have to take action, but the
+ * running code is able to handle this condition without ultimately failing.
+ * <DT><CODE>INFO</CODE>
+ * <DD>A condition that is worth noting but that does not require the user to perform
+ * an action.
+ * <DT><CODE>TRACE_LOW</CODE>
+ * <DD>A low-detail trace message.
+ * <DT><CODE>TRACE_MEDIUM</CODE>
+ * <DD>A medium-detail trace message.
+ * <DT><CODE>TRACE_HIGH</CODE>
+ * <DD>A high-detail trace message.
+ * </DL>
+ * <BR>
+ *
+ * Plain-text messages can be logged through the <CODE>text(...)</CODE> methods. These
+ * messages are generally hard-coded into the application.<BR>
+ * These methods should only be used for logging trace data.
+ * <P>
+ * In addition, the following specialized methods are available to log trace information.
+ * Each of these trace methods is a convenience to the application programmer:
+ * <DL>
+ * <DT><CODE>entry</CODE>
+ * <DD>Logs entry into a method.
+ * <DT><CODE>exit</CODE>
+ * <DD>Logs exit from a method.
+ * <DT><CODE>stackTrace</CODE>
+ * <DD>Logs the call stack.
+ * </DL>
+ * <P>
+ * For performance reasons the method <CODE>isLogging(int logLevel)</CODE> should be used
+ * to check if a given logging level is written at all to the output. The method should
+ * be used for the log message level entries, but is absolutely required to be called for
+ * trace messages to avoid unnecessary round-trips and object creation.<BR>
+ * <P>
* @version $Id$
*/
-public interface Logger
-{
+public interface Logger {
+
/**
- Defines an error message.<BR>
- Use this type to inform the user of a serious failure in the execution
- of the application.
+ * Defines an error message.<BR>
+ * Use this type to inform the user of a serious failure in the execution
+ * of the application.
*/
- public static final int ERROR = 10;
+ int ERROR = 10;
/**
- Defines a warning message.<BR>
- Use this type to inform a user that an abnormal condition has been
- detected. The user
- may have to take action, but the running code is able to handle this
- condition without
- ultimately failing.<BR>
- A warning message is less severe than an error message.
- */
- public static final int WARN = 20;
+ * Defines a warning message.<BR>
+ * Use this type to inform a user that an abnormal condition has been
+ * detected. The user
+ * may have to take action, but the running code is able to handle this
+ * condition without
+ * ultimately failing.<BR>
+ * A warning message is less severe than an error message.
+ */
+ int WARN = 20;
/**
- Defines an informational message.<BR>
- Use this type to indicate conditions that are worth noting but that do
- not require a
- user to take any precautions or perform an action. Do not use this log
- level for
- repeating events.<BR>
- An informational message is less severe than a warning message.
+ * Defines an informational message.<BR>
+ * Use this type to indicate conditions that are worth noting but that do
+ * not require a
+ * user to take any precautions or perform an action. Do not use this log
+ * level for
+ * repeating events.<BR>
+ * An informational message is less severe than a warning message.
*/
- public static final int INFO = 30;
+ int INFO = 30;
/**
- Defines a low-detail trace message.
+ * Defines a low-detail trace message.
*/
- public static final int TRACE_LOW = 40;
+ int TRACE_LOW = 40;
/**
- Defines a medium-detail trace message.
+ * Defines a medium-detail trace message.
*/
- public static final int TRACE_MEDIUM = 50;
+ int TRACE_MEDIUM = 50;
/**
- Defines a high-detail trace message.
+ * Defines a high-detail trace message.
*/
- public static final int TRACE_HIGH = 60;
+ int TRACE_HIGH = 60;
/**
- Determines if this logger is logging data for a given log level or not.
+ * Determines if this logger is logging data for a given log level or not.
*
- @param logLevel The log level to be checked.
- @return <code>true</code> when the object is logging the log level;
- <code>false</code> otherwise.
+ * @param logLevel The log level to be checked.
+ * @return <code>true</code> when the object is logging the log level;
+ * <code>false</code> otherwise.
*/
- public boolean isLogging(int logLevel);
+ boolean isLogging(int logLevel);
/**
- Logs a text message with no parameters.
+ * Logs a text message with no parameters.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param text The message text.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param text The message text.
*/
- public void text(int logLevel, String loggingMethod, String text);
+ void text(int logLevel, String loggingMethod, String text);
/**
- Logs a text message with one parameter.
+ * Logs a text message with one parameter.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param text The message text.
- @param parm1 An element to be displayed with the message.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param text The message text.
+ * @param parm1 An element to be displayed with the message.
*/
- public void text(int logLevel, String loggingMethod, String text,
+ void text(int logLevel, String loggingMethod, String text,
Object parm1);
/**
- Logs a text message with an array of parameters.
+ * Logs a text message with an array of parameters.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param text The message text.
- @param parms An array of elements to be displayed with the
- message.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param text The message text.
+ * @param parms An array of elements to be displayed with the message.
*/
- public void text(int logLevel, String loggingMethod, String text,
+ void text(int logLevel, String loggingMethod, String text,
Object[] parms);
/**
- Logs a text message with no parameters.
+ * Logs a text message with no parameters.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param t The throwable that is cause for this log entry.
- @param text The message text.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param t The throwable that is cause for this log entry.
+ * @param text The message text.
*/
- public void text(int logLevel, String loggingMethod, Throwable t,
+ void text(int logLevel, String loggingMethod, Throwable t,
String text);
/**
- Logs a text message with an array of parameters.
+ * Logs a text message with an array of parameters.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param t The throwable that is cause for this log entry.
- @param text The message text.
- @param parms An array of elements to be displayed with the
- message.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param t The throwable that is cause for this log entry.
+ * @param text The message text.
+ * @param parms An array of elements to be displayed with the message.
*/
- public void text(int logLevel, String loggingMethod, Throwable t,
+ void text(int logLevel, String loggingMethod, Throwable t,
String text, Object[] parms);
/**
- Logs entry into a method.
+ * Logs entry into a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
*/
- public void entry(int logLevel, String loggingMethod);
+ void entry(int logLevel, String loggingMethod);
/**
- Logs entry into a method.
+ * Logs entry into a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param parm1 An element to be displayed as trace data.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param parm1 An element to be displayed as trace data.
*/
- public void entry(int logLevel, String loggingMethod, Object parm1);
+ void entry(int logLevel, String loggingMethod, Object parm1);
/**
- Logs entry into a method.
+ * Logs entry into a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param parms An array of parameters passed to the method.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param parms An array of parameters passed to the method.
*/
- public void entry(int logLevel, String loggingMethod, Object[] parms);
+ void entry(int logLevel, String loggingMethod, Object[] parms);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
*/
- public void exit(int logLevel, String loggingMethod);
+ void exit(int logLevel, String loggingMethod);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, byte retValue);
+ void exit(int logLevel, String loggingMethod, byte retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, short retValue);
+ void exit(int logLevel, String loggingMethod, short retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, int retValue);
+ void exit(int logLevel, String loggingMethod, int retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, long retValue);
+ void exit(int logLevel, String loggingMethod, long retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, float retValue);
+ void exit(int logLevel, String loggingMethod, float retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, double retValue);
+ void exit(int logLevel, String loggingMethod, double retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, char retValue);
+ void exit(int logLevel, String loggingMethod, char retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, boolean retValue);
+ void exit(int logLevel, String loggingMethod, boolean retValue);
/**
- Logs exit from a method.
+ * Logs exit from a method.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param retValue The returned value.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param retValue The returned value.
*/
- public void exit(int logLevel, String loggingMethod, Object retValue);
+ void exit(int logLevel, String loggingMethod, Object retValue);
/**
- Logs the call stack.
+ * Logs the call stack.
*
- @param logLevel The level of the log entry.
- @param loggingMethod The name of the logging method.
- @param text The message text.
+ * @param logLevel The level of the log entry.
+ * @param loggingMethod The name of the logging method.
+ * @param text The message text.
*/
- public void stackTrace(int logLevel, String loggingMethod, String text);
+ void stackTrace(int logLevel, String loggingMethod, String text);
}
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LoggerImpl.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LoggerImpl.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LoggerImpl.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/log/LoggerImpl.java Fri Feb 3 04:06:44 2006
@@ -13,187 +13,220 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.log;
-
/**
- * Wrapper class for a log4j logger
+ * Wrapper class for a log4j logger.
+ *
* @version $Id$
*/
-public final class LoggerImpl implements Logger
-{
+public final class LoggerImpl implements Logger {
+
private org.apache.log4j.Logger logger;
+
private int level = Logger.ERROR; // default logLevel defined by wsrp4j
- LoggerImpl(org.apache.log4j.Logger aLogger, int logLevel)
- {
+ LoggerImpl(org.apache.log4j.Logger aLogger, int logLevel) {
this.logger = aLogger;
this.level = logLevel;
}
- public boolean isLogging(int logLevel)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#isLogging(int)
+ */
+ public boolean isLogging(int logLevel) {
org.apache.log4j.Level log4jLevel = determineLog4jLevel(logLevel);
- if (log4jLevel != org.apache.log4j.Level.OFF)
- {
+ if (log4jLevel != org.apache.log4j.Level.OFF) {
return (logLevel <= level && logger.isEnabledFor(log4jLevel));
}
return false;
}
- public void text(int logLevel, String loggingMethod, String text)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#text(int, java.lang.String,
+ * java.lang.String)
+ */
+ public void text(int logLevel, String loggingMethod, String text) {
text(logLevel, loggingMethod, text, null);
}
- public void text(int logLevel, String loggingMethod, String text,
- Object parm1)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#text(int, java.lang.String,
+ * java.lang.String, java.lang.Object)
+ */
+ public void text(int logLevel, String loggingMethod, String text,
+ Object parm1) {
text(logLevel, loggingMethod, text, new Object[] { parm1 });
}
- public void text(int logLevel, String loggingMethod, String text,
- Object[] parms)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#text(int, java.lang.String,
+ * java.lang.String, java.lang.Object[])
+ */
+ public void text(int logLevel, String loggingMethod, String text,
+ Object[] parms) {
text(logLevel, loggingMethod, (Throwable) null, text, parms);
}
- public void text(int logLevel, String loggingMethod, Throwable t,
- String text)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#text(int, java.lang.String, java.lang.Throwable, java.lang.String)
+ */
+ public void text(int logLevel, String loggingMethod, Throwable t,
+ String text) {
text(logLevel, loggingMethod, t, text, null);
}
- public void text(int logLevel, String loggingMethod, Throwable t,
- String text, Object[] parms)
- {
- if (!isLogging(logLevel))
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#text(int, java.lang.String, java.lang.Throwable, java.lang.String, java.lang.Object[])
+ */
+ public void text(int logLevel, String loggingMethod, Throwable t,
+ String text, Object[] parms) {
+ if (!isLogging(logLevel)) {
return;
}
- //logger.log("text", org.apache.log4j.Level.ERROR, "isLogging return
- // true with level " + logLevel, null);
+ // logger.log("text", org.apache.log4j.Level.ERROR, "isLogging return
+ // true with level " + logLevel, null);
- //determine log4j log level
+ // determine log4j log level
org.apache.log4j.Level log4jLevel = determineLog4jLevel(logLevel);
- //compose message object
+ // compose message object
StringBuffer msgBuffer = new StringBuffer();
- if (loggingMethod != null)
- {
+ if (loggingMethod != null) {
msgBuffer.append(loggingMethod);
msgBuffer.append(" - ");
}
- if (text != null)
- {
+ if (text != null) {
msgBuffer.append(text);
}
- if (parms != null)
- {
+ if (parms != null) {
msgBuffer.append("\nParameters:\n");
- for (int i = 0; i < parms.length; i++)
- {
+ for (int i = 0; i < parms.length; i++) {
msgBuffer.append(parms[i]);
}
}
- //log it all
+ // log it all
logger.log(log4jLevel, msgBuffer.toString(), t);
}
- public void entry(int logLevel, String loggingMethod)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#entry(int, java.lang.String)
+ */
+ public void entry(int logLevel, String loggingMethod) {
entry(logLevel, loggingMethod, null);
}
- public void entry(int logLevel, String loggingMethod, Object parm1)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#entry(int, java.lang.String, java.lang.Object)
+ */
+ public void entry(int logLevel, String loggingMethod, Object parm1) {
entry(logLevel, loggingMethod, new Object[] { parm1 });
}
- public void entry(int logLevel, String loggingMethod, Object[] parms)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#entry(int, java.lang.String, java.lang.Object[])
+ */
+ public void entry(int logLevel, String loggingMethod, Object[] parms) {
text(logLevel, loggingMethod, "Entering method", parms);
}
- public void exit(int logLevel, String loggingMethod)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String)
+ */
+ public void exit(int logLevel, String loggingMethod) {
text(logLevel, loggingMethod, "Exiting method.");
}
- public void exit(int logLevel, String loggingMethod, byte retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, byte)
+ */
+ public void exit(int logLevel, String loggingMethod, byte retValue) {
exit(logLevel, loggingMethod, new Byte(retValue));
}
- public void exit(int logLevel, String loggingMethod, short retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, short)
+ */
+ public void exit(int logLevel, String loggingMethod, short retValue) {
exit(logLevel, loggingMethod, new Short(retValue));
}
- public void exit(int logLevel, String loggingMethod, int retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, int)
+ */
+ public void exit(int logLevel, String loggingMethod, int retValue) {
exit(logLevel, loggingMethod, new Integer(retValue));
}
- public void exit(int logLevel, String loggingMethod, long retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, long)
+ */
+ public void exit(int logLevel, String loggingMethod, long retValue) {
exit(logLevel, loggingMethod, new Long(retValue));
}
- public void exit(int logLevel, String loggingMethod, float retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, float)
+ */
+ public void exit(int logLevel, String loggingMethod, float retValue) {
exit(logLevel, loggingMethod, new Float(retValue));
}
- public void exit(int logLevel, String loggingMethod, double retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, double)
+ */
+ public void exit(int logLevel, String loggingMethod, double retValue) {
exit(logLevel, loggingMethod, new Double(retValue));
}
- public void exit(int logLevel, String loggingMethod, char retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, char)
+ */
+ public void exit(int logLevel, String loggingMethod, char retValue) {
exit(logLevel, loggingMethod, new Character(retValue));
}
- public void exit(int logLevel, String loggingMethod, boolean retValue)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, boolean)
+ */
+ public void exit(int logLevel, String loggingMethod, boolean retValue) {
exit(logLevel, loggingMethod, new Boolean(retValue));
}
- public void exit(int logLevel, String loggingMethod, Object retValue)
- {
- text(logLevel, loggingMethod, "Exiting method. Returned value: {0}",
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#exit(int, java.lang.String, java.lang.Object)
+ */
+ public void exit(int logLevel, String loggingMethod, Object retValue) {
+ text(logLevel, loggingMethod, "Exiting method. Returned value: {0}",
retValue);
}
- public void stackTrace(int logLevel, String loggingMethod, String text)
- {
+ /**
+ * @see org.apache.wsrp4j.commons.log.Logger#stackTrace(int, java.lang.String, java.lang.String)
+ */
+ public void stackTrace(int logLevel, String loggingMethod, String text) {
text(logLevel, loggingMethod, new Throwable("Stacktrace"), text);
}
- //returns log4j level
- private org.apache.log4j.Level determineLog4jLevel(int wsrp4jLevel)
- {
- if (wsrp4jLevel < Logger.ERROR)
- {
+ /**
+ * returns log4j level
+ * @param wsrp4jLevel
+ * @return
+ */
+ private org.apache.log4j.Level determineLog4jLevel(int wsrp4jLevel) {
+ if (wsrp4jLevel < Logger.ERROR) {
return org.apache.log4j.Level.OFF;
- } else if (wsrp4jLevel < Logger.WARN)
- {
+ } else if (wsrp4jLevel < Logger.WARN) {
return org.apache.log4j.Level.ERROR;
- } else if (wsrp4jLevel < Logger.INFO)
- {
+ } else if (wsrp4jLevel < Logger.INFO) {
return org.apache.log4j.Level.WARN;
- } else if (wsrp4jLevel < Logger.TRACE_LOW)
- {
+ } else if (wsrp4jLevel < Logger.TRACE_LOW) {
return org.apache.log4j.Level.INFO;
- } else if (wsrp4jLevel < Logger.TRACE_HIGH)
- {
+ } else if (wsrp4jLevel < Logger.TRACE_HIGH) {
return org.apache.log4j.Level.DEBUG;
- } else
- {
+ } else {
return org.apache.log4j.Level.ALL;
}
}
Modified: portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/ClientPersistentFactory.java
URL: http://svn.apache.org/viewcvs/portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/ClientPersistentFactory.java?rev=374648&r1=374647&r2=374648&view=diff
==============================================================================
--- portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/ClientPersistentFactory.java (original)
+++ portals/wsrp4j/trunk/sandbox/wsrp4j/commons/src/java/org/apache/wsrp4j/commons/persistence/ClientPersistentFactory.java Fri Feb 3 04:06:44 2006
@@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.wsrp4j.commons.persistence;
import org.apache.wsrp4j.commons.exception.WSRPException;
-
/**
* This class is the interface definition for the client persistence
* support factory class. E.g. a consumer uses client persistent
@@ -28,8 +26,7 @@
*
* @version $Id$
*/
-public interface ClientPersistentFactory extends PersistentFactory
-{
+public interface ClientPersistentFactory extends PersistentFactory {
/**
* Returns a PageList
@@ -37,7 +34,7 @@
* @return PersistentDataObject
* @throws WSRPException
*/
- public PersistentDataObject getPageList() throws WSRPException;
+ PersistentDataObject getPageList() throws WSRPException;
/**
@@ -46,7 +43,7 @@
* @return PersistentDataObject
* @throws WSRPException
*/
- public PersistentDataObject getConsumerPortletContextList()
+ PersistentDataObject getConsumerPortletContextList()
throws WSRPException;
@@ -55,7 +52,7 @@
*
* @return PersistentDataObject
*/
- public PersistentDataObject getPortletList() throws WSRPException;
+ PersistentDataObject getPortletList() throws WSRPException;
/**
@@ -63,7 +60,7 @@
*
* @return PersistentDataObject
*/
- public PersistentDataObject getProducerList() throws WSRPException;
+ PersistentDataObject getProducerList() throws WSRPException;
/**
@@ -71,6 +68,5 @@
*
* @return PersistentDataObject
*/
- public PersistentDataObject getUserList() throws WSRPException;
-
+ PersistentDataObject getUserList() throws WSRPException;
}