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 di...@apache.org on 2005/09/15 21:07:03 UTC
svn commit: r289289 [4/134] - in /webservices/axis2/trunk/java: ./ etc/
modules/addressing/ modules/addressing/src/META-INF/
modules/addressing/src/org/apache/axis2/handlers/addressing/
modules/addressing/test-resources/ modules/addressing/test/org/apa...
Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java Thu Sep 15 11:52:11 2005
@@ -1,150 +1,147 @@
-package org.apache.axis2.handlers.addressing;
-
-import junit.framework.TestCase;
-import org.apache.axis2.addressing.*;
-import org.apache.axis2.addressing.miheaders.RelatesTo;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.handlers.util.TestUtil;
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.impl.llom.util.XMLComparator;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-
-import javax.xml.namespace.QName;
-
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- */
-public class AddressingOutHandlerTest extends TestCase implements AddressingConstants {
- /**
- * Eran Chinthaka (chinthaka@apache.org)
- */
- private AddressingOutHandler outHandler;
- private MessageContext msgCtxt;
- private TestUtil testUtil;
-
- public AddressingOutHandlerTest(String testName) {
- super(testName);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- outHandler = new AddressingOutHandler();
- testUtil = new TestUtil();
-
- }
-
- public void testAddToSOAPHeader() throws Exception {
- EndpointReference replyTo = new EndpointReference("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
- EndpointReference epr = new EndpointReference("http://www.to.org/service/");
- epr.setInterfaceName(
- new QName("http://www.from.org/service/port/",
- "Port",
- "portNS"));
- epr.setServiceName(
- new ServiceName(
- new QName("http://www.from.org/service/",
- "Service",
- "serviceNS"),
- "port"));
-
- AnyContentType anyContentType = new AnyContentType();
- for (int i = 0; i < 5; i++) {
- anyContentType.addReferenceValue(
- new QName(Submission.WSA_NAMESPACE, "Reference" + i),
- "Value " + i * 100);
-
- }
-
- epr.setReferenceParameters(anyContentType);
-
- SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
- SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
-
- defaultEnvelope.getHeader().declareNamespace(Submission.WSA_NAMESPACE,
- "wsa");
- MessageContext msgCtxt = new MessageContext(null);
- msgCtxt.setTo(epr);
- msgCtxt.setReplyTo(replyTo);
- msgCtxt.setEnvelope(defaultEnvelope);
- outHandler.invoke(msgCtxt);
-
- StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder("eprTest.xml");
- XMLComparator xmlComparator = new XMLComparator();
- assertTrue(
- xmlComparator.compare(omBuilder.getDocumentElement(),
- defaultEnvelope));
- }
-
- public void testHeaderCreationFromMsgCtxtInformation() throws Exception {
- MessageInformationHeaders mIHeaders = new MessageInformationHeaders();
-
- AnyContentType referenceValues = new AnyContentType();
-
- EndpointReference epr = new EndpointReference("http://www.from.org/service/");
- referenceValues.addReferenceValue(new QName("Reference2"),
- "Value 200");
- epr.setReferenceParameters(referenceValues);
- mIHeaders.setFrom(epr);
-
- epr = new EndpointReference("http://www.to.org/service/");
- referenceValues = new AnyContentType();
- referenceValues.addReferenceValue(
- new QName("http://reference.org", "Reference4", "myRef"),
- "Value 400");
- referenceValues.addReferenceValue(
- new QName("http://reference.org", "Reference3", "myRef"),
- "Value 300");
- epr.setReferenceParameters(referenceValues);
-
- epr.setServiceName(
- new ServiceName(
- new QName("http://www.from.org/service/",
- "Service",
- "serviceNS"),
- "port"));
-
- epr.setInterfaceName(
- new QName("http://www.from.org/service/port/",
- "Port",
- "portNS"));
- mIHeaders.setTo(epr);
-
- epr =
- new EndpointReference("http://www.replyTo.org/service/");
- mIHeaders.setReplyTo(epr);
-
- mIHeaders.setMessageId("123456-7890");
- mIHeaders.setAction("http://www.actions.org/action");
-
- RelatesTo relatesTo = new RelatesTo(
- "http://www.relatesTo.org/service/", "TestRelation");
- mIHeaders.setRelatesTo(relatesTo);
-
- msgCtxt = new MessageContext(null);
- msgCtxt.setMessageInformationHeaders(mIHeaders);
- msgCtxt.setEnvelope(
- OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
- outHandler.invoke(msgCtxt);
-
- XMLComparator xmlComparator = new XMLComparator();
- assertTrue(
- xmlComparator.compare(msgCtxt.getEnvelope(),
- testUtil.getOMBuilder("OutHandlerTest.xml")
- .getDocumentElement()));
- }
-}
+/*
+ * 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.handlers.addressing;
+
+import junit.framework.TestCase;
+import org.apache.axis2.addressing.*;
+import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.util.TestUtil;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.impl.llom.util.XMLComparator;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+import javax.xml.namespace.QName;
+
+public class AddressingOutHandlerTest extends TestCase implements AddressingConstants {
+ private AddressingOutHandler outHandler;
+ private MessageContext msgCtxt;
+ private TestUtil testUtil;
+
+ public AddressingOutHandlerTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ outHandler = new AddressingOutHandler();
+ testUtil = new TestUtil();
+
+ }
+
+ public void testAddToSOAPHeader() throws Exception {
+ EndpointReference replyTo = new EndpointReference("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
+ EndpointReference epr = new EndpointReference("http://www.to.org/service/");
+ epr.setInterfaceName(
+ new QName("http://www.from.org/service/port/",
+ "Port",
+ "portNS"));
+ epr.setServiceName(
+ new ServiceName(
+ new QName("http://www.from.org/service/",
+ "Service",
+ "serviceNS"),
+ "port"));
+
+ AnyContentType anyContentType = new AnyContentType();
+ for (int i = 0; i < 5; i++) {
+ anyContentType.addReferenceValue(
+ new QName(Submission.WSA_NAMESPACE, "Reference" + i),
+ "Value " + i * 100);
+
+ }
+
+ epr.setReferenceParameters(anyContentType);
+
+ SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+ SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
+
+ defaultEnvelope.getHeader().declareNamespace(Submission.WSA_NAMESPACE,
+ "wsa");
+ MessageContext msgCtxt = new MessageContext(null);
+ msgCtxt.setTo(epr);
+ msgCtxt.setReplyTo(replyTo);
+ msgCtxt.setEnvelope(defaultEnvelope);
+ outHandler.invoke(msgCtxt);
+
+ StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder("eprTest.xml");
+ XMLComparator xmlComparator = new XMLComparator();
+ assertTrue(
+ xmlComparator.compare(omBuilder.getDocumentElement(),
+ defaultEnvelope));
+ }
+
+ public void testHeaderCreationFromMsgCtxtInformation() throws Exception {
+ MessageInformationHeaders mIHeaders = new MessageInformationHeaders();
+
+ AnyContentType referenceValues = new AnyContentType();
+
+ EndpointReference epr = new EndpointReference("http://www.from.org/service/");
+ referenceValues.addReferenceValue(new QName("Reference2"),
+ "Value 200");
+ epr.setReferenceParameters(referenceValues);
+ mIHeaders.setFrom(epr);
+
+ epr = new EndpointReference("http://www.to.org/service/");
+ referenceValues = new AnyContentType();
+ referenceValues.addReferenceValue(
+ new QName("http://reference.org", "Reference4", "myRef"),
+ "Value 400");
+ referenceValues.addReferenceValue(
+ new QName("http://reference.org", "Reference3", "myRef"),
+ "Value 300");
+ epr.setReferenceParameters(referenceValues);
+
+ epr.setServiceName(
+ new ServiceName(
+ new QName("http://www.from.org/service/",
+ "Service",
+ "serviceNS"),
+ "port"));
+
+ epr.setInterfaceName(
+ new QName("http://www.from.org/service/port/",
+ "Port",
+ "portNS"));
+ mIHeaders.setTo(epr);
+
+ epr =
+ new EndpointReference("http://www.replyTo.org/service/");
+ mIHeaders.setReplyTo(epr);
+
+ mIHeaders.setMessageId("123456-7890");
+ mIHeaders.setAction("http://www.actions.org/action");
+
+ RelatesTo relatesTo = new RelatesTo(
+ "http://www.relatesTo.org/service/", "TestRelation");
+ mIHeaders.setRelatesTo(relatesTo);
+
+ msgCtxt = new MessageContext(null);
+ msgCtxt.setMessageInformationHeaders(mIHeaders);
+ msgCtxt.setEnvelope(
+ OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope());
+ outHandler.invoke(msgCtxt);
+
+ XMLComparator xmlComparator = new XMLComparator();
+ assertTrue(
+ xmlComparator.compare(msgCtxt.getEnvelope(),
+ testUtil.getOMBuilder("OutHandlerTest.xml")
+ .getDocumentElement()));
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java Thu Sep 15 11:52:11 2005
@@ -1,51 +1,47 @@
-package org.apache.axis2.handlers.util;
-
-import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.FileReader;
-
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- */
-public class TestUtil {
-
- /**
- * Eran Chinthaka (chinthaka@apache.org)
- */
-
- protected static final String IN_FILE_NAME = "soapmessage.xml";
- protected StAXSOAPModelBuilder builder;
- protected String testResourceDir = "test-resources";
-
-
- public StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {
- if ("".equals(fileName) || fileName == null) {
- fileName = IN_FILE_NAME;
- }
- XMLStreamReader parser = XMLInputFactory.newInstance()
- .createXMLStreamReader(
- new FileReader(getTestResourceFile(fileName)));
- builder = new StAXSOAPModelBuilder(parser, null);
- return builder;
- }
-
- protected File getTestResourceFile(String relativePath) {
- return new File(testResourceDir, relativePath);
- }
-}
+/*
+ * 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.handlers.util;
+
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.FileReader;
+
+public class TestUtil {
+
+ protected static final String IN_FILE_NAME = "soapmessage.xml";
+ protected StAXSOAPModelBuilder builder;
+ protected String testResourceDir = "test-resources";
+
+
+ public StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {
+ if ("".equals(fileName) || fileName == null) {
+ fileName = IN_FILE_NAME;
+ }
+ XMLStreamReader parser = XMLInputFactory.newInstance()
+ .createXMLStreamReader(
+ new FileReader(getTestResourceFile(fileName)));
+ builder = new StAXSOAPModelBuilder(parser, null);
+ return builder;
+ }
+
+ protected File getTestResourceFile(String relativePath) {
+ return new File(testResourceDir, relativePath);
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/util/TestUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/common/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/project.xml?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/project.xml (original)
+++ webservices/axis2/trunk/java/modules/common/project.xml Thu Sep 15 11:52:11 2005
@@ -1,66 +1,66 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * Copyright 2001-2004 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.
- */
- -->
-<project>
- <pomVersion>3</pomVersion>
- <extend>../../etc/project.xml</extend>
-
- <name>Apache Axis 2.0 - Common</name>
- <id>axis2-common</id>
- <groupId>axis2</groupId>
- <description>Common implementation classes</description>
-
- <reports>
- <report>maven-junit-report-plugin</report>
- </reports>
-
- <dependencies>
- <!-- external JARs -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>maven-itest-plugin</groupId>
- <artifactId>maven-itest-plugin</artifactId>
- <version>1.0</version>
- <type>plugin</type>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <properties>
- <classloader>root</classloader>
- </properties>
- </dependency>
- </dependencies>
- <reports/>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-2004 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.
+ */
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../../etc/project.xml</extend>
+
+ <name>Apache Axis 2.0 - Common</name>
+ <id>axis2-common</id>
+ <groupId>axis2</groupId>
+ <description>Common implementation classes</description>
+
+ <reports>
+ <report>maven-junit-report-plugin</report>
+ </reports>
+
+ <dependencies>
+ <!-- external JARs -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.3</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.8</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>maven-itest-plugin</groupId>
+ <artifactId>maven-itest-plugin</artifactId>
+ <version>1.0</version>
+ <type>plugin</type>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <properties>
+ <classloader>root</classloader>
+ </properties>
+ </dependency>
+ </dependencies>
+ <reports/>
+</project>
Propchange: webservices/axis2/trunk/java/modules/common/project.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java Thu Sep 15 11:52:11 2005
@@ -1,106 +1,107 @@
-/*
- * 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 implements SOAPFaultException{
- 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;
- }
-
- public String getFaultCode() {
- return soapFaultCode;
- }
-
- public void setFaultCode(String soapFaultCode) {
- this.soapFaultCode = soapFaultCode;
- }
-}
+/*
+ * 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 implements SOAPFaultException{
+ 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;
+ }
+
+ public String getFaultCode() {
+ return soapFaultCode;
+ }
+
+ public void setFaultCode(String soapFaultCode) {
+ this.soapFaultCode = soapFaultCode;
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/AxisFault.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/SOAPFaultException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/SOAPFaultException.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/SOAPFaultException.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/SOAPFaultException.java Thu Sep 15 11:52:11 2005
@@ -1,26 +1,23 @@
-package org.apache.axis2;
-
-
-/*
- * 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.
- *
- * author : Eran Chinthaka (chinthaka@apache.org)
- */
-
-public interface SOAPFaultException {
- public String getFaultCode();
- public void setFaultCode(String faultCode);
- public String getMessage();
-}
+/*
+ * 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;
+
+public interface SOAPFaultException {
+ public String getFaultCode();
+ public void setFaultCode(String faultCode);
+ public String getMessage();
+}
Propchange: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/SOAPFaultException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java Thu Sep 15 11:52:11 2005
@@ -1,204 +1,204 @@
-/*
- * Copyright 2001-2004 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.i18n;
-
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * 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;
- private final String packageName;
- private final String resourceName;
- private final Locale locale;
- private final ClassLoader classLoader;
- private final ResourceBundle parent;
-
-
- public final ProjectResourceBundle getResourceBundle() {
- if (!loaded) {
- _resourceBundle = ProjectResourceBundle.getBundle(projectName,
- packageName,
- resourceName,
- locale,
- classLoader,
- parent);
- loaded = true;
- }
- return _resourceBundle;
- }
-
- /**
- * Construct a new ExtendMessages
- */
- public MessageBundle(String projectName,
- String packageName,
- String resourceName,
- Locale locale,
- ClassLoader classLoader,
- ResourceBundle parent)
- throws MissingResourceException {
- this.projectName = projectName;
- this.packageName = packageName;
- this.resourceName = resourceName;
- this.locale = locale;
- this.classLoader = classLoader;
- this.parent = parent;
- }
-
- /**
- * 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 {
- String msg = null;
- if (getResourceBundle() != null) {
- msg = getResourceBundle().getString(key);
- }
-
- if (msg == null) {
- throw new MissingResourceException("Cannot find resource key \"" + key +
- "\" in base name " +
- getResourceBundle().getResourceName(),
- getResourceBundle().getResourceName(), key);
- }
-
- return MessageFormat.format(msg, array);
- }
-}
+/*
+ * 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.i18n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * 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;
+ private final String packageName;
+ private final String resourceName;
+ private final Locale locale;
+ private final ClassLoader classLoader;
+ private final ResourceBundle parent;
+
+
+ public final ProjectResourceBundle getResourceBundle() {
+ if (!loaded) {
+ _resourceBundle = ProjectResourceBundle.getBundle(projectName,
+ packageName,
+ resourceName,
+ locale,
+ classLoader,
+ parent);
+ loaded = true;
+ }
+ return _resourceBundle;
+ }
+
+ /**
+ * Construct a new ExtendMessages
+ */
+ public MessageBundle(String projectName,
+ String packageName,
+ String resourceName,
+ Locale locale,
+ ClassLoader classLoader,
+ ResourceBundle parent)
+ throws MissingResourceException {
+ this.projectName = projectName;
+ this.packageName = packageName;
+ this.resourceName = resourceName;
+ this.locale = locale;
+ this.classLoader = classLoader;
+ this.parent = parent;
+ }
+
+ /**
+ * 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 {
+ String msg = null;
+ if (getResourceBundle() != null) {
+ msg = getResourceBundle().getString(key);
+ }
+
+ if (msg == null) {
+ throw new MissingResourceException("Cannot find resource key \"" + key +
+ "\" in base name " +
+ getResourceBundle().getResourceName(),
+ getResourceBundle().getResourceName(), key);
+ }
+
+ return MessageFormat.format(msg, array);
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessageBundle.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java Thu Sep 15 11:52:11 2005
@@ -1,169 +1,153 @@
-/*
- * Copyright 2001-2004 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.i18n;
-
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-
-/**
- * @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 String projectName = MessagesConstants.projectName;
-
- private static final String resourceName = MessagesConstants.resourceName;
- private static final Locale locale = MessagesConstants.locale;
-
- private static final String packageName = getPackage(thisClass.getName());
- private static final ClassLoader classLoader = thisClass.getClassLoader();
-
- private static final ResourceBundle parent =
- (MessagesConstants.rootPackageName.equals(packageName))
- ? null
- : MessagesConstants.rootBundle;
-
-
- /**
- * ** NO NEED TO CHANGE ANYTHING BELOW ****
- */
-
- private static final MessageBundle messageBundle =
- 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
- */
- public static String getMessage(String key)
- 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
- */
- public static String getMessage(String key, String arg0)
- 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
- */
- public static String getMessage(String key, String arg0, String arg1)
- 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
- */
- public static String getMessage(String key, String arg0, String arg1, String arg2)
- 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
- */
- public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3)
- 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
- */
- public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4)
- 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
- */
- public static String getMessage(String key, String[] args)
- throws MissingResourceException {
- return messageBundle.getMessage(key, args);
- }
-
- public static ResourceBundle getResourceBundle() {
- return messageBundle.getResourceBundle();
- }
-
- public static MessageBundle getMessageBundle() {
- return messageBundle;
- }
-
- private static final String getPackage(String name) {
- return name.substring(0, name.lastIndexOf('.')).intern();
- }
-}
+/*
+ * 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.i18n;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages {
+ private static final Class thisClass = Messages.class;
+
+ private static final String projectName = MessagesConstants.projectName;
+
+ private static final String resourceName = MessagesConstants.resourceName;
+ private static final Locale locale = MessagesConstants.locale;
+
+ private static final String packageName = getPackage(thisClass.getName());
+ private static final ClassLoader classLoader = thisClass.getClassLoader();
+
+ private static final ResourceBundle parent =
+ (MessagesConstants.rootPackageName.equals(packageName))
+ ? null
+ : MessagesConstants.rootBundle;
+
+
+ /**
+ * ** NO NEED TO CHANGE ANYTHING BELOW ****
+ */
+
+ private static final MessageBundle messageBundle =
+ 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
+ */
+ public static String getMessage(String key)
+ 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
+ */
+ public static String getMessage(String key, String arg0)
+ 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
+ */
+ public static String getMessage(String key, String arg0, String arg1)
+ 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
+ */
+ public static String getMessage(String key, String arg0, String arg1, String arg2)
+ 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
+ */
+ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3)
+ 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
+ */
+ public static String getMessage(String key, String arg0, String arg1, String arg2, String arg3, String arg4)
+ 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
+ */
+ public static String getMessage(String key, String[] args)
+ throws MissingResourceException {
+ return messageBundle.getMessage(key, args);
+ }
+
+ public static ResourceBundle getResourceBundle() {
+ return messageBundle.getResourceBundle();
+ }
+
+ public static MessageBundle getMessageBundle() {
+ return messageBundle;
+ }
+
+ private static final String getPackage(String name) {
+ return name.substring(0, name.lastIndexOf('.')).intern();
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/Messages.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java Thu Sep 15 11:52:11 2005
@@ -1,39 +1,36 @@
-/*
- * Copyright 2001-2004 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.i18n;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * @author Richard A. Sitze (rsitze@us.ibm.com)
- */
-public class MessagesConstants {
- public static final String projectName = "org.apache.axis2".intern();
- public static final String resourceName = "resource".intern();
- public static final Locale locale = null;
-
- 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);
-}
+/*
+ * 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.i18n;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+public class MessagesConstants {
+ public static final String projectName = "org.apache.axis2".intern();
+ public static final String resourceName = "resource".intern();
+ public static final Locale locale = null;
+
+ 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);
+}
Propchange: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/MessagesConstants.java
------------------------------------------------------------------------------
svn:eol-style = native