You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/07/27 10:08:21 UTC
svn commit: r225478 [1/4] - in /webservices/axis/trunk/java/modules:
addressing/src/org/apache/axis2/handlers/addressing/
addressing/test/org/apache/axis2/handlers/addressing/
common/src/org/apache/axis2/ common/src/org/apache/axis2/i18n/
core/src/org/...
Author: chinthaka
Date: Wed Jul 27 00:57:39 2005
New Revision: 225478
URL: http://svn.apache.org/viewcvs?rev=225478&view=rev
Log:
- refactored AxisFault in to common module so that it can be used by an module.
- added code to throw SOAPProcessingException from StAXSOAPModelBuilder which has enough information to create response fault with correct information in it.
Added:
webservices/axis/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java
Removed:
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisFault.java
Modified:
webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingModuleTest.java
webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java
webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java
webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java
webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/ProjectResourceBundle.java
webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/RB.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/CallbackReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOnlyMEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/ListenerManager.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/MessageSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/Stub.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/TwoWayTransportBasedSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/context/OperationContext.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/context/OperationContextFactory.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentException.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentParser.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveFileData.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/description/OperationDescription.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/description/ServiceDescription.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AbstractDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfiguration.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationImpl.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DependencyManager.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/Handler.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/MessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPProcessingModelChecker.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/handlers/AbstractHandler.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/modules/Module.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseException.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/phaseresolver/PhaseResolver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutAsyncMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractInOutSyncMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOnlyMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/RawXMLINOutMessageReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/receivers/ServerCallback.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/AbstractTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/EmailReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportListener.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/TransportUtils.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutputStream.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/local/LocalTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/EMailSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/MailWorker.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/SimpleMailListener.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailServer.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/MailSorter.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/POP3Server.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/mail/server/SMTPServer.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPTransportSender.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPWorker.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis2/util/threadpool/ThreadPool.java
webservices/axis/trunk/java/modules/core/test-resources/deployment/module1/Handler3.java
webservices/axis/trunk/java/modules/core/test-resources/deployment/module1/org/apache/module/Module1Impl.java
webservices/axis/trunk/java/modules/core/test-resources/deployment/service1/org/apache/axis/sample/handlers/LoggingHandler.java
webservices/axis/trunk/java/modules/core/test-resources/deployment/service2/Handler2.java
webservices/axis/trunk/java/modules/core/test-resources/deployment/serviceModule/org/apache/axis/InavalidModuleImpl.java
webservices/axis/trunk/java/modules/core/test-resources/deployment/serviceModule/org/apache/axis/ModuleHandler1.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/deployment/DeploymentTotalTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/deployment/SpeakingHandler.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/deployment/TransportDeploymentTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/description/RegistryTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/description/SpeakingHandler.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/description/SpeakingHandler1.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/description/SpeakingProvider.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/AbstractEngineTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/EnginePausingTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/EngineWithoutPhaseResolvingTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/MessageContextEnabledEcho.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/MessageContextTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/engine/ModuleEngageTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/misc/MiscTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/BeforeAfterTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/BeforeTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/BeforeWithNoFirstHandlerTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/InvalidPhaseFirstRulesTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/InvalidPhaseFirstTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/InvalidPhaseLastRuleTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/InvalidPhaselastTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/PhaseFirstTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/PhaseLastTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/PhaseRuleHandlers.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/phaserule/SingleHandlerPhaseTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/transport/HTTPTrasportHeaderParsingTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/transport/tcp/TCPTransportTest.java
webservices/axis/trunk/java/modules/core/test/org/apache/axis2/util/threadpool/TestThreadPool.java
webservices/axis/trunk/java/modules/core/webapp/HappyAxis.jsp
webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSimpleQueueService/util/RunnableCreateQueue.java
webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSimpleQueueService/util/RunnableDeleteQueue.java
webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSimpleQueueService/util/RunnableListMyQueues.java
webservices/axis/trunk/java/modules/samples/src/sample/amazon/amazonSimpleQueueService/util/RunnableReadQueue.java
webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/AsynchronousClient.java
webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/ClientUtil.java
webservices/axis/trunk/java/modules/samples/src/sample/amazon/search/GUIHandler.java
webservices/axis/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java
webservices/axis/trunk/java/modules/samples/src/sample/google/search/ClientUtil.java
webservices/axis/trunk/java/modules/samples/src/sample/google/search/GUIHandler.java
webservices/axis/trunk/java/modules/samples/src/sample/google/spellcheck/FormModel.java
webservices/axis/trunk/java/modules/samples/src/sample/groovy/GroovyReceiver.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/ClientForWebServiceWithModule.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/MailClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/RESTClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/clients/TCPClient.java
webservices/axis/trunk/java/modules/samples/src/userguide/loggingmodule/LogHandler.java
webservices/axis/trunk/java/modules/samples/src/userguide/loggingmodule/LoggingModule.java
webservices/axis/trunk/java/modules/samples/test-resources/SOAP12Testing/ReplyMessages/test.xml
webservices/axis/trunk/java/modules/samples/test-resources/SOAP12Testing/SOAP12TestModuleB/org/apache/axis2/soap12testing/handlers/SOAP12InFlowHandlerDefaultB.java
webservices/axis/trunk/java/modules/samples/test-resources/SOAP12Testing/SOAP12TestModuleC/org/apache/axis2/soap12testing/handlers/SOAP12InFlowHandlerDefaultC.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/CallUnregisteredServiceTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/EchoRawXMLOnTwoChannelsTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/EchoRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/HandlerFailureTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/OneWayRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SOAPversionTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SpeakingHandler.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/SpeakingHandler1.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/engine/util/MyInOutMEPClient.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/integration/UtilServer.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/integration/UtilsTCPServer.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailOneWayRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailRequestResponseRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/MailetRequestResponceRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/mail/UtilsMailServer.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis2/tcp/TCPTwoChannelEchoRawXMLTest.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPConstants.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPProcessingException.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap11/SOAP11Constants.java
webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/soap12/SOAP12Constants.java
Modified: webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=225478&r1=225477&r2=225478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java (original)
+++ webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java Wed Jul 27 00:57:39 2005
@@ -5,12 +5,12 @@
import org.apache.axis2.addressing.MessageInformationHeadersCollection;
import org.apache.axis2.addressing.miheaders.RelatesTo;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisFault;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.om.OMAttribute;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.soap.SOAPHeader;
import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=225478&r1=225477&r2=225478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java (original)
+++ webservices/axis/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java Wed Jul 27 00:57:39 2005
@@ -7,13 +7,13 @@
import org.apache.axis2.addressing.ServiceName;
import org.apache.axis2.addressing.miheaders.RelatesTo;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisFault;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.soap.SOAPHeader;
import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
import org.apache.wsdl.WSDLConstants;
import javax.xml.namespace.QName;
Modified: webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingModuleTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingModuleTest.java?rev=225478&r1=225477&r2=225478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingModuleTest.java (original)
+++ webservices/axis/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingModuleTest.java Wed Jul 27 00:57:39 2005
@@ -4,7 +4,7 @@
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.description.ModuleDescription;
import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisFault;
+import org.apache.axis2.AxisFault;
import javax.xml.namespace.QName;
import java.io.File;
Added: webservices/axis/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java?rev=225478&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java (added)
+++ webservices/axis/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java Wed Jul 27 00:57:39 2005
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.rmi.RemoteException;
+
+/**
+ * An exception which maps cleanly to a SOAP fault.
+ * This is a base class for exceptions which are mapped to faults.
+ * SOAP faults contain
+ * <ol>
+ * <li>A fault string
+ * <li>A fault code
+ * <li>A fault actor
+ * <li>Fault details; an xml tree of fault specific stuff
+ * </ol>
+ */
+public class AxisFault extends RemoteException {
+
+ private String soapFaultCode;
+
+ public AxisFault(Throwable arg1) {
+ super(arg1.getMessage(), arg1);
+ }
+
+ /**
+ * @param arg0
+ */
+ public AxisFault(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public AxisFault(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ /**
+ * Make an AxisFault based on a passed Exception. If the Exception is
+ * already an AxisFault, simply use that. Otherwise, wrap it in an
+ * AxisFault. If the Exception is an InvocationTargetException (which
+ * already wraps another Exception), get the wrapped Exception out from
+ * there and use that instead of the passed one.
+ *
+ * @param e the <code>Exception</code> to build a fault for
+ * @return an <code>AxisFault</code> representing <code>e</code>
+ */
+ public static AxisFault makeFault(Exception e) {
+ if (e instanceof InvocationTargetException) {
+ Throwable t = ((InvocationTargetException) e).getTargetException();
+ if (t instanceof Exception) {
+ e = (Exception) t;
+ }
+ }
+ if (e instanceof AxisFault) {
+ return (AxisFault) e;
+ }
+ return new AxisFault(e.getMessage(), e);
+ }
+
+ /**
+ *
+ * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault
+ * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault
+ * @param cause - this will appear under the Detail information item of SOAP Fault
+ */
+ public AxisFault(String messageText, String faultCode, Throwable cause) {
+ super(messageText, cause);
+ this.soapFaultCode = faultCode;
+ }
+
+ /**
+ *
+ * @param messageText - this will appear as the Text in the Reason information item of SOAP Fault
+ * @param faultCode - this will appear as the Value in the Code information item of SOAP Fault
+ */
+ public AxisFault(String messageText, String faultCode) {
+ super(messageText);
+ this.soapFaultCode = faultCode;
+ }
+}
Modified: webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java?rev=225478&r1=225477&r2=225478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java (original)
+++ webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java Wed Jul 27 00:57:39 2005
@@ -25,14 +25,14 @@
* Accept parameters for ProjectResourceBundle,
* but defer object instantiation (and therefore
* resource bundle loading) until required.
- *
+ *
* @author Richard A. Sitze (rsitze@us.ibm.com)
* @author Karl Moss (kmoss@macromedia.com)
* @author Glen Daniels (gdaniels@apache.org)
*/
public class MessageBundle {
private boolean loaded = false;
-
+
private ProjectResourceBundle _resourceBundle = null;
private final String projectName;
@@ -46,11 +46,11 @@
public final ProjectResourceBundle getResourceBundle() {
if (!loaded) {
_resourceBundle = ProjectResourceBundle.getBundle(projectName,
- packageName,
- resourceName,
- locale,
- classLoader,
- parent);
+ packageName,
+ resourceName,
+ locale,
+ classLoader,
+ parent);
loaded = true;
}
return _resourceBundle;
@@ -60,13 +60,12 @@
* Construct a new ExtendMessages
*/
public MessageBundle(String projectName,
- String packageName,
- String resourceName,
- Locale locale,
- ClassLoader classLoader,
- ResourceBundle parent)
- throws MissingResourceException
- {
+ String packageName,
+ String resourceName,
+ Locale locale,
+ ClassLoader classLoader,
+ ResourceBundle parent)
+ throws MissingResourceException {
this.projectName = projectName;
this.packageName = packageName;
this.resourceName = resourceName;
@@ -76,118 +75,118 @@
}
/**
- * Gets a string message from the resource bundle for the given key
- * @param key The resource key
- * @return The message
- */
- public String getMessage(String key) throws MissingResourceException
- {
+ * Gets a string message from the resource bundle for the given key
+ *
+ * @param key The resource key
+ * @return The message
+ */
+ public String getMessage(String key) throws MissingResourceException {
return getMessage(key, (String[]) null);
}
/**
- * <p>Gets a string message from the resource bundle for the given key. The
- * message may contain variables that will be substituted with the given
- * arguments. Variables have the format:</p>
- * <dir>
- * This message has two variables: {0} and {1}
- * </dir>
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @return The message
- */
- public String getMessage(String key, String arg0) throws MissingResourceException
- {
- return getMessage(key, new String[] { arg0 });
- }
-
- /**
- * <p>Gets a string message from the resource bundle for the given key. The
- * message may contain variables that will be substituted with the given
- * arguments. Variables have the format:</p>
- * <dir>
- * This message has two variables: {0} and {1}
- * </dir>
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @return The message
- */
- public String getMessage(String key, String arg0, String arg1) throws MissingResourceException
- {
- return getMessage(key, new String[] { arg0, arg1 });
- }
-
- /**
- * <p>Gets a string message from the resource bundle for the given key. The
- * message may contain variables that will be substituted with the given
- * arguments. Variables have the format:</p>
- * <dir>
- * This message has two variables: {0} and {1}
- * </dir>
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @param arg2 The argument to place in variable {2}
- * @return The message
- */
- public String getMessage(String key, String arg0, String arg1, String arg2) throws MissingResourceException
- {
- return getMessage(key, new String[] { arg0, arg1, arg2 });
- }
-
- /**
- * <p>Gets a string message from the resource bundle for the given key. The
- * message may contain variables that will be substituted with the given
- * arguments. Variables have the format:</p>
- * <dir>
- * This message has two variables: {0} and {1}
- * </dir>
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @param arg2 The argument to place in variable {2}
- * @param arg3 The argument to place in variable {3}
- * @return The message
- */
- public String getMessage(String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException
- {
- return getMessage(key, new String[] { arg0, arg1, arg2, arg3 });
- }
-
- /**
- * <p>Gets a string message from the resource bundle for the given key. The
- * message may contain variables that will be substituted with the given
- * arguments. Variables have the format:</p>
- * <dir>
- * This message has two variables: {0} and {1}
- * </dir>
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @param arg2 The argument to place in variable {2}
- * @param arg3 The argument to place in variable {3}
- * @param arg4 The argument to place in variable {4}
- * @return The message
- */
- public String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException
- {
- return getMessage(key, new String[] { arg0, arg1, arg2, arg3, arg4 });
- }
-
- /**
- * <p>Gets a string message from the resource bundle for the given key. The
- * message may contain variables that will be substituted with the given
- * arguments. Variables have the format:</p>
- * <dir>
- * This message has two variables: {0} and {1}
- * </dir>
- * @param key The resource key
- * @param array An array of objects to place in corresponding variables
- * @return The message
- */
- public String getMessage(String key, String[] array) throws MissingResourceException
- {
+ * <p>Gets a string message from the resource bundle for the given key. The
+ * message may contain variables that will be substituted with the given
+ * arguments. Variables have the format:</p>
+ * <dir>
+ * This message has two variables: {0} and {1}
+ * </dir>
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @return The message
+ */
+ public String getMessage(String key, String arg0) throws MissingResourceException {
+ return getMessage(key, new String[]{arg0});
+ }
+
+ /**
+ * <p>Gets a string message from the resource bundle for the given key. The
+ * message may contain variables that will be substituted with the given
+ * arguments. Variables have the format:</p>
+ * <dir>
+ * This message has two variables: {0} and {1}
+ * </dir>
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @return The message
+ */
+ public String getMessage(String key, String arg0, String arg1) throws MissingResourceException {
+ return getMessage(key, new String[]{arg0, arg1});
+ }
+
+ /**
+ * <p>Gets a string message from the resource bundle for the given key. The
+ * message may contain variables that will be substituted with the given
+ * arguments. Variables have the format:</p>
+ * <dir>
+ * This message has two variables: {0} and {1}
+ * </dir>
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @return The message
+ */
+ public String getMessage(String key, String arg0, String arg1, String arg2) throws MissingResourceException {
+ return getMessage(key, new String[]{arg0, arg1, arg2});
+ }
+
+ /**
+ * <p>Gets a string message from the resource bundle for the given key. The
+ * message may contain variables that will be substituted with the given
+ * arguments. Variables have the format:</p>
+ * <dir>
+ * This message has two variables: {0} and {1}
+ * </dir>
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @param arg3 The argument to place in variable {3}
+ * @return The message
+ */
+ public String getMessage(String key, String arg0, String arg1, String arg2, String arg3) throws MissingResourceException {
+ return getMessage(key, new String[]{arg0, arg1, arg2, arg3});
+ }
+
+ /**
+ * <p>Gets a string message from the resource bundle for the given key. The
+ * message may contain variables that will be substituted with the given
+ * arguments. Variables have the format:</p>
+ * <dir>
+ * This message has two variables: {0} and {1}
+ * </dir>
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @param arg3 The argument to place in variable {3}
+ * @param arg4 The argument to place in variable {4}
+ * @return The message
+ */
+ public String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4) throws MissingResourceException {
+ return getMessage(key, new String[]{arg0, arg1, arg2, arg3, arg4});
+ }
+
+ /**
+ * <p>Gets a string message from the resource bundle for the given key. The
+ * message may contain variables that will be substituted with the given
+ * arguments. Variables have the format:</p>
+ * <dir>
+ * This message has two variables: {0} and {1}
+ * </dir>
+ *
+ * @param key The resource key
+ * @param array An array of objects to place in corresponding variables
+ * @return The message
+ */
+ public String getMessage(String key, String[] array) throws MissingResourceException {
String msg = null;
if (getResourceBundle() != null) {
msg = getResourceBundle().getString(key);
@@ -195,9 +194,9 @@
if (msg == null) {
throw new MissingResourceException("Cannot find resource key \"" + key +
- "\" in base name " +
- getResourceBundle().getResourceName(),
- getResourceBundle().getResourceName(), key);
+ "\" in base name " +
+ getResourceBundle().getResourceName(),
+ getResourceBundle().getResourceName(), key);
}
return MessageFormat.format(msg, array);
Modified: webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java?rev=225478&r1=225477&r2=225478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java (original)
+++ webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java Wed Jul 27 00:57:39 2005
@@ -22,24 +22,23 @@
/**
- * @see org.apache.axis.i18n.Messages
- *
- * FUNCTIONAL TEMPLATE for Messages classes.
- *
- * Copy this template to your package.
- *
- * For subpackages of org.apache.axis.*, the internal constants
- * are set appropriately. To adapt this scheme to an extension project
- * (package prefix differs from org.apache.axis.*), edit the projectName
- * attribute. The others shouldn't need to be changed unless this is
- * being adapted to a non-AXIS related project..
- *
* @author Richard A. Sitze (rsitze@us.ibm.com)
* @author Karl Moss (kmoss@macromedia.com)
* @author Glen Daniels (gdaniels@apache.org)
+ * @see org.apache.axis.i18n.Messages
+ * <p/>
+ * FUNCTIONAL TEMPLATE for Messages classes.
+ * <p/>
+ * Copy this template to your package.
+ * <p/>
+ * For subpackages of org.apache.axis.*, the internal constants
+ * are set appropriately. To adapt this scheme to an extension project
+ * (package prefix differs from org.apache.axis.*), edit the projectName
+ * attribute. The others shouldn't need to be changed unless this is
+ * being adapted to a non-AXIS related project..
*/
public class Messages {
- private static final Class thisClass = Messages.class;
+ private static final Class thisClass = Messages.class;
private static final String projectName = MessagesConstants.projectName;
@@ -50,114 +49,116 @@
private static final ClassLoader classLoader = thisClass.getClassLoader();
private static final ResourceBundle parent =
- (MessagesConstants.rootPackageName == packageName)
- ? null
- : MessagesConstants.rootBundle;
+ (MessagesConstants.rootPackageName == packageName)
+ ? null
+ : MessagesConstants.rootBundle;
- /***** NO NEED TO CHANGE ANYTHING BELOW *****/
+ /**
+ * ** NO NEED TO CHANGE ANYTHING BELOW ****
+ */
private static final MessageBundle messageBundle =
- new MessageBundle(projectName, packageName, resourceName,
- locale, classLoader, parent);
+ new MessageBundle(projectName, packageName, resourceName,
+ locale, classLoader, parent);
/**
- * Get a message from resource.properties from the package of the given object.
- * @param key The resource key
- * @return The formatted message
- */
+ * Get a message from resource.properties from the package of the given object.
+ *
+ * @param key The resource key
+ * @return The formatted message
+ */
public static String getMessage(String key)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return messageBundle.getMessage(key);
}
/**
- * Get a message from resource.properties from the package of the given object.
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @return The formatted message
- */
+ * Get a message from resource.properties from the package of the given object.
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @return The formatted message
+ */
public static String getMessage(String key, String arg0)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return messageBundle.getMessage(key, arg0);
}
/**
- * Get a message from resource.properties from the package of the given object.
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @return The formatted message
- */
+ * Get a message from resource.properties from the package of the given object.
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @return The formatted message
+ */
public static String getMessage(String key, String arg0, String arg1)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return messageBundle.getMessage(key, arg0, arg1);
}
/**
- * Get a message from resource.properties from the package of the given object.
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @param arg2 The argument to place in variable {2}
- * @return The formatted message
- */
+ * Get a message from resource.properties from the package of the given object.
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @return The formatted message
+ */
public static String getMessage(String key, String arg0, String arg1, String arg2)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return messageBundle.getMessage(key, arg0, arg1, arg2);
}
/**
- * Get a message from resource.properties from the package of the given object.
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @param arg2 The argument to place in variable {2}
- * @param arg3 The argument to place in variable {3}
- * @return The formatted message
- */
+ * Get a message from resource.properties from the package of the given object.
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @param arg3 The argument to place in variable {3}
+ * @return The formatted message
+ */
public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return messageBundle.getMessage(key, arg0, arg1, arg2, arg3);
}
/**
- * Get a message from resource.properties from the package of the given object.
- * @param key The resource key
- * @param arg0 The argument to place in variable {0}
- * @param arg1 The argument to place in variable {1}
- * @param arg2 The argument to place in variable {2}
- * @param arg3 The argument to place in variable {3}
- * @param arg4 The argument to place in variable {4}
- * @return The formatted message
- */
+ * Get a message from resource.properties from the package of the given object.
+ *
+ * @param key The resource key
+ * @param arg0 The argument to place in variable {0}
+ * @param arg1 The argument to place in variable {1}
+ * @param arg2 The argument to place in variable {2}
+ * @param arg3 The argument to place in variable {3}
+ * @param arg4 The argument to place in variable {4}
+ * @return The formatted message
+ */
public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return messageBundle.getMessage(key, arg0, arg1, arg2, arg3, arg4);
}
/**
- * Get a message from resource.properties from the package of the given object.
- * @param key The resource key
- * @param args An array of objects to place in corresponding variables
- * @return The formatted message
- */
+ * Get a message from resource.properties from the package of the given object.
+ *
+ * @param key The resource key
+ * @param args An array of objects to place in corresponding variables
+ * @return The formatted message
+ */
public static String getMessage(String key, String[] args)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return messageBundle.getMessage(key, args);
}
-
+
public static ResourceBundle getResourceBundle() {
return messageBundle.getResourceBundle();
}
-
+
public static MessageBundle getMessageBundle() {
return messageBundle;
}
Modified: webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java?rev=225478&r1=225477&r2=225478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java (original)
+++ webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java Wed Jul 27 00:57:39 2005
@@ -30,10 +30,10 @@
public static final String rootPackageName = "org.apache.axis2.i18n".intern();
public static final ResourceBundle rootBundle =
- ProjectResourceBundle.getBundle(projectName,
- rootPackageName,
- resourceName,
- locale,
- MessagesConstants.class.getClassLoader(),
- null);
+ ProjectResourceBundle.getBundle(projectName,
+ rootPackageName,
+ resourceName,
+ locale,
+ MessagesConstants.class.getClassLoader(),
+ null);
}
Modified: webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/ProjectResourceBundle.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/ProjectResourceBundle.java?rev=225478&r1=225477&r2=225478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/ProjectResourceBundle.java (original)
+++ webservices/axis/trunk/java/modules/common/src/org/apache/axis2/i18n/ProjectResourceBundle.java Wed Jul 27 00:57:39 2005
@@ -20,13 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import java.util.*;
/**
* <p>Wrapper class for resource bundles. Property files are used to store
@@ -45,14 +39,14 @@
* variables. Any dynamic variable defined in PropertiesUtil.getVariableValue()
* can be used (such as {date}), as well as arguments in the form {0}, {1}, etc.
* Argument values are specified in the various overloaded getString() methods.</p>
- *
+ *
* @author Richard A. Sitze (rsitze@us.ibm.com)
* @author Karl Moss (kmoss@macromedia.com)
* @author Glen Daniels (gdaniels@apache.org)
*/
public class ProjectResourceBundle extends ResourceBundle {
protected static Log log =
- LogFactory.getLog(ProjectResourceBundle.class.getName());
+ LogFactory.getLog(ProjectResourceBundle.class.getName());
// The static cache of ResourceBundles.
@@ -65,10 +59,9 @@
private final ResourceBundle resourceBundle;
private final String resourceName;
-
+
protected Object handleGetObject(String key)
- throws MissingResourceException
- {
+ throws MissingResourceException {
if (log.isDebugEnabled()) {
log.debug(this.toString() + "::handleGetObject(" + key + ")");
}
@@ -85,7 +78,7 @@
}
return obj;
}
-
+
public Enumeration getKeys() {
Enumeration myKeys = resourceBundle.getKeys();
if (parent == null) {
@@ -95,163 +88,145 @@
while (myKeys.hasMoreElements()) {
set.add(myKeys.nextElement());
}
-
+
Enumeration pKeys = parent.getKeys();
while (pKeys.hasMoreElements()) {
set.add(pKeys.nextElement());
}
-
+
return new Enumeration() {
- private Iterator it = set.iterator();
- public boolean hasMoreElements() { return it.hasNext(); }
- public Object nextElement() { return it.next(); }
- };
+ private Iterator it = set.iterator();
+
+ public boolean hasMoreElements() {
+ return it.hasNext();
+ }
+
+ public Object nextElement() {
+ return it.next();
+ }
+ };
}
}
-
+
/**
* Construct a new ProjectResourceBundle
- *
- * @param projectName The name of the project to which the class belongs.
- * It must be a proper prefix of the caller's package.
- *
- * @param caller The calling class.
- * This is used to get the package name to further construct
- * the basename as well as to get the proper ClassLoader.
- *
+ *
+ * @param projectName The name of the project to which the class belongs.
+ * It must be a proper prefix of the caller's package.
+ * @param caller The calling class.
+ * This is used to get the package name to further construct
+ * the basename as well as to get the proper ClassLoader.
* @param resourceName The name of the resource without the
- * ".properties" extension
- *
+ * ".properties" extension
* @throws MissingResourceException if projectName is not a prefix of
- * the caller's package name, or if the resource could not be
- * found/loaded.
+ * the caller's package name, or if the resource could not be
+ * found/loaded.
*/
public static ProjectResourceBundle getBundle(String projectName,
String packageName,
String resourceName)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return getBundle(projectName, packageName, resourceName, null, null, null);
}
/**
* Construct a new ProjectResourceBundle
- *
- * @param projectName The name of the project to which the class belongs.
- * It must be a proper prefix of the caller's package.
- *
- * @param caller The calling class.
- * This is used to get the package name to further construct
- * the basename as well as to get the proper ClassLoader.
- *
+ *
+ * @param projectName The name of the project to which the class belongs.
+ * It must be a proper prefix of the caller's package.
+ * @param caller The calling class.
+ * This is used to get the package name to further construct
+ * the basename as well as to get the proper ClassLoader.
* @param resourceName The name of the resource without the
- * ".properties" extension
- *
+ * ".properties" extension
* @throws MissingResourceException if projectName is not a prefix of
- * the caller's package name, or if the resource could not be
- * found/loaded.
+ * the caller's package name, or if the resource could not be
+ * found/loaded.
*/
public static ProjectResourceBundle getBundle(String projectName,
- Class caller,
+ Class caller,
String resourceName,
Locale locale)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return getBundle(projectName,
- caller,
- resourceName,
- locale,
- null);
+ caller,
+ resourceName,
+ locale,
+ null);
}
/**
* Construct a new ProjectResourceBundle
- *
- * @param projectName The name of the project to which the class belongs.
- * It must be a proper prefix of the caller's package.
- *
- * @param caller The calling class.
- * This is used to get the package name to further construct
- * the basename as well as to get the proper ClassLoader.
- *
+ *
+ * @param projectName The name of the project to which the class belongs.
+ * It must be a proper prefix of the caller's package.
+ * @param caller The calling class.
+ * This is used to get the package name to further construct
+ * the basename as well as to get the proper ClassLoader.
* @param resourceName The name of the resource without the
- * ".properties" extension
- *
- * @param locale The locale
- *
+ * ".properties" extension
+ * @param locale The locale
* @throws MissingResourceException if projectName is not a prefix of
- * the caller's package name, or if the resource could not be
- * found/loaded.
+ * the caller's package name, or if the resource could not be
+ * found/loaded.
*/
public static ProjectResourceBundle getBundle(String projectName,
String packageName,
String resourceName,
Locale locale,
ClassLoader loader)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return getBundle(projectName, packageName, resourceName, locale, loader, null);
}
/**
* Construct a new ProjectResourceBundle
- *
- * @param projectName The name of the project to which the class belongs.
- * It must be a proper prefix of the caller's package.
- *
- * @param caller The calling class.
- * This is used to get the package name to further construct
- * the basename as well as to get the proper ClassLoader.
- *
- * @param resourceName The name of the resource without the
- * ".properties" extension
- *
- * @param locale The locale
- *
+ *
+ * @param projectName The name of the project to which the class belongs.
+ * It must be a proper prefix of the caller's package.
+ * @param caller The calling class.
+ * This is used to get the package name to further construct
+ * the basename as well as to get the proper ClassLoader.
+ * @param resourceName The name of the resource without the
+ * ".properties" extension
+ * @param locale The locale
* @param extendsBundle If non-null, then this ExtendMessages will
- * default to extendsBundle.
- *
+ * default to extendsBundle.
* @throws MissingResourceException if projectName is not a prefix of
- * the caller's package name, or if the resource could not be
- * found/loaded.
+ * the caller's package name, or if the resource could not be
+ * found/loaded.
*/
public static ProjectResourceBundle getBundle(String projectName,
- Class caller,
+ Class caller,
String resourceName,
Locale locale,
ResourceBundle extendsBundle)
- throws MissingResourceException
- {
+ throws MissingResourceException {
return getBundle(projectName,
- getPackage(caller.getClass().getName()),
- resourceName,
- locale,
- caller.getClass().getClassLoader(),
- extendsBundle);
+ getPackage(caller.getClass().getName()),
+ resourceName,
+ locale,
+ caller.getClass().getClassLoader(),
+ extendsBundle);
}
/**
* Construct a new ProjectResourceBundle
- *
- * @param projectName The name of the project to which the class belongs.
- * It must be a proper prefix of the caller's package.
- *
- * @param caller The calling class.
- * This is used to get the package name to further construct
- * the basename as well as to get the proper ClassLoader.
- *
- * @param resourceName The name of the resource without the
- * ".properties" extension
- *
- * @param locale The locale
- *
+ *
+ * @param projectName The name of the project to which the class belongs.
+ * It must be a proper prefix of the caller's package.
+ * @param caller The calling class.
+ * This is used to get the package name to further construct
+ * the basename as well as to get the proper ClassLoader.
+ * @param resourceName The name of the resource without the
+ * ".properties" extension
+ * @param locale The locale
* @param extendsBundle If non-null, then this ExtendMessages will
- * default to extendsBundle.
- *
+ * default to extendsBundle.
* @throws MissingResourceException if projectName is not a prefix of
- * the caller's package name, or if the resource could not be
- * found/loaded.
+ * the caller's package name, or if the resource could not be
+ * found/loaded.
*/
public static ProjectResourceBundle getBundle(String projectName,
String packageName,
@@ -259,15 +234,14 @@
Locale locale,
ClassLoader loader,
ResourceBundle extendsBundle)
- throws MissingResourceException
- {
+ throws MissingResourceException {
if (log.isDebugEnabled()) {
log.debug("getBundle(" + projectName + ","
- + packageName + ","
- + resourceName + ","
- + String.valueOf(locale) + ",...)");
+ + packageName + ","
+ + resourceName + ","
+ + String.valueOf(locale) + ",...)");
}
-
+
Context context = new Context();
context.setLocale(locale);
context.setLoader(loader);
@@ -284,13 +258,13 @@
log.debug("Exception: ", e);
throw e;
}
-
+
if (bundle == null) {
throw new MissingResourceException("Cannot find resource '" +
- packageName + '.' + resourceName + "'",
- resourceName, "");
+ packageName + '.' + resourceName + "'",
+ resourceName, "");
}
-
+
return bundle;
}
@@ -301,17 +275,16 @@
* - if at top of hierarchy, use (link to) context.getParentBundle()
*/
private static synchronized ProjectResourceBundle getBundle(Context context, String packageName)
- throws MissingResourceException
- {
+ throws MissingResourceException {
String cacheKey = context.getCacheKey(packageName);
-
- ProjectResourceBundle prb = (ProjectResourceBundle)bundleCache.get(cacheKey);
+
+ ProjectResourceBundle prb = (ProjectResourceBundle) bundleCache.get(cacheKey);
if (prb == null) {
String name = packageName + '.' + context.getResourceName();
ResourceBundle rb = context.loadBundle(packageName);
ResourceBundle parent = context.getParentBundle(packageName);
-
+
if (rb != null) {
prb = new ProjectResourceBundle(name, rb);
prb.setParent(parent);
@@ -321,7 +294,7 @@
} else {
if (parent != null) {
if (parent instanceof ProjectResourceBundle) {
- prb = (ProjectResourceBundle)parent;
+ prb = (ProjectResourceBundle) parent;
} else {
prb = new ProjectResourceBundle(name, parent);
}
@@ -343,17 +316,16 @@
private static final String getPackage(String name) {
return name.substring(0, name.lastIndexOf('.')).intern();
}
-
+
/**
- * Construct a new ProjectResourceBundle
- */
+ * Construct a new ProjectResourceBundle
+ */
private ProjectResourceBundle(String name, ResourceBundle bundle)
- throws MissingResourceException
- {
+ throws MissingResourceException {
this.resourceBundle = bundle;
this.resourceName = name;
}
-
+
public String getResourceName() {
return resourceName;
}
@@ -361,11 +333,10 @@
/**
* Clears the internal cache
*/
- public static void clearCache()
- {
+ public static void clearCache() {
bundleCache.clear();
}
-
+
public String toString() {
return resourceName;
}
@@ -377,7 +348,7 @@
private String _projectName;
private String _resourceName;
private ResourceBundle _parent;
-
+
void setLocale(Locale l) {
/* 1. Docs indicate that if locale is not specified,
* then the default local is used in it's place.
@@ -396,38 +367,57 @@
}
// END FIX: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16868
}
-
- void setProjectName(String name) { _projectName = name.intern(); }
- void setResourceName(String name) { _resourceName = name.intern(); }
- void setParentBundle(ResourceBundle b) { _parent = b; }
-
- Locale getLocale() { return _locale; }
- ClassLoader getLoader() { return _loader; }
- String getProjectName() { return _projectName; }
- String getResourceName() { return _resourceName; }
- ResourceBundle getParentBundle() { return _parent; }
-
- String getCacheKey(String packageName)
- {
+
+ void setProjectName(String name) {
+ _projectName = name.intern();
+ }
+
+ void setResourceName(String name) {
+ _resourceName = name.intern();
+ }
+
+ void setParentBundle(ResourceBundle b) {
+ _parent = b;
+ }
+
+ Locale getLocale() {
+ return _locale;
+ }
+
+ ClassLoader getLoader() {
+ return _loader;
+ }
+
+ String getProjectName() {
+ return _projectName;
+ }
+
+ String getResourceName() {
+ return _resourceName;
+ }
+
+ ResourceBundle getParentBundle() {
+ return _parent;
+ }
+
+ String getCacheKey(String packageName) {
String loaderName = (_loader == null) ? "" : (":" + _loader.hashCode());
return packageName + "." + _resourceName + ":" + _locale + ":" + defaultLocale + loaderName;
}
- ResourceBundle loadBundle(String packageName)
- {
+ ResourceBundle loadBundle(String packageName) {
try {
return ResourceBundle.getBundle(packageName + '.' + _resourceName,
- _locale,
- _loader);
+ _locale,
+ _loader);
} catch (MissingResourceException e) {
// Deliberately surpressing print stack.. just the string for info.
log.debug("loadBundle: Ignoring MissingResourceException: " + e.getMessage());
}
return null;
}
-
- ResourceBundle getParentBundle(String packageName)
- {
+
+ ResourceBundle getParentBundle(String packageName) {
ResourceBundle p;
if (packageName != _projectName) {
p = getBundle(this, getPackage(packageName));
@@ -437,34 +427,33 @@
}
return p;
}
-
+
String validate(String packageName)
- throws MissingResourceException
- {
- if (_projectName == null || _projectName.length() == 0) {
+ throws MissingResourceException {
+ if (_projectName == null || _projectName.length() == 0) {
log.debug("Project name not specified");
throw new MissingResourceException("Project name not specified",
- "", "");
+ "", "");
}
- if (packageName == null || packageName.length() == 0) {
+ if (packageName == null || packageName.length() == 0) {
log.debug("Package name not specified");
throw new MissingResourceException("Package not specified",
- packageName, "");
+ packageName, "");
}
packageName = packageName.intern();
/* Ensure that project is a proper prefix of class.
* Terminate project name with '.' to ensure proper match.
*/
- if (packageName != _projectName && !packageName.startsWith(_projectName + '.')) {
+ if (packageName != _projectName && !packageName.startsWith(_projectName + '.')) {
log.debug("Project not a prefix of Package");
throw new MissingResourceException("Project '" + _projectName
- + "' must be a prefix of Package '"
- + packageName + "'",
- packageName + '.' + _resourceName, "");
+ + "' must be a prefix of Package '"
+ + packageName + "'",
+ packageName + '.' + _resourceName, "");
}
-
+
return packageName;
}
}