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 2002/10/28 14:50:40 UTC
cvs commit: xml-axis/java/test/utils TestSrcContent.java
dims 2002/10/28 05:50:40
Modified: java/src/org/apache/axis/ime
ConfigurableMessageExchange.java
ConfigurableMessageExchangeFactory.java
MessageChannel.java MessageExchange.java
MessageExchangeConstants.java
MessageExchangeContext.java
MessageExchangeContextListener.java
MessageExchangeCorrelator.java
MessageExchangeCorrelatorService.java
MessageExchangeFactory.java
MessageExchangeFaultListener.java
MessageExchangeLifecycle.java
MessageExchangeReceiveListener.java
MessageExchangeStatus.java
MessageExchangeStatusListener.java
java/src/org/apache/axis/ime/internal/util/handler
HandlerWrapper1.java HandlerWrapper2.java
java/src/org/apache/axis/ime/internal
MessageExchangeImpl.java
MessageExchangeProvider.java
MessageExchangeProvider1.java
MessageExchangeProvider2.java MessageWorker.java
MessageWorkerGroup.java
NonPersistentMessageChannel.java
NonPersistentMessageExchangeCorrelatorService.java
java/src/org/apache/axis/i18n resource.properties
java/src/org/apache/axis/ime/internal/util/uuid
SimpleUUIDGen.java UUIDGen.java UUIDGenFactory.java
java/test/utils TestSrcContent.java
Added: java/src/org/apache/axis/ime/internal/util/uuid
TestUUID.java
Log:
Fixes for "ant clean all-tests failure":
- Don't use System.out or System.err in any code
- Don't use an exception with no description
Other changes:
- Add copyright notice to all files
- Extract test driver for UUID gen to TestUUID.java
- Cleanup imports (specify individual classes)
- Cleanup formatting a bit.
Revision Changes Path
1.2 +14 -14 xml-axis/java/src/org/apache/axis/ime/ConfigurableMessageExchange.java
Index: ConfigurableMessageExchange.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/ConfigurableMessageExchange.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConfigurableMessageExchange.java 26 Oct 2002 21:46:46 -0000 1.1
+++ ConfigurableMessageExchange.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -12,28 +12,28 @@
*
* @author James M Snell (jasnell@us.ibm.com)
*/
-public interface ConfigurableMessageExchange
- extends MessageExchange {
+public interface ConfigurableMessageExchange
+ extends MessageExchange {
public void enableFeature(String featureId);
-
+
public void disableFeature(String featureId);
-
+
public boolean isFeatureEnabled(String featureId);
-
+
public void setProperty(
- String propertyId,
- Object propertyValue);
-
+ String propertyId,
+ Object propertyValue);
+
public Object getProperty(
- String propertyId);
-
+ String propertyId);
+
public Object getProperty(
- String propertyId,
- Object defaultValue);
-
+ String propertyId,
+ Object defaultValue);
+
public Map getProperties();
-
+
public void clearProperties();
}
1.2 +3 -3 xml-axis/java/src/org/apache/axis/ime/ConfigurableMessageExchangeFactory.java
Index: ConfigurableMessageExchangeFactory.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/ConfigurableMessageExchangeFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ConfigurableMessageExchangeFactory.java 26 Oct 2002 21:46:46 -0000 1.1
+++ ConfigurableMessageExchangeFactory.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -6,10 +6,10 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public interface ConfigurableMessageExchangeFactory
- extends MessageExchangeFactory {
+ extends MessageExchangeFactory {
public ConfigurableMessageExchange createMessageExchange(
- Map properties,
- String[] enabledFeatures);
+ Map properties,
+ String[] enabledFeatures);
}
1.2 +14 -14 xml-axis/java/src/org/apache/axis/ime/MessageChannel.java
Index: MessageChannel.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageChannel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageChannel.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageChannel.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -28,14 +28,14 @@
* channel. If one does not exist, return null
*/
public MessageExchangeContext peek();
-
+
/**
* Put a message onto the channel
*/
public void put(
- Object key,
- MessageExchangeContext context);
-
+ Object key,
+ MessageExchangeContext context);
+
/**
* Cancel a message that has been put on the channel.
* Unlike select(Object key), this method will not block
@@ -43,7 +43,7 @@
* put onto the MessageChannel.
*/
public MessageExchangeContext cancel(
- Object key);
+ Object key);
/**
* Select and remove all of the messages currently in
@@ -53,15 +53,15 @@
* returns (it is possible that another thread may
* put new MessageContexts into the channel before this
* operation completes)
- */
+ */
public MessageExchangeContext[] selectAll();
-
+
/**
* Select and remove the next message in the channel
* If a message is not available, wait indefinitely for one
*/
public MessageExchangeContext select()
- throws InterruptedException;
+ throws InterruptedException;
/**
* Select and remove the next message in the channel
@@ -69,16 +69,16 @@
* of time for one
*/
public MessageExchangeContext select(
- long timeout)
+ long timeout)
throws InterruptedException;
-
+
/**
* Select and remove a specific message in the channel
* If the message is not available, wait indefinitely
* for one to be available
*/
public MessageExchangeContext select(
- Object key)
+ Object key)
throws InterruptedException;
/**
@@ -87,7 +87,7 @@
* amount of time for one
*/
public MessageExchangeContext select(
- Object key,
- long timeout)
- throws InterruptedException;
+ Object key,
+ long timeout)
+ throws InterruptedException;
}
1.2 +27 -27 xml-axis/java/src/org/apache/axis/ime/MessageExchange.java
Index: MessageExchange.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchange.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchange.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchange.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -19,9 +19,9 @@
* exist.)
*/
public MessageExchangeCorrelator send(
- MessageContext context)
+ MessageContext context)
throws AxisFault;
-
+
/**
* Will attempt to cancel the outbound MessageExchange
* process for a given message context. Returns true if
@@ -31,92 +31,92 @@
* reason.
*/
public MessageContext cancel(
- MessageExchangeCorrelator correlator)
+ MessageExchangeCorrelator correlator)
throws AxisFault;
-
+
/**
* Waits indefinitely for a message to be received
*/
public MessageContext receive()
- throws AxisFault;
-
+ throws AxisFault;
+
/**
* Waits the specified amount of time for a message to
* be received
*/
public MessageContext receive(
- long timeout)
+ long timeout)
throws AxisFault;
-
+
/**
* Will instruct the MessageExchange provider to
* wait for a message to be received.
*/
public void startListening();
-
+
/**
* Will instruct the MessageExchange provider to
* wait for a specific MessageExchangeCorrelator
*/
public void startListening(
- MessageExchangeCorrelator correlator);
-
+ MessageExchangeCorrelator correlator);
+
/**
* Will instruct the MessageExchange provider to
* stop listening
*/
public void stopListening();
-
+
/**
* Synchronized send and receive
*/
public MessageContext sendAndReceive(
- MessageContext context)
+ MessageContext context)
throws AxisFault;
-
+
/**
* Synchronized send and receive with timeout
*/
public MessageContext sendAndReceive(
- MessageContext context,
- long timeout)
+ MessageContext context,
+ long timeout)
throws AxisFault;
-
+
/**
* Allows applications to listen for changes to
* the current disposition of the MessageExchange operation
* (push model)
*/
public void setMessageExchangeStatusListener(
- MessageExchangeStatusListener listener)
+ MessageExchangeStatusListener listener)
throws AxisFault;
-
+
/**
* Allows applications to listen for inbound messages
* (push model)
*/
public void setMessageExchangeReceiveListener(
- MessageExchangeReceiveListener listener)
+ MessageExchangeReceiveListener listener)
throws AxisFault;
-
+
/**
* Allows applications to listen for faults/exceptions
* (push model)
- */
+ */
public void setMessageExchangeFaultListener(
- MessageExchangeFaultListener listener)
+ MessageExchangeFaultListener listener)
throws AxisFault;
-
+
/**
* Allows MessageExchange consumers low level access
* to the Send message channel
*/
public MessageChannel getSendChannel();
-
+
/**
* Allows MessageExchange consumers low level access
* to the Receive message channel
- */
+ */
public MessageChannel getReceiveChannel();
-
+
}
1.2 +9 -9 xml-axis/java/src/org/apache/axis/ime/MessageExchangeConstants.java
Index: MessageExchangeConstants.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeConstants.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeConstants.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -11,9 +11,9 @@
* Identifies the MessageExchangeCorrelator property
* within the MessageContext
*/
- public static final String MESSAGE_CORRELATOR_PROPERTY =
- MessageExchangeCorrelator.class.getName();
-
+ public static final String MESSAGE_CORRELATOR_PROPERTY =
+ MessageExchangeCorrelator.class.getName();
+
/**
* Boolean MessageContext property that indicates whether or
* not the MessageExchangeCorrelationService should be used.
@@ -21,13 +21,13 @@
* required)
*/
public static final String ENABLE_CORRELATOR_SERVICE =
- MESSAGE_CORRELATOR_PROPERTY + "::Enable";
-
+ MESSAGE_CORRELATOR_PROPERTY + "::Enable";
+
/**
* Default value for the ENABLE_CORRELATOR_SERVICE
* MessageContext property
- */
- public static final Boolean ENABLE_CORRELATOR_SERVICE_DEFAULT =
- new Boolean(true);
-
+ */
+ public static final Boolean ENABLE_CORRELATOR_SERVICE_DEFAULT =
+ new Boolean(true);
+
}
1.2 +25 -23 xml-axis/java/src/org/apache/axis/ime/MessageExchangeContext.java
Index: MessageExchangeContext.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeContext.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeContext.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -1,8 +1,9 @@
package org.apache.axis.ime;
-import java.io.Serializable;
import org.apache.axis.MessageContext;
+import java.io.Serializable;
+
/**
* Note: the only challenge with making this class serializable
* is that org.apache.axis.MessageContext is currently NOT
@@ -14,48 +15,49 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public final class MessageExchangeContext
- implements Serializable {
+ implements Serializable {
public static MessageExchangeContext newInstance(
- MessageExchangeCorrelator correlator,
- MessageExchangeStatusListener statusListener,
- MessageExchangeReceiveListener receiveListener,
- MessageExchangeFaultListener faultListener,
- MessageContext context) {
- MessageExchangeContext mectx =
- new MessageExchangeContext();
- mectx.correlator = correlator;
- mectx.statusListener = statusListener;
- mectx.receiveListener = receiveListener;
- mectx.faultListener = faultListener;
- mectx.context = context;
- return mectx;
+ MessageExchangeCorrelator correlator,
+ MessageExchangeStatusListener statusListener,
+ MessageExchangeReceiveListener receiveListener,
+ MessageExchangeFaultListener faultListener,
+ MessageContext context) {
+ MessageExchangeContext mectx =
+ new MessageExchangeContext();
+ mectx.correlator = correlator;
+ mectx.statusListener = statusListener;
+ mectx.receiveListener = receiveListener;
+ mectx.faultListener = faultListener;
+ mectx.context = context;
+ return mectx;
}
-
+
protected MessageExchangeCorrelator correlator;
protected MessageExchangeStatusListener statusListener;
protected MessageExchangeReceiveListener receiveListener;
protected MessageExchangeFaultListener faultListener;
protected MessageContext context;
-
- protected MessageExchangeContext() {}
-
+
+ protected MessageExchangeContext() {
+ }
+
public MessageExchangeCorrelator getMessageExchangeCorrelator() {
return this.correlator;
}
-
+
public MessageExchangeReceiveListener getMessageExchangeReceiveListener() {
return this.receiveListener;
}
-
+
public MessageExchangeStatusListener getMessageExchangeStatusListener() {
return this.statusListener;
}
-
+
public MessageExchangeFaultListener getMessageExchangeFaultListener() {
return this.faultListener;
}
-
+
public MessageContext getMessageContext() {
return this.context;
}
1.2 +2 -3 xml-axis/java/src/org/apache/axis/ime/MessageExchangeContextListener.java
Index: MessageExchangeContextListener.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeContextListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeContextListener.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeContextListener.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -1,15 +1,14 @@
package org.apache.axis.ime;
import java.io.Serializable;
-import org.apache.axis.ime.*;
/**
* @author James M Snell (jasnell@us.ibm.com)
*/
public interface MessageExchangeContextListener
- extends Serializable {
+ extends Serializable {
public void onMessageExchangeContext(
- MessageExchangeContext context);
+ MessageExchangeContext context);
}
1.2 +6 -5 xml-axis/java/src/org/apache/axis/ime/MessageExchangeCorrelator.java
Index: MessageExchangeCorrelator.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeCorrelator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeCorrelator.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeCorrelator.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -10,15 +10,16 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public class MessageExchangeCorrelator
- implements Serializable {
+ implements Serializable {
private String identifier;
- private MessageExchangeCorrelator() {}
-
+ private MessageExchangeCorrelator() {
+ }
+
public MessageExchangeCorrelator(
- String identifier) {
- this.identifier = identifier;
+ String identifier) {
+ this.identifier = identifier;
}
public String getIdentifier() {
1.2 +4 -4 xml-axis/java/src/org/apache/axis/ime/MessageExchangeCorrelatorService.java
Index: MessageExchangeCorrelatorService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeCorrelatorService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeCorrelatorService.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeCorrelatorService.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -6,10 +6,10 @@
public interface MessageExchangeCorrelatorService {
public void put(
- MessageExchangeCorrelator correlator,
- MessageExchangeContext context);
-
+ MessageExchangeCorrelator correlator,
+ MessageExchangeContext context);
+
public MessageExchangeContext get(
- MessageExchangeCorrelator correlator);
+ MessageExchangeCorrelator correlator);
}
1.2 +1 -1 xml-axis/java/src/org/apache/axis/ime/MessageExchangeFactory.java
Index: MessageExchangeFactory.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeFactory.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeFactory.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -6,5 +6,5 @@
public interface MessageExchangeFactory {
public MessageExchange createMessageExchange();
-
+
}
1.2 +3 -3 xml-axis/java/src/org/apache/axis/ime/MessageExchangeFaultListener.java
Index: MessageExchangeFaultListener.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeFaultListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeFaultListener.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeFaultListener.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -6,10 +6,10 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public interface MessageExchangeFaultListener
- extends Serializable {
+ extends Serializable {
public void onFault(
- MessageExchangeCorrelator correlator,
- Throwable exception);
+ MessageExchangeCorrelator correlator,
+ Throwable exception);
}
1.2 +6 -6 xml-axis/java/src/org/apache/axis/ime/MessageExchangeLifecycle.java
Index: MessageExchangeLifecycle.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeLifecycle.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeLifecycle.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeLifecycle.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -10,15 +10,15 @@
public interface MessageExchangeLifecycle {
public void init();
-
+
public void shutdown();
-
+
public void shutdown(boolean force);
-
+
public void awaitShutdown()
- throws InterruptedException;
-
+ throws InterruptedException;
+
public void awaitShutdown(long timeout)
- throws InterruptedException;
+ throws InterruptedException;
}
1.2 +5 -4 xml-axis/java/src/org/apache/axis/ime/MessageExchangeReceiveListener.java
Index: MessageExchangeReceiveListener.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeReceiveListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeReceiveListener.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeReceiveListener.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -1,16 +1,17 @@
package org.apache.axis.ime;
-import java.io.Serializable;
import org.apache.axis.MessageContext;
+import java.io.Serializable;
+
/**
* @author James M Snell (jasnell@us.ibm.com)
*/
public interface MessageExchangeReceiveListener
- extends Serializable {
+ extends Serializable {
public void onReceive(
- MessageExchangeCorrelator correlator,
- MessageContext context);
+ MessageExchangeCorrelator correlator,
+ MessageContext context);
}
1.2 +2 -1 xml-axis/java/src/org/apache/axis/ime/MessageExchangeStatus.java
Index: MessageExchangeStatus.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeStatus.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeStatus.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeStatus.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -8,4 +8,5 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public interface MessageExchangeStatus
- extends Serializable {}
+ extends Serializable {
+}
1.2 +3 -3 xml-axis/java/src/org/apache/axis/ime/MessageExchangeStatusListener.java
Index: MessageExchangeStatusListener.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/MessageExchangeStatusListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeStatusListener.java 26 Oct 2002 21:46:46 -0000 1.1
+++ MessageExchangeStatusListener.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -6,10 +6,10 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public interface MessageExchangeStatusListener
- extends Serializable {
+ extends Serializable {
public void onStatus(
- MessageExchangeCorrelator correlator,
- MessageExchangeStatus status);
+ MessageExchangeCorrelator correlator,
+ MessageExchangeStatus status);
}
1.2 +140 -92 xml-axis/java/src/org/apache/axis/ime/internal/util/handler/HandlerWrapper1.java
Index: HandlerWrapper1.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/handler/HandlerWrapper1.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HandlerWrapper1.java 26 Oct 2002 22:05:05 -0000 1.1
+++ HandlerWrapper1.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -1,118 +1,166 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal.util.handler;
-import org.apache.axis.Message;
+import org.apache.axis.Handler;
import org.apache.axis.MessageContext;
-import org.apache.axis.ime.MessageExchange;
import org.apache.axis.ime.MessageExchangeContext;
import org.apache.axis.ime.MessageExchangeContextListener;
+import org.apache.axis.ime.MessageExchangeCorrelator;
import org.apache.axis.ime.MessageExchangeFaultListener;
-import org.apache.axis.ime.MessageExchangeStatus;
-import org.apache.axis.ime.MessageExchangeStatusListener;
import org.apache.axis.ime.MessageExchangeReceiveListener;
-import org.apache.axis.ime.MessageExchangeCorrelator;
-import org.apache.axis.ime.internal.NonPersistentMessageChannel;
-import org.apache.axis.ime.internal.MessageExchangeImpl;
import org.apache.axis.ime.internal.MessageExchangeProvider1;
-import org.apache.axis.ime.internal.MessageWorkerGroup;
-import org.apache.axis.Handler;
/**
* Used to wrap synchronous handlers (e.g. Axis 1.0 transports)
*
* @author James M Snell (jasnell@us.ibm.com)
*/
-public class HandlerWrapper1
- extends MessageExchangeProvider1 {
+public class HandlerWrapper1
+ extends MessageExchangeProvider1 {
- private Handler handler;
-
- public HandlerWrapper1(Handler handler) {
- this.handler = handler;
- }
-
- /**
- * @see org.apache.axis.ime.internal.MessageExchangeProvider1#createReceiveMessageContextListener()
- */
- protected MessageExchangeContextListener createReceiveMessageContextListener() {
- return new ReceiveListener();
- }
-
- /**
- * @see org.apache.axis.ime.internal.MessageExchangeProvider1#createSendMessageContextListener()
- */
- protected MessageExchangeContextListener createSendMessageContextListener() {
- return new SendListener(handler);
- }
-
-
- public class SendListener
- implements MessageExchangeContextListener {
-
private Handler handler;
-
- public SendListener(Handler handler) {
- this.handler = handler;
+
+ public HandlerWrapper1(Handler handler) {
+ this.handler = handler;
}
-
+
/**
- * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ * @see org.apache.axis.ime.internal.MessageExchangeProvider1#createReceiveMessageContextListener()
*/
- public void onMessageExchangeContext(
- MessageExchangeContext context) {
- try {
- MessageContext msgContext =
- context.getMessageContext();
- MessageExchangeCorrelator correlator =
- context.getMessageExchangeCorrelator();
-
- // should I do init's and cleanup's in here?
- handler.invoke(msgContext);
-
-
- RECEIVE.put(correlator, context);
- } catch (Exception exception) {
- MessageExchangeFaultListener listener =
- context.getMessageExchangeFaultListener();
- if (listener != null)
- listener.onFault(
- context.getMessageExchangeCorrelator(),
- exception);
- }
+ protected MessageExchangeContextListener createReceiveMessageContextListener() {
+ return new ReceiveListener();
}
- }
-
- public class ReceiveListener
- implements MessageExchangeContextListener {
-
+
/**
- * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ * @see org.apache.axis.ime.internal.MessageExchangeProvider1#createSendMessageContextListener()
*/
- public void onMessageExchangeContext(
- MessageExchangeContext context) {
+ protected MessageExchangeContextListener createSendMessageContextListener() {
+ return new SendListener(handler);
+ }
+
+
+ public class SendListener
+ implements MessageExchangeContextListener {
+
+ private Handler handler;
+
+ public SendListener(Handler handler) {
+ this.handler = handler;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ */
+ public void onMessageExchangeContext(
+ MessageExchangeContext context) {
+ try {
+ MessageContext msgContext =
+ context.getMessageContext();
+ MessageExchangeCorrelator correlator =
+ context.getMessageExchangeCorrelator();
+
+ // should I do init's and cleanup's in here?
+ handler.invoke(msgContext);
+
+
+ RECEIVE.put(correlator, context);
+ } catch (Exception exception) {
+ MessageExchangeFaultListener listener =
+ context.getMessageExchangeFaultListener();
+ if (listener != null)
+ listener.onFault(
+ context.getMessageExchangeCorrelator(),
+ exception);
+ }
+ }
+ }
+
+ public class ReceiveListener
+ implements MessageExchangeContextListener {
- MessageExchangeReceiveListener receiveListener =
- context.getMessageExchangeReceiveListener();
- MessageExchangeFaultListener faultListener =
- context.getMessageExchangeFaultListener();
- MessageContext msgContext =
- context.getMessageContext();
- MessageExchangeCorrelator correlator =
- context.getMessageExchangeCorrelator();
-
- try {
- // there should be code here to see if the message
- // contains a fault. if so, the fault listener should
- // be invoked
- if (msgContext != null &&
- msgContext.getResponseMessage() != null &&
- receiveListener != null) {
- receiveListener.onReceive(correlator, msgContext);
- }
- } catch (Exception exception) {
- if (faultListener != null)
- faultListener.onFault(
- correlator, exception);
+ /**
+ * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ */
+ public void onMessageExchangeContext(
+ MessageExchangeContext context) {
+
+ MessageExchangeReceiveListener receiveListener =
+ context.getMessageExchangeReceiveListener();
+ MessageExchangeFaultListener faultListener =
+ context.getMessageExchangeFaultListener();
+ MessageContext msgContext =
+ context.getMessageContext();
+ MessageExchangeCorrelator correlator =
+ context.getMessageExchangeCorrelator();
+
+ try {
+ // there should be code here to see if the message
+ // contains a fault. if so, the fault listener should
+ // be invoked
+ if (msgContext != null &&
+ msgContext.getResponseMessage() != null &&
+ receiveListener != null) {
+ receiveListener.onReceive(correlator, msgContext);
+ }
+ } catch (Exception exception) {
+ if (faultListener != null)
+ faultListener.onFault(
+ correlator, exception);
+ }
}
}
- }
}
1.2 +101 -54 xml-axis/java/src/org/apache/axis/ime/internal/util/handler/HandlerWrapper2.java
Index: HandlerWrapper2.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/handler/HandlerWrapper2.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HandlerWrapper2.java 26 Oct 2002 22:05:05 -0000 1.1
+++ HandlerWrapper2.java 28 Oct 2002 13:50:39 -0000 1.2
@@ -1,76 +1,123 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal.util.handler;
-import org.apache.axis.Message;
+import org.apache.axis.Handler;
import org.apache.axis.MessageContext;
-import org.apache.axis.ime.MessageExchange;
import org.apache.axis.ime.MessageExchangeContext;
import org.apache.axis.ime.MessageExchangeContextListener;
-import org.apache.axis.ime.MessageExchangeFaultListener;
-import org.apache.axis.ime.MessageExchangeStatus;
-import org.apache.axis.ime.MessageExchangeStatusListener;
-import org.apache.axis.ime.MessageExchangeReceiveListener;
import org.apache.axis.ime.MessageExchangeCorrelator;
-import org.apache.axis.ime.internal.NonPersistentMessageChannel;
-import org.apache.axis.ime.internal.MessageExchangeImpl;
+import org.apache.axis.ime.MessageExchangeFaultListener;
import org.apache.axis.ime.internal.MessageExchangeProvider2;
-import org.apache.axis.ime.internal.MessageWorkerGroup;
-import org.apache.axis.Handler;
/**
* Used to wrap synchronous handlers (e.g. Axis 1.0 transports)
*
* @author James M Snell (jasnell@us.ibm.com)
*/
-public class HandlerWrapper2
- extends MessageExchangeProvider2 {
+public class HandlerWrapper2
+ extends MessageExchangeProvider2 {
- private Handler handler;
-
- public HandlerWrapper2(Handler handler) {
- this.handler = handler;
- }
-
- /**
- * @see org.apache.axis.ime.internal.MessageExchangeProvider1#createSendMessageContextListener()
- */
- protected MessageExchangeContextListener createSendMessageContextListener() {
- return new SendListener(handler);
- }
-
-
- public class SendListener
- implements MessageExchangeContextListener {
-
private Handler handler;
-
- public SendListener(Handler handler) {
- this.handler = handler;
+
+ public HandlerWrapper2(Handler handler) {
+ this.handler = handler;
}
-
+
/**
- * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ * @see org.apache.axis.ime.internal.MessageExchangeProvider1#createSendMessageContextListener()
*/
- public void onMessageExchangeContext(
- MessageExchangeContext context) {
- try {
- MessageContext msgContext =
- context.getMessageContext();
- MessageExchangeCorrelator correlator =
- context.getMessageExchangeCorrelator();
+ protected MessageExchangeContextListener createSendMessageContextListener() {
+ return new SendListener(handler);
+ }
+
+
+ public class SendListener
+ implements MessageExchangeContextListener {
+
+ private Handler handler;
+
+ public SendListener(Handler handler) {
+ this.handler = handler;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ */
+ public void onMessageExchangeContext(
+ MessageExchangeContext context) {
+ try {
+ MessageContext msgContext =
+ context.getMessageContext();
+ MessageExchangeCorrelator correlator =
+ context.getMessageExchangeCorrelator();
- // should I do init's and cleanup's in here?
- handler.invoke(msgContext);
-
-
- RECEIVE.put(correlator, context);
- } catch (Exception exception) {
- MessageExchangeFaultListener listener =
- context.getMessageExchangeFaultListener();
- if (listener != null)
- listener.onFault(
- context.getMessageExchangeCorrelator(),
- exception);
+ // should I do init's and cleanup's in here?
+ handler.invoke(msgContext);
+
+
+ RECEIVE.put(correlator, context);
+ } catch (Exception exception) {
+ MessageExchangeFaultListener listener =
+ context.getMessageExchangeFaultListener();
+ if (listener != null)
+ listener.onFault(
+ context.getMessageExchangeCorrelator(),
+ exception);
+ }
}
}
- }
}
1.2 +384 -328 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeImpl.java
Index: MessageExchangeImpl.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeImpl.java 26 Oct 2002 22:05:04 -0000 1.1
+++ MessageExchangeImpl.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,365 +1,421 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
+import org.apache.axis.i18n.Messages;
import org.apache.axis.ime.MessageChannel;
import org.apache.axis.ime.MessageExchange;
+import org.apache.axis.ime.MessageExchangeConstants;
import org.apache.axis.ime.MessageExchangeContext;
import org.apache.axis.ime.MessageExchangeContextListener;
import org.apache.axis.ime.MessageExchangeCorrelator;
+import org.apache.axis.ime.MessageExchangeFaultListener;
import org.apache.axis.ime.MessageExchangeLifecycle;
-import org.apache.axis.ime.MessageExchangeStatus;
import org.apache.axis.ime.MessageExchangeReceiveListener;
import org.apache.axis.ime.MessageExchangeStatusListener;
-import org.apache.axis.ime.MessageExchangeFaultListener;
-import org.apache.axis.ime.MessageExchangeConstants;
-import org.apache.axis.ime.internal.util.uuid.UUIDGen;
import org.apache.axis.ime.internal.util.uuid.UUIDGenFactory;
/**
* @author James M Snell (jasnell@us.ibm.com)
*/
-public class MessageExchangeImpl
- implements MessageExchange, MessageExchangeLifecycle {
+public class MessageExchangeImpl
+ implements MessageExchange, MessageExchangeLifecycle {
- public static final long WORKER_COUNT = 5;
- public static final long DEFAULT_TIMEOUT = 1000 * 20;
+ public static final long WORKER_COUNT = 5;
+ public static final long DEFAULT_TIMEOUT = 1000 * 20;
- private MessageExchangeProvider provider;
- private MessageChannel send;
- private MessageChannel receive;
- private MessageExchangeReceiveListener receiveListener;
- private MessageExchangeStatusListener statusListener;
- private MessageExchangeFaultListener faultListener;
- private MessageWorkerGroup workers = new MessageWorkerGroup();
- private boolean listening = false;
- protected Holder holder;
-
- public MessageExchangeImpl(
- MessageExchangeProvider provider,
- MessageChannel sendChannel,
- MessageChannel receiveChannel) {
- this.send = sendChannel;
- this.receive = receiveChannel;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#send(MessageContext)
- */
- public MessageExchangeCorrelator send(
- MessageContext context)
- throws AxisFault {
- MessageExchangeCorrelator correlator =
- (MessageExchangeCorrelator)context.getProperty(
- MessageExchangeConstants.MESSAGE_CORRELATOR_PROPERTY);
- if (correlator == null) {
- correlator = new MessageExchangeCorrelator(
- UUIDGenFactory.getUUIDGen(null).nextUUID());
- context.setProperty(
- MessageExchangeConstants.MESSAGE_CORRELATOR_PROPERTY,
- correlator);
- }
- MessageExchangeContext meContext =
- MessageExchangeContext.newInstance(
- correlator,
- statusListener,
- receiveListener,
- faultListener,
- context);
- send.put(correlator, meContext);
- return correlator;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#setMessageExchangeStatusListener(MessageExchangeStatusListener)
- */
- public void setMessageExchangeStatusListener(
- MessageExchangeStatusListener listener)
- throws AxisFault {
- if (listening)
- throw new IllegalStateException();
- this.statusListener = listener;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#setMessageExchangeReceiveListener(MessageExchangeReceiveListener)
- */
- public void setMessageExchangeReceiveListener(
- MessageExchangeReceiveListener listener)
- throws AxisFault {
- if (listening)
- throw new IllegalStateException();
- this.receiveListener = listener;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#setMessageExchangeReceiveListener(MessageExchangeReceiveListener)
- */
- public void setMessageExchangeFaultListener(
- MessageExchangeFaultListener listener)
- throws AxisFault {
- if (listening)
- throw new IllegalStateException();
- this.faultListener = listener;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#cancel(MessageExchangeCorrelator)
- */
- public MessageContext cancel(
- MessageExchangeCorrelator correlator)
- throws AxisFault {
- MessageExchangeContext context = send.cancel(correlator);
- if (context != null)
- return context.getMessageContext();
- else return null;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#getReceiveChannel()
- */
- public MessageChannel getReceiveChannel() {
- return receive;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#getSendChannel()
- */
- public MessageChannel getSendChannel() {
- return send;
- }
-
-
- public MessageContext sendAndReceive(
- MessageContext context)
- throws AxisFault {
- holder = new Holder();
- Listener listener = new Listener(holder);
- this.setMessageExchangeFaultListener(listener);
- this.setMessageExchangeReceiveListener(listener);
- try {
- this.send(context);
- holder.waitForNotify();
- } catch (InterruptedException ie) {
- throw AxisFault.makeFault(ie);
- }
- if (holder.context != null) {
- return holder.context;
- }
- if (holder.exception != null) {
- throw AxisFault.makeFault((Exception)holder.exception);
- }
- return null;
- }
-
- public MessageContext sendAndReceive(
- MessageContext context,
- long timeout)
- throws AxisFault {
- holder = new Holder();
- Listener listener = new Listener(holder);
- this.setMessageExchangeFaultListener(listener);
- this.setMessageExchangeReceiveListener(listener);
- try {
- this.send(context);
- holder.waitForNotify(timeout);
- } catch (InterruptedException ie) {
- throw AxisFault.makeFault(ie);
- }
- if (holder.context != null) {
- return holder.context;
- }
- if (holder.exception != null) {
- throw AxisFault.makeFault((Exception)holder.exception);
- }
- return null;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#startListening()
- */
- public void startListening() {
- if (provider instanceof MessageExchangeProvider1)
- throw new UnsupportedOperationException();
- for (int n = 0; n < WORKER_COUNT; n++) {
- workers.addWorker(receive, new ReceiverListener());
- }
- listening = true;
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#startListening()
- */
- public void startListening(MessageExchangeCorrelator correlator) {
- throw new UnsupportedOperationException("Unsupported For Now");
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#stopListening()
- */
- public void stopListening() {
- stopListening(false);
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#stopListening(boolean)
- */
- public void stopListening(boolean force) {
- if (provider instanceof MessageExchangeProvider1)
- throw new UnsupportedOperationException();
- if (!force)
- workers.safeShutdown();
- else
- workers.shutdown();
- listening = false;
- }
-
- private class Holder {
- private MessageExchangeCorrelator correlator;
- private MessageContext context;
- private Throwable exception;
-
- public synchronized void set(
- MessageExchangeCorrelator correlator,
- MessageContext context) {
- this.correlator = correlator;
- this.context = context;
- notifyAll();
- }
-
- public synchronized void set(
- MessageExchangeCorrelator correlator,
- Throwable throwable) {
- this.correlator = correlator;
- this.exception = throwable;
- notifyAll();
- }
-
- public synchronized void waitForNotify()
- throws InterruptedException {
- wait();
- return;
- }
-
- public synchronized void waitForNotify(long timeout)
- throws InterruptedException {
- wait(timeout);
- return;
- }
-
- }
-
- public class Listener
- implements MessageExchangeReceiveListener,
- MessageExchangeFaultListener {
-
+ private MessageExchangeProvider provider;
+ private MessageChannel send;
+ private MessageChannel receive;
+ private MessageExchangeReceiveListener receiveListener;
+ private MessageExchangeStatusListener statusListener;
+ private MessageExchangeFaultListener faultListener;
+ private MessageWorkerGroup workers = new MessageWorkerGroup();
+ private boolean listening = false;
protected Holder holder;
-
- public Listener(Holder holder) {
- this.holder = holder;
+
+ public MessageExchangeImpl(
+ MessageExchangeProvider provider,
+ MessageChannel sendChannel,
+ MessageChannel receiveChannel) {
+ this.send = sendChannel;
+ this.receive = receiveChannel;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#send(MessageContext)
+ */
+ public MessageExchangeCorrelator send(
+ MessageContext context)
+ throws AxisFault {
+ MessageExchangeCorrelator correlator =
+ (MessageExchangeCorrelator) context.getProperty(
+ MessageExchangeConstants.MESSAGE_CORRELATOR_PROPERTY);
+ if (correlator == null) {
+ correlator = new MessageExchangeCorrelator(
+ UUIDGenFactory.getUUIDGen(null).nextUUID());
+ context.setProperty(
+ MessageExchangeConstants.MESSAGE_CORRELATOR_PROPERTY,
+ correlator);
+ }
+ MessageExchangeContext meContext =
+ MessageExchangeContext.newInstance(
+ correlator,
+ statusListener,
+ receiveListener,
+ faultListener,
+ context);
+ send.put(correlator, meContext);
+ return correlator;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#setMessageExchangeStatusListener(MessageExchangeStatusListener)
+ */
+ public void setMessageExchangeStatusListener(
+ MessageExchangeStatusListener listener)
+ throws AxisFault {
+ if (listening)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ this.statusListener = listener;
}
-
+
/**
- * @see org.apache.axis.ime.MessageExchangeReceiveListener#onReceive(MessageExchangeCorrelator, MessageContext)
+ * @see org.apache.axis.ime.MessageExchange#setMessageExchangeReceiveListener(MessageExchangeReceiveListener)
*/
- public void onReceive(
- MessageExchangeCorrelator correlator,
- MessageContext context) {
- holder.set(correlator,context);
+ public void setMessageExchangeReceiveListener(
+ MessageExchangeReceiveListener listener)
+ throws AxisFault {
+ if (listening)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ this.receiveListener = listener;
}
/**
- * @see org.apache.axis.ime.MessageExchangeFaultListener#onFault(MessageExchangeCorrelator, Throwable)
+ * @see org.apache.axis.ime.MessageExchange#setMessageExchangeReceiveListener(MessageExchangeReceiveListener)
*/
- public void onFault(
- MessageExchangeCorrelator correlator,
- Throwable exception) {
- holder.set(correlator,exception);
+ public void setMessageExchangeFaultListener(
+ MessageExchangeFaultListener listener)
+ throws AxisFault {
+ if (listening)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ this.faultListener = listener;
}
-
- }
+ /**
+ * @see org.apache.axis.ime.MessageExchange#cancel(MessageExchangeCorrelator)
+ */
+ public MessageContext cancel(
+ MessageExchangeCorrelator correlator)
+ throws AxisFault {
+ MessageExchangeContext context = send.cancel(correlator);
+ if (context != null)
+ return context.getMessageContext();
+ else
+ return null;
+ }
- private class ReceiverListener
- implements MessageExchangeContextListener {
-
/**
- * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ * @see org.apache.axis.ime.MessageExchange#getReceiveChannel()
*/
- public void onMessageExchangeContext(
- MessageExchangeContext context) {
+ public MessageChannel getReceiveChannel() {
+ return receive;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#getSendChannel()
+ */
+ public MessageChannel getSendChannel() {
+ return send;
+ }
+
- MessageContext msgContext =
- context.getMessageContext();
- MessageExchangeCorrelator correlator =
- context.getMessageExchangeCorrelator();
+ public MessageContext sendAndReceive(
+ MessageContext context)
+ throws AxisFault {
+ holder = new Holder();
+ Listener listener = new Listener(holder);
+ this.setMessageExchangeFaultListener(listener);
+ this.setMessageExchangeReceiveListener(listener);
+ try {
+ this.send(context);
+ holder.waitForNotify();
+ } catch (InterruptedException ie) {
+ throw AxisFault.makeFault(ie);
+ }
+ if (holder.context != null) {
+ return holder.context;
+ }
+ if (holder.exception != null) {
+ throw AxisFault.makeFault((Exception) holder.exception);
+ }
+ return null;
+ }
+ public MessageContext sendAndReceive(
+ MessageContext context,
+ long timeout)
+ throws AxisFault {
+ holder = new Holder();
+ Listener listener = new Listener(holder);
+ this.setMessageExchangeFaultListener(listener);
+ this.setMessageExchangeReceiveListener(listener);
try {
- // there should be code here to see if the message
- // contains a fault. if so, the fault listener should
- // be invoked
- if (msgContext != null &&
- msgContext.getResponseMessage() != null &&
- receiveListener != null) {
- receiveListener.onReceive(correlator, msgContext);
- }
- } catch (Exception exception) {
- if (faultListener != null)
- faultListener.onFault(
- correlator, exception);
- }
-
- }
- }
- /**
- * @see org.apache.axis.ime.MessageExchangeLifecycle#awaitShutdown()
- */
- public void awaitShutdown()
- throws InterruptedException {
- provider.awaitShutdown();
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchangeLifecycle#awaitShutdown(long)
- */
- public void awaitShutdown(long timeout)
- throws InterruptedException {
- provider.awaitShutdown(timeout);
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchangeLifecycle#init()
- */
- public void init() {
- provider.init();
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchangeLifecycle#shutdown()
- */
- public void shutdown() {
- provider.shutdown();
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchangeLifecycle#shutdown(boolean)
- */
- public void shutdown(boolean force) {
- provider.shutdown(force);
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#receive()
- */
- public MessageContext receive() throws AxisFault {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see org.apache.axis.ime.MessageExchange#receive(long)
- */
- public MessageContext receive(long timeout) throws AxisFault {
- throw new UnsupportedOperationException();
- }
+ this.send(context);
+ holder.waitForNotify(timeout);
+ } catch (InterruptedException ie) {
+ throw AxisFault.makeFault(ie);
+ }
+ if (holder.context != null) {
+ return holder.context;
+ }
+ if (holder.exception != null) {
+ throw AxisFault.makeFault((Exception) holder.exception);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#startListening()
+ */
+ public void startListening() {
+ if (provider instanceof MessageExchangeProvider1)
+ throw new UnsupportedOperationException(Messages.getMessage("unsupportedOperationException00"));
+ for (int n = 0; n < WORKER_COUNT; n++) {
+ workers.addWorker(receive, new ReceiverListener());
+ }
+ listening = true;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#startListening()
+ */
+ public void startListening(MessageExchangeCorrelator correlator) {
+ throw new UnsupportedOperationException(Messages.getMessage("unsupportedOperationException01", "Unsupported For Now"));
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#stopListening()
+ */
+ public void stopListening() {
+ stopListening(false);
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#stopListening(boolean)
+ */
+ public void stopListening(boolean force) {
+ if (provider instanceof MessageExchangeProvider1)
+ throw new UnsupportedOperationException(Messages.getMessage("unsupportedOperationException00"));
+ if (!force)
+ workers.safeShutdown();
+ else
+ workers.shutdown();
+ listening = false;
+ }
+
+ private class Holder {
+ private MessageExchangeCorrelator correlator;
+ private MessageContext context;
+ private Throwable exception;
+
+ public synchronized void set(
+ MessageExchangeCorrelator correlator,
+ MessageContext context) {
+ this.correlator = correlator;
+ this.context = context;
+ notifyAll();
+ }
+
+ public synchronized void set(
+ MessageExchangeCorrelator correlator,
+ Throwable throwable) {
+ this.correlator = correlator;
+ this.exception = throwable;
+ notifyAll();
+ }
+
+ public synchronized void waitForNotify()
+ throws InterruptedException {
+ wait();
+ return;
+ }
+
+ public synchronized void waitForNotify(long timeout)
+ throws InterruptedException {
+ wait(timeout);
+ return;
+ }
+
+ }
+
+ public class Listener
+ implements MessageExchangeReceiveListener,
+ MessageExchangeFaultListener {
+
+ protected Holder holder;
+
+ public Listener(Holder holder) {
+ this.holder = holder;
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeReceiveListener#onReceive(MessageExchangeCorrelator, MessageContext)
+ */
+ public void onReceive(
+ MessageExchangeCorrelator correlator,
+ MessageContext context) {
+ holder.set(correlator, context);
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeFaultListener#onFault(MessageExchangeCorrelator, Throwable)
+ */
+ public void onFault(
+ MessageExchangeCorrelator correlator,
+ Throwable exception) {
+ holder.set(correlator, exception);
+ }
+
+ }
+
+
+ private class ReceiverListener
+ implements MessageExchangeContextListener {
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeContextListener#onMessageExchangeContext(MessageExchangeContext)
+ */
+ public void onMessageExchangeContext(
+ MessageExchangeContext context) {
+
+ MessageContext msgContext =
+ context.getMessageContext();
+ MessageExchangeCorrelator correlator =
+ context.getMessageExchangeCorrelator();
+
+ try {
+ // there should be code here to see if the message
+ // contains a fault. if so, the fault listener should
+ // be invoked
+ if (msgContext != null &&
+ msgContext.getResponseMessage() != null &&
+ receiveListener != null) {
+ receiveListener.onReceive(correlator, msgContext);
+ }
+ } catch (Exception exception) {
+ if (faultListener != null)
+ faultListener.onFault(
+ correlator, exception);
+ }
+
+ }
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeLifecycle#awaitShutdown()
+ */
+ public void awaitShutdown()
+ throws InterruptedException {
+ provider.awaitShutdown();
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeLifecycle#awaitShutdown(long)
+ */
+ public void awaitShutdown(long timeout)
+ throws InterruptedException {
+ provider.awaitShutdown(timeout);
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeLifecycle#init()
+ */
+ public void init() {
+ provider.init();
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeLifecycle#shutdown()
+ */
+ public void shutdown() {
+ provider.shutdown();
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchangeLifecycle#shutdown(boolean)
+ */
+ public void shutdown(boolean force) {
+ provider.shutdown(force);
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#receive()
+ */
+ public MessageContext receive() throws AxisFault {
+ throw new UnsupportedOperationException(Messages.getMessage("unsupportedOperationException00"));
+ }
+
+ /**
+ * @see org.apache.axis.ime.MessageExchange#receive(long)
+ */
+ public MessageContext receive(long timeout) throws AxisFault {
+ throw new UnsupportedOperationException(Messages.getMessage("unsupportedOperationException00"));
+ }
}
1.2 +98 -43 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider.java
Index: MessageExchangeProvider.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeProvider.java 26 Oct 2002 22:05:04 -0000 1.1
+++ MessageExchangeProvider.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,8 +1,63 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
-import org.apache.axis.ime.MessageExchangeFactory;
-import org.apache.axis.ime.MessageExchange;
import org.apache.axis.ime.MessageChannel;
+import org.apache.axis.ime.MessageExchange;
+import org.apache.axis.ime.MessageExchangeFactory;
/**
* Serves as a base class for MessageExchangeProviders that
@@ -13,46 +68,46 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public abstract class MessageExchangeProvider
- implements MessageExchangeFactory {
+ implements MessageExchangeFactory {
+
+ public static final long DEFAULT_THREAD_COUNT = 5;
+
+ protected final MessageWorkerGroup WORKERS = new MessageWorkerGroup();
+ protected final MessageChannel SEND = new NonPersistentMessageChannel(WORKERS);
+ protected final MessageChannel RECEIVE = new NonPersistentMessageChannel(WORKERS);
+
+ protected boolean initialized = false;
+
+ public MessageExchange createMessageExchange() {
+ return new MessageExchangeImpl(this, SEND, RECEIVE);
+ }
+
+ public void init() {
+ init(DEFAULT_THREAD_COUNT);
+ }
+
+ public abstract void init(long THREAD_COUNT);
+
+ public void shutdown() {
+ shutdown(false);
+ }
+
+ public void shutdown(boolean force) {
+ if (!force) {
+ WORKERS.safeShutdown();
+ } else {
+ WORKERS.shutdown();
+ }
+ }
+
+ public void awaitShutdown()
+ throws InterruptedException {
+ WORKERS.awaitShutdown();
+ }
+
+ public void awaitShutdown(long shutdown)
+ throws InterruptedException {
+ WORKERS.awaitShutdown(shutdown);
+ }
- public static final long DEFAULT_THREAD_COUNT = 5;
-
- protected final MessageWorkerGroup WORKERS = new MessageWorkerGroup();
- protected final MessageChannel SEND = new NonPersistentMessageChannel(WORKERS);
- protected final MessageChannel RECEIVE = new NonPersistentMessageChannel(WORKERS);
-
- protected boolean initialized = false;
-
- public MessageExchange createMessageExchange() {
- return new MessageExchangeImpl(this,SEND,RECEIVE);
- }
-
- public void init() {
- init(DEFAULT_THREAD_COUNT);
- }
-
- public abstract void init(long THREAD_COUNT);
-
- public void shutdown() {
- shutdown(false);
- }
-
- public void shutdown(boolean force) {
- if (!force) {
- WORKERS.safeShutdown();
- } else {
- WORKERS.shutdown();
- }
- }
-
- public void awaitShutdown()
- throws InterruptedException {
- WORKERS.awaitShutdown();
- }
-
- public void awaitShutdown(long shutdown)
- throws InterruptedException {
- WORKERS.awaitShutdown(shutdown);
- }
-
}
1.2 +70 -15 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider1.java
Index: MessageExchangeProvider1.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider1.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeProvider1.java 26 Oct 2002 22:05:04 -0000 1.1
+++ MessageExchangeProvider1.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,7 +1,62 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
+import org.apache.axis.i18n.Messages;
import org.apache.axis.ime.MessageExchangeContextListener;
-import org.apache.axis.ime.MessageExchange;
/**
* Serves as a base class for MessageExchangeProviders that
@@ -12,20 +67,20 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public abstract class MessageExchangeProvider1
- extends MessageExchangeProvider {
+ extends MessageExchangeProvider {
+
+ protected abstract MessageExchangeContextListener createSendMessageContextListener();
- protected abstract MessageExchangeContextListener createSendMessageContextListener();
-
- protected abstract MessageExchangeContextListener createReceiveMessageContextListener();
-
- public void init(long THREAD_COUNT) {
- if (initialized)
- throw new IllegalStateException();
- for (int n = 0; n < THREAD_COUNT; n++) {
- WORKERS.addWorker(SEND, createSendMessageContextListener());
- WORKERS.addWorker(RECEIVE, createReceiveMessageContextListener());
+ protected abstract MessageExchangeContextListener createReceiveMessageContextListener();
+
+ public void init(long THREAD_COUNT) {
+ if (initialized)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ for (int n = 0; n < THREAD_COUNT; n++) {
+ WORKERS.addWorker(SEND, createSendMessageContextListener());
+ WORKERS.addWorker(RECEIVE, createReceiveMessageContextListener());
+ }
+ initialized = true;
}
- initialized = true;
- }
-
+
}
1.2 +66 -11 xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider2.java
Index: MessageExchangeProvider2.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageExchangeProvider2.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageExchangeProvider2.java 26 Oct 2002 22:05:04 -0000 1.1
+++ MessageExchangeProvider2.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,7 +1,62 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
+import org.apache.axis.i18n.Messages;
import org.apache.axis.ime.MessageExchangeContextListener;
-import org.apache.axis.ime.MessageExchange;
/**
* Serves as a base class for MessageExchangeProviders that
@@ -12,17 +67,17 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public abstract class MessageExchangeProvider2
- extends MessageExchangeProvider {
+ extends MessageExchangeProvider {
- protected abstract MessageExchangeContextListener createSendMessageContextListener();
+ protected abstract MessageExchangeContextListener createSendMessageContextListener();
- public void init(long THREAD_COUNT) {
- if (initialized)
- throw new IllegalStateException();
- for (int n = 0; n < THREAD_COUNT; n++) {
- WORKERS.addWorker(SEND, createSendMessageContextListener());
+ public void init(long THREAD_COUNT) {
+ if (initialized)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ for (int n = 0; n < THREAD_COUNT; n++) {
+ WORKERS.addWorker(SEND, createSendMessageContextListener());
+ }
+ initialized = true;
}
- initialized = true;
- }
-
+
}
1.2 +100 -45 xml-axis/java/src/org/apache/axis/ime/internal/MessageWorker.java
Index: MessageWorker.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageWorker.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageWorker.java 26 Oct 2002 22:05:04 -0000 1.1
+++ MessageWorker.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,6 +1,60 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
-import org.apache.axis.MessageContext;
import org.apache.axis.ime.MessageChannel;
import org.apache.axis.ime.MessageExchangeContext;
import org.apache.axis.ime.MessageExchangeContextListener;
@@ -10,50 +64,51 @@
*/
public class MessageWorker implements Runnable {
- protected static final long SELECT_TIMEOUT = 1000 * 30;
-
- protected MessageWorkerGroup pool;
- protected MessageChannel channel;
- protected MessageExchangeContextListener listener;
-
- private MessageWorker() {}
-
- public MessageWorker(
- MessageWorkerGroup pool,
- MessageChannel channel,
- MessageExchangeContextListener listener) {
- this.pool = pool;
- this.channel = channel;
- this.listener = listener;
- }
-
- public MessageExchangeContextListener getMessageExchangeContextListener() {
- return this.listener;
- }
-
- public MessageChannel getMessageChannel() {
- return this.channel;
- }
-
- /**
- * @see java.lang.Runnable#run()
- */
- public void run() {
- try {
- while (!pool.isShuttingDown()) {
- MessageExchangeContext context = channel.select(SELECT_TIMEOUT);
- if (context != null)
- listener.onMessageExchangeContext(context);
- }
- } catch (Throwable t) {
- // kill the thread if any type of exception occurs.
- // don't worry, we'll create another one to replace it
- // if we're not currently in the process of shutting down.
- // once I get the logging function plugged in, we'll
- // log whatever errors do occur
- } finally {
- pool.workerDone(this);
+ protected static final long SELECT_TIMEOUT = 1000 * 30;
+
+ protected MessageWorkerGroup pool;
+ protected MessageChannel channel;
+ protected MessageExchangeContextListener listener;
+
+ private MessageWorker() {
+ }
+
+ public MessageWorker(
+ MessageWorkerGroup pool,
+ MessageChannel channel,
+ MessageExchangeContextListener listener) {
+ this.pool = pool;
+ this.channel = channel;
+ this.listener = listener;
+ }
+
+ public MessageExchangeContextListener getMessageExchangeContextListener() {
+ return this.listener;
+ }
+
+ public MessageChannel getMessageChannel() {
+ return this.channel;
+ }
+
+ /**
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ try {
+ while (!pool.isShuttingDown()) {
+ MessageExchangeContext context = channel.select(SELECT_TIMEOUT);
+ if (context != null)
+ listener.onMessageExchangeContext(context);
+ }
+ } catch (Throwable t) {
+ // kill the thread if any type of exception occurs.
+ // don't worry, we'll create another one to replace it
+ // if we're not currently in the process of shutting down.
+ // once I get the logging function plugged in, we'll
+ // log whatever errors do occur
+ } finally {
+ pool.workerDone(this);
+ }
}
- }
}
1.2 +187 -130 xml-axis/java/src/org/apache/axis/ime/internal/MessageWorkerGroup.java
Index: MessageWorkerGroup.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/MessageWorkerGroup.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MessageWorkerGroup.java 26 Oct 2002 22:05:04 -0000 1.1
+++ MessageWorkerGroup.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,143 +1,200 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
-import java.util.Map;
-import java.util.Hashtable;
-import java.util.Iterator;
+import org.apache.axis.i18n.Messages;
import org.apache.axis.ime.MessageChannel;
import org.apache.axis.ime.MessageExchangeContextListener;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
/**
* @author James M Snell (jasnell@us.ibm.com)
*/
public class MessageWorkerGroup {
- protected Map threads = new Hashtable();
- protected boolean interrupt;
- protected long threadcount;
- public boolean _shutdown;
-
- /**
- * Returns true if all workers have been shutdown
- */
- public boolean isShutdown() {
- synchronized(this) {
- return _shutdown && threadcount == 0;
- }
- }
-
- /**
- * Returns true if all workers are in the process of shutting down
- */
- public boolean isShuttingDown() {
- synchronized(this) {
- return _shutdown;
- }
- }
-
- /**
- * Returns the total number of currently active workers
- */
- public long getWorkerCount() {
- synchronized(this) {
- return threadcount;
- }
- }
-
- /**
- * Adds a new worker to the pool
- */
- public void addWorker(
- MessageChannel channel,
- MessageExchangeContextListener listener) {
- if (_shutdown)
- throw new IllegalStateException();
- MessageWorker worker =
- new MessageWorker(this, channel, listener);
- Thread thread = new Thread(worker);
- threads.put(worker,thread);
- threadcount++;
- thread.start();
- }
-
- /**
- * Forcefully interrupt all workers
- */
- public void interruptAll() {
- synchronized(threads) {
- for (Iterator i = threads.values().iterator(); i.hasNext();) {
- Thread t = (Thread)i.next();
- t.interrupt();
- }
- }
- }
-
- /**
- * Forcefully shutdown the pool
- */
- public void shutdown() {
- synchronized(this) {
- _shutdown = true;
- }
- interruptAll();
- }
-
- /**
- * Forcefully shutdown the pool
- */
- public void safeShutdown() {
- synchronized(this) {
- _shutdown = true;
- }
- }
-
- /**
- * Await shutdown of the worker
- */
- public synchronized void awaitShutdown()
- throws InterruptedException {
- if (!_shutdown)
- throw new IllegalStateException();
- while (threadcount > 0)
- wait();
- }
-
- /**
- * Await shutdown of the worker
- */
- public synchronized boolean awaitShutdown(long timeout)
- throws InterruptedException {
- if (!_shutdown)
- throw new IllegalStateException();
- if (threadcount == 0)
- return true;
- long waittime = timeout;
- if (waittime <= 0)
- return false;
- long start = System.currentTimeMillis();
- for (;;) {
- wait(waittime);
- if (threadcount == 0)
- return true;
- waittime = timeout - System.currentTimeMillis();
+ protected Map threads = new Hashtable();
+ protected boolean interrupt;
+ protected long threadcount;
+ public boolean _shutdown;
+
+ /**
+ * Returns true if all workers have been shutdown
+ */
+ public boolean isShutdown() {
+ synchronized (this) {
+ return _shutdown && threadcount == 0;
+ }
+ }
+
+ /**
+ * Returns true if all workers are in the process of shutting down
+ */
+ public boolean isShuttingDown() {
+ synchronized (this) {
+ return _shutdown;
+ }
+ }
+
+ /**
+ * Returns the total number of currently active workers
+ */
+ public long getWorkerCount() {
+ synchronized (this) {
+ return threadcount;
+ }
+ }
+
+ /**
+ * Adds a new worker to the pool
+ */
+ public void addWorker(
+ MessageChannel channel,
+ MessageExchangeContextListener listener) {
+ if (_shutdown)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ MessageWorker worker =
+ new MessageWorker(this, channel, listener);
+ Thread thread = new Thread(worker);
+ threads.put(worker, thread);
+ threadcount++;
+ thread.start();
+ }
+
+ /**
+ * Forcefully interrupt all workers
+ */
+ public void interruptAll() {
+ synchronized (threads) {
+ for (Iterator i = threads.values().iterator(); i.hasNext();) {
+ Thread t = (Thread) i.next();
+ t.interrupt();
+ }
+ }
+ }
+
+ /**
+ * Forcefully shutdown the pool
+ */
+ public void shutdown() {
+ synchronized (this) {
+ _shutdown = true;
+ }
+ interruptAll();
+ }
+
+ /**
+ * Forcefully shutdown the pool
+ */
+ public void safeShutdown() {
+ synchronized (this) {
+ _shutdown = true;
+ }
+ }
+
+ /**
+ * Await shutdown of the worker
+ */
+ public synchronized void awaitShutdown()
+ throws InterruptedException {
+ if (!_shutdown)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ while (threadcount > 0)
+ wait();
+ }
+
+ /**
+ * Await shutdown of the worker
+ */
+ public synchronized boolean awaitShutdown(long timeout)
+ throws InterruptedException {
+ if (!_shutdown)
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ if (threadcount == 0)
+ return true;
+ long waittime = timeout;
if (waittime <= 0)
- return false;
- }
- }
-
- /**
- * Used by MessageWorkers to notify the pool that it is done
- */
- protected synchronized void workerDone(
- MessageWorker worker) {
- threads.remove(worker);
- if (--threadcount == 0 && _shutdown) {
- notifyAll();
- }
- if (!_shutdown) {
- addWorker(
- worker.getMessageChannel(),
- worker.getMessageExchangeContextListener());
- }
- }
+ return false;
+ long start = System.currentTimeMillis();
+ for (; ;) {
+ wait(waittime);
+ if (threadcount == 0)
+ return true;
+ waittime = timeout - System.currentTimeMillis();
+ if (waittime <= 0)
+ return false;
+ }
+ }
+
+ /**
+ * Used by MessageWorkers to notify the pool that it is done
+ */
+ protected synchronized void workerDone(
+ MessageWorker worker) {
+ threads.remove(worker);
+ if (--threadcount == 0 && _shutdown) {
+ notifyAll();
+ }
+ if (!_shutdown) {
+ addWorker(
+ worker.getMessageChannel(),
+ worker.getMessageExchangeContextListener());
+ }
+ }
}
1.2 +268 -207 xml-axis/java/src/org/apache/axis/ime/internal/NonPersistentMessageChannel.java
Index: NonPersistentMessageChannel.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/NonPersistentMessageChannel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NonPersistentMessageChannel.java 26 Oct 2002 22:05:04 -0000 1.1
+++ NonPersistentMessageChannel.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,9 +1,66 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
-import java.util.Vector;
+import org.apache.axis.i18n.Messages;
import org.apache.axis.ime.MessageChannel;
import org.apache.axis.ime.MessageExchangeContext;
+import java.util.Vector;
+
/**
* Creates a non-persistent message channel. Queued messages
* are stored in memory. If the Channel instance is destroyed,
@@ -12,216 +69,220 @@
* @author James M Snell (jasnell@us.ibm.com)
*/
public class NonPersistentMessageChannel
- implements MessageChannel {
+ implements MessageChannel {
- private final KeyedQueue messages = new KeyedQueue();
+ private final KeyedQueue messages = new KeyedQueue();
- private MessageWorkerGroup WORKERS;
-
- public NonPersistentMessageChannel(
- MessageWorkerGroup workers) {
- this.WORKERS = workers;
- }
-
- public MessageExchangeContext peek() {
- KeyedNode node = null;
- synchronized(messages) {
- node = messages.peek();
- }
- if (node != null) {
- return (MessageExchangeContext)node.value;
- } else {
- return null;
- }
- }
-
- public void put(
- Object key,
- MessageExchangeContext context) {
-
- if (key == null ||
- context == null)
- throw new IllegalArgumentException();
-
- synchronized(messages) {
- messages.put(new KeyedNode(key,context));
- messages.notify();
- }
- }
-
- public MessageExchangeContext cancel(Object key) {
- if (key == null)
- throw new IllegalArgumentException();
- MessageExchangeContext context = null;
- synchronized(messages) {
- KeyedNode node = messages.select(key); // will attempt to find an remove
- if (node != null)
- context = (MessageExchangeContext)node.value;
- node.key = null;
- node.value = null;
- }
- return context;
- }
-
- public MessageExchangeContext[] selectAll() {
- Vector v = new Vector();
- KeyedNode node = null;
- synchronized(messages) {
- while ((node = messages.select()) != null) {
- v.add(node.value);
- node.key = null;
- node.value = null;
- }
- }
- MessageExchangeContext[] contexts = new
- MessageExchangeContext[v.size()];
- v.copyInto(contexts);
- return contexts;
- }
-
- public MessageExchangeContext select()
- throws InterruptedException {
- for (;;) {
- if (WORKERS.isShuttingDown())
- throw new IllegalStateException();
- KeyedNode node = null;
- synchronized(messages) {
- node = messages.select();
- }
- if (node != null) {
- MessageExchangeContext context = (MessageExchangeContext)node.value;
- node.key = null;
- node.value = null;
- return context;
- } else {
- messages.wait();
- }
- }
- }
-
- public MessageExchangeContext select(long timeout)
- throws InterruptedException {
- for (;;) {
- if (WORKERS.isShuttingDown())
- throw new IllegalStateException();
- KeyedNode node = null;
- synchronized(messages) {
- node = messages.select();
- }
- if (node != null) {
- MessageExchangeContext context = (MessageExchangeContext)node.value;
- node.key = null;
- node.value = null;
- return context;
- } else {
- messages.wait(timeout);
- }
- }
- }
-
- public MessageExchangeContext select(Object key)
- throws InterruptedException {
- for (;;) {
- if (WORKERS.isShuttingDown())
- throw new IllegalStateException();
- KeyedNode node = null;
- synchronized(messages) {
- node = messages.select(key);
- }
- if (node != null) {
- MessageExchangeContext context = (MessageExchangeContext)node.value;
- node.key = null;
- node.value = null;
- return context;
- } else {
- messages.wait();
- }
- }
- }
-
- public MessageExchangeContext select(Object key, long timeout)
- throws InterruptedException {
- for (;;) {
- if (WORKERS.isShuttingDown())
- throw new IllegalStateException();
- KeyedNode node = null;
- synchronized(messages) {
- node = messages.select(key);
- }
- if (node != null) {
- MessageExchangeContext context = (MessageExchangeContext)node.value;
- node.key = null;
- node.value = null;
+ private MessageWorkerGroup WORKERS;
+
+ public NonPersistentMessageChannel(
+ MessageWorkerGroup workers) {
+ this.WORKERS = workers;
+ }
+
+ public MessageExchangeContext peek() {
+ KeyedNode node = null;
+ synchronized (messages) {
+ node = messages.peek();
+ }
+ if (node != null) {
+ return (MessageExchangeContext) node.value;
+ } else {
+ return null;
+ }
+ }
+
+ public void put(
+ Object key,
+ MessageExchangeContext context) {
+
+ if (key == null ||
+ context == null)
+ throw new IllegalArgumentException(Messages.getMessage("illegalArgumentException00"));
+
+ synchronized (messages) {
+ messages.put(new KeyedNode(key, context));
+ messages.notify();
+ }
+ }
+
+ public MessageExchangeContext cancel(Object key) {
+ if (key == null)
+ throw new IllegalArgumentException(Messages.getMessage("illegalArgumentException00"));
+ MessageExchangeContext context = null;
+ synchronized (messages) {
+ KeyedNode node = messages.select(key); // will attempt to find an remove
+ if (node != null)
+ context = (MessageExchangeContext) node.value;
+ node.key = null;
+ node.value = null;
+ }
return context;
- } else {
- messages.wait(timeout);
- }
}
- }
+
+ public MessageExchangeContext[] selectAll() {
+ Vector v = new Vector();
+ KeyedNode node = null;
+ synchronized (messages) {
+ while ((node = messages.select()) != null) {
+ v.add(node.value);
+ node.key = null;
+ node.value = null;
+ }
+ }
+ MessageExchangeContext[] contexts = new
+ MessageExchangeContext[v.size()];
+ v.copyInto(contexts);
+ return contexts;
+ }
+
+ public MessageExchangeContext select()
+ throws InterruptedException {
+ for (; ;) {
+ if (WORKERS.isShuttingDown())
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ KeyedNode node = null;
+ synchronized (messages) {
+ node = messages.select();
+ }
+ if (node != null) {
+ MessageExchangeContext context = (MessageExchangeContext) node.value;
+ node.key = null;
+ node.value = null;
+ return context;
+ } else {
+ messages.wait();
+ }
+ }
+ }
+
+ public MessageExchangeContext select(long timeout)
+ throws InterruptedException {
+ for (; ;) {
+ if (WORKERS.isShuttingDown())
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ KeyedNode node = null;
+ synchronized (messages) {
+ node = messages.select();
+ }
+ if (node != null) {
+ MessageExchangeContext context = (MessageExchangeContext) node.value;
+ node.key = null;
+ node.value = null;
+ return context;
+ } else {
+ messages.wait(timeout);
+ }
+ }
+ }
+
+ public MessageExchangeContext select(Object key)
+ throws InterruptedException {
+ for (; ;) {
+ if (WORKERS.isShuttingDown())
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ KeyedNode node = null;
+ synchronized (messages) {
+ node = messages.select(key);
+ }
+ if (node != null) {
+ MessageExchangeContext context = (MessageExchangeContext) node.value;
+ node.key = null;
+ node.value = null;
+ return context;
+ } else {
+ messages.wait();
+ }
+ }
+ }
+
+ public MessageExchangeContext select(Object key, long timeout)
+ throws InterruptedException {
+ for (; ;) {
+ if (WORKERS.isShuttingDown())
+ throw new IllegalStateException(Messages.getMessage("illegalStateException00"));
+ KeyedNode node = null;
+ synchronized (messages) {
+ node = messages.select(key);
+ }
+ if (node != null) {
+ MessageExchangeContext context = (MessageExchangeContext) node.value;
+ node.key = null;
+ node.value = null;
+ return context;
+ } else {
+ messages.wait(timeout);
+ }
+ }
+ }
/// Support Classes ///
- protected static class KeyedNode {
- public Object key;
- public Object value;
- public KeyedNode next;
- public KeyedNode() {}
- public KeyedNode(
- Object key,
- Object value) {
- this.key = key;
- this.value = value;
- }
- public KeyedNode(
- Object key,
- Object value,
- KeyedNode next) {
- this(key,value);
- this.next = next;
- }
- }
-
- protected static class KeyedQueue {
-
- protected KeyedNode head;
- protected KeyedNode last;
-
- protected void put(KeyedNode node) {
- if (last == null) {
- last = head = node;
- } else {
- last = last.next = node;
- }
- }
-
- protected KeyedNode select() {
- KeyedNode node = head;
- if (node != null && (head = node.next) == null) {
- last = null;
- }
- if (node != null)
- node.next = null;
- return node;
- }
-
- protected KeyedNode select(Object key) {
- KeyedNode previous = null;
- for (KeyedNode node = head;node != null;node = node.next) {
- if (node.key.equals(key)) {
- if (previous != null)
- previous.next = node.next;
- node.next = null;
- return node;
- }
- previous = node;
- }
- return null;
- }
-
- protected KeyedNode peek() {
- KeyedNode node = head;
- return node;
- }
-
- }
-
+ protected static class KeyedNode {
+ public Object key;
+ public Object value;
+ public KeyedNode next;
+
+ public KeyedNode() {
+ }
+
+ public KeyedNode(
+ Object key,
+ Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public KeyedNode(
+ Object key,
+ Object value,
+ KeyedNode next) {
+ this(key, value);
+ this.next = next;
+ }
+ }
+
+ protected static class KeyedQueue {
+
+ protected KeyedNode head;
+ protected KeyedNode last;
+
+ protected void put(KeyedNode node) {
+ if (last == null) {
+ last = head = node;
+ } else {
+ last = last.next = node;
+ }
+ }
+
+ protected KeyedNode select() {
+ KeyedNode node = head;
+ if (node != null && (head = node.next) == null) {
+ last = null;
+ }
+ if (node != null)
+ node.next = null;
+ return node;
+ }
+
+ protected KeyedNode select(Object key) {
+ KeyedNode previous = null;
+ for (KeyedNode node = head; node != null; node = node.next) {
+ if (node.key.equals(key)) {
+ if (previous != null)
+ previous.next = node.next;
+ node.next = null;
+ return node;
+ }
+ previous = node;
+ }
+ return null;
+ }
+
+ protected KeyedNode peek() {
+ KeyedNode node = head;
+ return node;
+ }
+
+ }
+
}
1.2 +74 -18 xml-axis/java/src/org/apache/axis/ime/internal/NonPersistentMessageExchangeCorrelatorService.java
Index: NonPersistentMessageExchangeCorrelatorService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/NonPersistentMessageExchangeCorrelatorService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NonPersistentMessageExchangeCorrelatorService.java 26 Oct 2002 22:05:04 -0000 1.1
+++ NonPersistentMessageExchangeCorrelatorService.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,36 +1,92 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
package org.apache.axis.ime.internal;
import org.apache.axis.ime.MessageExchangeContext;
import org.apache.axis.ime.MessageExchangeCorrelator;
import org.apache.axis.ime.MessageExchangeCorrelatorService;
+
import java.util.Hashtable;
/**
* @author James M Snell (jasnell@us.ibm.com)
*/
public class NonPersistentMessageExchangeCorrelatorService
- implements MessageExchangeCorrelatorService {
+ implements MessageExchangeCorrelatorService {
- Hashtable contexts = new Hashtable();
+ Hashtable contexts = new Hashtable();
- /**
- * @see org.apache.axis.ime.MessageExchangeCorrelatorService#put(MessageExchangeCorrelator, MessageExchangeContext)
- */
- public void put(
- MessageExchangeCorrelator correlator,
- MessageExchangeContext context) {
- synchronized(contexts) {
- contexts.put(correlator, context);
- }
+ /**
+ * @see org.apache.axis.ime.MessageExchangeCorrelatorService#put(MessageExchangeCorrelator, MessageExchangeContext)
+ */
+ public void put(
+ MessageExchangeCorrelator correlator,
+ MessageExchangeContext context) {
+ synchronized (contexts) {
+ contexts.put(correlator, context);
+ }
}
- /**
- * @see org.apache.axis.ime.MessageExchangeCorrelatorService#get(MessageExchangeCorrelator)
- */
- public MessageExchangeContext get(MessageExchangeCorrelator correlator) {
- synchronized(contexts) {
- return (MessageExchangeContext)contexts.remove(correlator);
+ /**
+ * @see org.apache.axis.ime.MessageExchangeCorrelatorService#get(MessageExchangeCorrelator)
+ */
+ public MessageExchangeContext get(MessageExchangeCorrelator correlator) {
+ synchronized (contexts) {
+ return (MessageExchangeContext) contexts.remove(correlator);
+ }
}
- }
}
1.22 +7 -0 xml-axis/java/src/org/apache/axis/i18n/resource.properties
Index: resource.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/i18n/resource.properties,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- resource.properties 23 Oct 2002 18:04:46 -0000 1.21
+++ resource.properties 28 Oct 2002 13:50:40 -0000 1.22
@@ -1054,3 +1054,10 @@
j2woptExtraClasses00=A space or comma separated list of class names to be added to the type section.
j2woptBadClass00=Invalid class provided for --extraClasses option: {0}
operationAlreadySet=Can't modify settings on a Call whose OperationDesc was set by setOperation()
+
+illegalStateException00=IllegalStateException:
+unsupportedOperationException00=UnsupportedOperationException00:
+unsupportedOperationException01=UnsupportedOperationException01: {0}
+
+uuidGenFactoryCNFE00=The implementation of UUIDGen interface specified cannot be found in the classpath: {0} not found
+uuidGenFactoryException02= Exception encountered while attempting to instantiate the specified implementation of UUIDFactory: {0} message={1}
\ No newline at end of file
1.2 +257 -229 xml-axis/java/src/org/apache/axis/ime/internal/util/uuid/SimpleUUIDGen.java
Index: SimpleUUIDGen.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/uuid/SimpleUUIDGen.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleUUIDGen.java 26 Oct 2002 22:05:04 -0000 1.1
+++ SimpleUUIDGen.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,3 +1,57 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
/**
*
@@ -8,9 +62,9 @@
package org.apache.axis.ime.internal.util.uuid;
-import java.math.*;
-import java.util.*;
+import java.math.BigInteger;
import java.security.SecureRandom;
+import java.util.Random;
/**
* Used to create new universally unique identifiers or UUID's (sometimes called
@@ -21,237 +75,211 @@
* @version 0.3.2 3/25/2001
* @since JDK1.2.2
*/
-public class SimpleUUIDGen implements UUIDGen
-{
- private static final BigInteger countStart = new BigInteger("-12219292800000"); // 15 October 1582
- private static final int clock_sequence = (new Random()).nextInt(16384);
-
- /**
- * Creates a new UUID. The algorithm used is described by The Open Group.
- * See <a href="http://www.opengroup.org/onlinepubs/009629399/apdxa.htm">
- * Universal Unique Identifier</a> for more details.
- * <p>
- * Due to a lack of functionality in Java, a part of the UUID is a secure
- * random. This results in a long processing time when this method is called
- * for the first time.
- */
- public String nextUUID()
- {
- // TODO: this method has to be checked for it's correctness. I'm not sure the standard is
- // implemented correctly.
-
- // the count of 100-nanosecond intervals since 00:00:00.00 15 October 1582
- BigInteger count;
-
- // the number of milliseconds since 1 January 1970
- BigInteger current = BigInteger.valueOf(System.currentTimeMillis());
-
- // the number of milliseconds since 15 October 1582
- BigInteger countMillis = current.subtract(countStart);
-
- // the result
- count = countMillis.multiply(BigInteger.valueOf(10000));
-
- String bitString = count.toString(2);
- if (bitString.length() < 60)
- {
- int nbExtraZeros = 60 - bitString.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
-
- bitString = extraZeros.concat(bitString);
- }
-
- byte[] bits = bitString.getBytes();
-
- // the time_low field
- byte[] time_low = new byte[32];
- for (int i=0; i<32; i++)
- time_low[i] = bits[bits.length - i - 1];
-
- // the time_mid field
- byte[] time_mid = new byte[16];
- for (int i=0; i<16; i++)
- time_mid[i] = bits[bits.length - 32 - i - 1];
-
- // the time_hi_and_version field
- byte[] time_hi_and_version = new byte[16];
- for (int i=0; i<12; i++)
- time_hi_and_version[i] = bits[bits.length - 48 - i - 1];
-
- time_hi_and_version[12] = ((new String("1")).getBytes())[0];
- time_hi_and_version[13] = ((new String("0")).getBytes())[0];
- time_hi_and_version[14] = ((new String("0")).getBytes())[0];
- time_hi_and_version[15] = ((new String("0")).getBytes())[0];
-
- // the clock_seq_low field
- BigInteger clockSequence = BigInteger.valueOf(clock_sequence);
- String clockString = clockSequence.toString(2);
- if (clockString.length() < 14)
- {
- int nbExtraZeros = 14 - bitString.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
+public class SimpleUUIDGen implements UUIDGen {
+ private static final BigInteger countStart = new BigInteger("-12219292800000"); // 15 October 1582
+ private static final int clock_sequence = (new Random()).nextInt(16384);
+
+ /**
+ * Creates a new UUID. The algorithm used is described by The Open Group.
+ * See <a href="http://www.opengroup.org/onlinepubs/009629399/apdxa.htm">
+ * Universal Unique Identifier</a> for more details.
+ * <p>
+ * Due to a lack of functionality in Java, a part of the UUID is a secure
+ * random. This results in a long processing time when this method is called
+ * for the first time.
+ */
+ public String nextUUID() {
+ // TODO: this method has to be checked for it's correctness. I'm not sure the standard is
+ // implemented correctly.
+
+ // the count of 100-nanosecond intervals since 00:00:00.00 15 October 1582
+ BigInteger count;
+
+ // the number of milliseconds since 1 January 1970
+ BigInteger current = BigInteger.valueOf(System.currentTimeMillis());
+
+ // the number of milliseconds since 15 October 1582
+ BigInteger countMillis = current.subtract(countStart);
+
+ // the result
+ count = countMillis.multiply(BigInteger.valueOf(10000));
+
+ String bitString = count.toString(2);
+ if (bitString.length() < 60) {
+ int nbExtraZeros = 60 - bitString.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+
+ bitString = extraZeros.concat(bitString);
+ }
+
+ byte[] bits = bitString.getBytes();
+
+ // the time_low field
+ byte[] time_low = new byte[32];
+ for (int i = 0; i < 32; i++)
+ time_low[i] = bits[bits.length - i - 1];
+
+ // the time_mid field
+ byte[] time_mid = new byte[16];
+ for (int i = 0; i < 16; i++)
+ time_mid[i] = bits[bits.length - 32 - i - 1];
+
+ // the time_hi_and_version field
+ byte[] time_hi_and_version = new byte[16];
+ for (int i = 0; i < 12; i++)
+ time_hi_and_version[i] = bits[bits.length - 48 - i - 1];
+
+ time_hi_and_version[12] = ((new String("1")).getBytes())[0];
+ time_hi_and_version[13] = ((new String("0")).getBytes())[0];
+ time_hi_and_version[14] = ((new String("0")).getBytes())[0];
+ time_hi_and_version[15] = ((new String("0")).getBytes())[0];
+
+ // the clock_seq_low field
+ BigInteger clockSequence = BigInteger.valueOf(clock_sequence);
+ String clockString = clockSequence.toString(2);
+ if (clockString.length() < 14) {
+ int nbExtraZeros = 14 - bitString.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+
+ clockString = extraZeros.concat(bitString);
+ }
+
+ byte[] clock_bits = clockString.getBytes();
+ byte[] clock_seq_low = new byte[8];
+ for (int i = 0; i < 8; i++)
+ clock_seq_low[i] = clock_bits[clock_bits.length - i - 1];
+
+ // the clock_seq_hi_and_reserved
+ byte[] clock_seq_hi_and_reserved = new byte[8];
+ for (int i = 0; i < 6; i++)
+ clock_seq_hi_and_reserved[i] = clock_bits[clock_bits.length - 8 - i - 1];
+
+ clock_seq_hi_and_reserved[6] = ((new String("0")).getBytes())[0];
+ clock_seq_hi_and_reserved[7] = ((new String("1")).getBytes())[0];
+
+ String timeLow = Long.toHexString((new BigInteger(new String(reverseArray(time_low)), 2)).longValue());
+ if (timeLow.length() < 8) {
+ int nbExtraZeros = 8 - timeLow.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+
+ timeLow = extraZeros.concat(timeLow);
+ }
+
+ String timeMid = Long.toHexString((new BigInteger(new String(reverseArray(time_mid)), 2)).longValue());
+ if (timeMid.length() < 4) {
+ int nbExtraZeros = 4 - timeMid.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+ timeMid = extraZeros.concat(timeMid);
+ }
+
+ String timeHiAndVersion = Long.toHexString((new BigInteger(new String(reverseArray(time_hi_and_version)), 2)).longValue());
+ if (timeHiAndVersion.length() < 4) {
+ int nbExtraZeros = 4 - timeHiAndVersion.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+
+ timeHiAndVersion = extraZeros.concat(timeHiAndVersion);
+ }
+
+ String clockSeqHiAndReserved = Long.toHexString((new BigInteger(new String(reverseArray(clock_seq_hi_and_reserved)), 2)).longValue());
+ if (clockSeqHiAndReserved.length() < 2) {
+ int nbExtraZeros = 2 - clockSeqHiAndReserved.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+
+ clockSeqHiAndReserved = extraZeros.concat(clockSeqHiAndReserved);
+ }
+
+ String clockSeqLow = Long.toHexString((new BigInteger(new String(reverseArray(clock_seq_low)), 2)).longValue());
+ if (clockSeqLow.length() < 2) {
+ int nbExtraZeros = 2 - clockSeqLow.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+
+ clockSeqLow = extraZeros.concat(clockSeqLow);
+ }
+
+ // problem: the node should be the IEEE 802 ethernet address, but can not
+ // be retrieved in Java yet.
+ // see bug ID 4173528
+ // workaround (also suggested in bug ID 4173528)
+ // If a system wants to generate UUIDs but has no IEE 802 compliant
+ // network card or other source of IEEE 802 addresses, then this section
+ // describes how to generate one.
+ // The ideal solution is to obtain a 47 bit cryptographic quality random
+ // number, and use it as the low 47 bits of the node ID, with the most
+ // significant bit of the first octet of the node ID set to 1. This bit
+ // is the unicast/multicast bit, which will never be set in IEEE 802
+ // addresses obtained from network cards; hence, there can never be a
+ // conflict between UUIDs generated by machines with and without network
+ // cards.
+ Random secureRandom = null;
+ try {
+ secureRandom = SecureRandom.getInstance("SHA1PRNG", "SUN");
+ } catch (Exception e) {
+ secureRandom = new Random();
+ }
+
+ long nodeValue = secureRandom.nextLong();
+ nodeValue = Math.abs(nodeValue);
+ while (nodeValue > 140737488355328L) {
+ nodeValue = secureRandom.nextLong();
+ nodeValue = Math.abs(nodeValue);
+ }
+
+ BigInteger nodeInt = BigInteger.valueOf(nodeValue);
+ String nodeString = nodeInt.toString(2);
+ if (nodeString.length() < 47) {
+ int nbExtraZeros = 47 - nodeString.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+
+ nodeString = extraZeros.concat(nodeString);
+ }
+
+ byte[] node_bits = nodeString.getBytes();
+ byte[] node = new byte[48];
+ for (int i = 0; i < 47; i++)
+ node[i] = node_bits[node_bits.length - i - 1];
+
+ node[47] = ((new String("1")).getBytes())[0];
+ String theNode = Long.toHexString((new BigInteger(new String(reverseArray(node)), 2)).longValue());
+ if (theNode.length() < 12) {
+ int nbExtraZeros = 12 - theNode.length();
+ String extraZeros = new String();
+ for (int i = 0; i < nbExtraZeros; i++)
+ extraZeros = extraZeros.concat("0");
+ theNode = extraZeros.concat(theNode);
+ }
+
+ String result = timeLow + "-" + timeMid + "-" + timeHiAndVersion + "-" + clockSeqHiAndReserved + clockSeqLow + "-" + theNode;
+
+ return result.toUpperCase();
+ }
+
+ private static byte[] reverseArray(byte[] bits) {
+ byte[] result = new byte[bits.length];
+ for (int i = 0; i < result.length; i++)
+ result[i] = bits[result.length - 1 - i];
- clockString = extraZeros.concat(bitString);
+ return result;
}
- byte[] clock_bits = clockString.getBytes();
- byte[] clock_seq_low = new byte[8];
- for (int i=0; i<8; i++)
- clock_seq_low[i] = clock_bits[clock_bits.length - i - 1];
-
- // the clock_seq_hi_and_reserved
- byte[] clock_seq_hi_and_reserved = new byte[8];
- for (int i=0; i<6; i++)
- clock_seq_hi_and_reserved[i] = clock_bits[clock_bits.length - 8 - i - 1];
-
- clock_seq_hi_and_reserved[6] = ((new String("0")).getBytes())[0];
- clock_seq_hi_and_reserved[7] = ((new String("1")).getBytes())[0];
-
- String timeLow = Long.toHexString((new BigInteger(new String(reverseArray(time_low)), 2)).longValue());
- if (timeLow.length() < 8)
- {
- int nbExtraZeros = 8 - timeLow.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
-
- timeLow = extraZeros.concat(timeLow);
+ public void destroy() {
}
- String timeMid = Long.toHexString((new BigInteger(new String(reverseArray(time_mid)), 2)).longValue());
- if (timeMid.length() < 4)
- {
- int nbExtraZeros = 4 - timeMid.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
- timeMid = extraZeros.concat(timeMid);
+ public void init() {
}
-
- String timeHiAndVersion = Long.toHexString((new BigInteger(new String(reverseArray(time_hi_and_version)), 2)).longValue());
- if (timeHiAndVersion.length() < 4)
- {
- int nbExtraZeros = 4 - timeHiAndVersion.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
-
- timeHiAndVersion = extraZeros.concat(timeHiAndVersion);
- }
-
- String clockSeqHiAndReserved = Long.toHexString((new BigInteger(new String(reverseArray(clock_seq_hi_and_reserved)), 2)).longValue());
- if (clockSeqHiAndReserved.length() < 2)
- {
- int nbExtraZeros = 2 - clockSeqHiAndReserved.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
-
- clockSeqHiAndReserved = extraZeros.concat(clockSeqHiAndReserved);
- }
-
- String clockSeqLow = Long.toHexString((new BigInteger(new String(reverseArray(clock_seq_low)), 2)).longValue());
- if (clockSeqLow.length() < 2)
- {
- int nbExtraZeros = 2 - clockSeqLow.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
-
- clockSeqLow = extraZeros.concat(clockSeqLow);
- }
-
- // problem: the node should be the IEEE 802 ethernet address, but can not
- // be retrieved in Java yet.
- // see bug ID 4173528
- // workaround (also suggested in bug ID 4173528)
- // If a system wants to generate UUIDs but has no IEE 802 compliant
- // network card or other source of IEEE 802 addresses, then this section
- // describes how to generate one.
- // The ideal solution is to obtain a 47 bit cryptographic quality random
- // number, and use it as the low 47 bits of the node ID, with the most
- // significant bit of the first octet of the node ID set to 1. This bit
- // is the unicast/multicast bit, which will never be set in IEEE 802
- // addresses obtained from network cards; hence, there can never be a
- // conflict between UUIDs generated by machines with and without network
- // cards.
- Random secureRandom = null;
- try {
- secureRandom = SecureRandom.getInstance("SHA1PRNG", "SUN");
- } catch (Exception e) {
- secureRandom = new Random();
- }
-
- long nodeValue = secureRandom.nextLong();
- nodeValue = Math.abs(nodeValue);
- while (nodeValue > 140737488355328L)
- {
- nodeValue = secureRandom.nextLong();
- nodeValue = Math.abs(nodeValue);
- }
-
- BigInteger nodeInt = BigInteger.valueOf(nodeValue);
- String nodeString = nodeInt.toString(2);
- if (nodeString.length() < 47)
- {
- int nbExtraZeros = 47 - nodeString.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
-
- nodeString = extraZeros.concat(nodeString);
- }
-
- byte[] node_bits = nodeString.getBytes();
- byte[] node = new byte[48];
- for (int i=0; i<47; i++)
- node[i] = node_bits[node_bits.length - i - 1];
-
- node[47] = ((new String("1")).getBytes())[0];
- String theNode = Long.toHexString((new BigInteger(new String(reverseArray(node)), 2)).longValue());
- if (theNode.length() < 12)
- {
- int nbExtraZeros = 12 - theNode.length();
- String extraZeros = new String();
- for (int i=0; i<nbExtraZeros; i++)
- extraZeros = extraZeros.concat("0");
- theNode = extraZeros.concat(theNode);
- }
-
- String result = timeLow + "-" + timeMid +"-" + timeHiAndVersion + "-" + clockSeqHiAndReserved + clockSeqLow + "-" + theNode;
-
- return result.toUpperCase();
- }
-
- private static byte[] reverseArray(byte[] bits)
- {
- byte[] result = new byte[bits.length];
- for (int i=0; i<result.length; i++)
- result[i] = bits[result.length - 1 - i];
-
- return result;
- }
-
- // test driver
- public static void main(String argc[])
- {
- UUIDGen uuidgen = new SimpleUUIDGen();
- for (int i = 1; i <= 250; ++i)
- {
- String uuid = uuidgen.nextUUID();
- System.out.println( i + ": " + uuid );
- }
- }
-
- public void destroy()
- {
- }
-
- public void init()
- {
- }
}
1.2 +60 -6 xml-axis/java/src/org/apache/axis/ime/internal/util/uuid/UUIDGen.java
Index: UUIDGen.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/uuid/UUIDGen.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UUIDGen.java 26 Oct 2002 22:05:04 -0000 1.1
+++ UUIDGen.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,3 +1,57 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
/**
*
@@ -8,7 +62,6 @@
package org.apache.axis.ime.internal.util.uuid;
-import java.io.*;
/**
* A Universally Unique Identifier (UUID) is a 128 bit number generated
@@ -21,9 +74,10 @@
* @version 1.0 11/7/2000
* @since JDK1.2.2
*/
-public interface UUIDGen
-{
- public void init();
- public void destroy();
- public String nextUUID();
+public interface UUIDGen {
+ public void init();
+
+ public void destroy();
+
+ public String nextUUID();
}
1.2 +94 -81 xml-axis/java/src/org/apache/axis/ime/internal/util/uuid/UUIDGenFactory.java
Index: UUIDGenFactory.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/uuid/UUIDGenFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UUIDGenFactory.java 26 Oct 2002 22:05:04 -0000 1.1
+++ UUIDGenFactory.java 28 Oct 2002 13:50:40 -0000 1.2
@@ -1,3 +1,57 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
/**
*
@@ -8,7 +62,7 @@
package org.apache.axis.ime.internal.util.uuid;
-import java.io.*;
+import org.apache.axis.i18n.Messages;
/**
* A Universally Unique Identifier (UUID) is a 128 bit number generated
@@ -21,86 +75,45 @@
* @version 1.0 11/7/2000
* @since JDK1.2.2
*/
-public abstract class UUIDGenFactory
-{
- private static final String defaultUUIDGenClassName = "org.apache.axis.ime.internal.util.uuid.SimpleUUIDGen";
-
- /**
- * getInstance
- *
- * Returns the singleton instance of UUIDGen
- */
- public static UUIDGen getUUIDGen(String uuidgenClassName)
- {
- UUIDGen uuidgen = null;
-
- if ((uuidgenClassName == null) || (uuidgenClassName.length() == 0))
- {
- // use the default UUIDGen implementation
- uuidgenClassName = defaultUUIDGenClassName;
- }
-
- Class uuidgenClass = null;
- try
- {
- // instruct the class loader to load the UUIDGen implementation
- uuidgenClass = java.lang.Class.forName(uuidgenClassName);
- }
- catch(ClassNotFoundException e)
- {
- throw new RuntimeException("The implementation of UUIDGen interface " +
- "specified cannot be found in the classpath: "+uuidgenClassName +
- " not found.");
- }
+public abstract class UUIDGenFactory {
+ private static final String defaultUUIDGenClassName = "org.apache.axis.ime.internal.util.uuid.SimpleUUIDGen";
- try
- {
- // try to instantiate the UUIDGen subclass
- uuidgen = (UUIDGen)uuidgenClass.newInstance();
+ /**
+ * getInstance
+ *
+ * Returns the singleton instance of UUIDGen
+ */
+ public static UUIDGen getUUIDGen(String uuidgenClassName) {
+ UUIDGen uuidgen = null;
+
+ if ((uuidgenClassName == null) || (uuidgenClassName.length() == 0)) {
+ // use the default UUIDGen implementation
+ uuidgenClassName = defaultUUIDGenClassName;
+ }
+
+ Class uuidgenClass = null;
+ try {
+ // instruct the class loader to load the UUIDGen implementation
+ uuidgenClass = java.lang.Class.forName(uuidgenClassName);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(Messages.getMessage("uuidGenFactoryCNFE00", uuidgenClassName));
+ }
+
+ try {
+ // try to instantiate the UUIDGen subclass
+ uuidgen = (UUIDGen) uuidgenClass.newInstance();
+ } catch (java.lang.Exception e) {
+ throw new RuntimeException(Messages.getMessage("uuidGenFactoryException02", uuidgenClass.getName(), e.getMessage()));
+ }
+
+ return uuidgen;
+ }
+
+ /**
+ * Release any aquired external resources and stop any background threads.
+ */
+ public static void destroyUUIDGen(UUIDGen uuidgen) {
+ if (uuidgen != null)
+ uuidgen.destroy();
}
- catch(java.lang.Exception e)
- {
- throw new RuntimeException("Exception encountered while attempting to " +
- "instantiate the specified implementation of UUIDFactory: " +
- uuidgenClass.getName() + "; message = " + e.getMessage());
- }
-
- return uuidgen;
- }
-
- /**
- * Release any aquired external resources and stop any background threads.
- */
- public static void destroyUUIDGen(UUIDGen uuidgen)
- {
- if (uuidgen != null)
- uuidgen.destroy();
- }
-
-
- /***************************************************************************/
- /***************************** TEST DRIVER *********************************/
- /***************************************************************************/
-
-
- // test driver
- public static void main(String argc[])
- {
- long startTime = 0;
- long endTime = 0;
- UUIDGen uuidgen = null;
-
- uuidgen = UUIDGenFactory.getUUIDGen(null);
-// uuidgen = UUIDGenFactory.getUUIDGen("org.juddi.uuidgen.SimpleUUIDGen");
- startTime = System.currentTimeMillis();
- for (int i = 1; i <= 50; ++i)
- {
- String u = uuidgen.nextUUID();
- System.out.println( i + ": " + u );
- }
- endTime = System.currentTimeMillis();
- System.out.println("SimpleJavaUUIDGen took "+(endTime-startTime)+" milliseconds");
-
- UUIDGenFactory.destroyUUIDGen(uuidgen);
- }
}
1.1 xml-axis/java/src/org/apache/axis/ime/internal/util/uuid/TestUUID.java
Index: TestUUID.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/**
*
* UUIDGen adopted from the juddi project
* (http://sourceforge.net/projects/juddi/)
*
*/
package org.apache.axis.ime.internal.util.uuid;
public class TestUUID {
/***************************************************************************/
/***************************** TEST DRIVER *********************************/
/***************************************************************************/
// test driver
public static void main(String argc[]) {
long startTime = 0;
long endTime = 0;
UUIDGen uuidgen = null;
uuidgen = UUIDGenFactory.getUUIDGen(null);
// uuidgen = UUIDGenFactory.getUUIDGen("org.juddi.uuidgen.SimpleUUIDGen");
startTime = System.currentTimeMillis();
for (int i = 1; i <= 50; ++i) {
String u = uuidgen.nextUUID();
System.out.println(i + ": " + u);
}
endTime = System.currentTimeMillis();
System.out.println("SimpleJavaUUIDGen took " + (endTime - startTime) + " milliseconds");
UUIDGenFactory.destroyUUIDGen(uuidgen);
}
}
1.15 +1 -0 xml-axis/java/test/utils/TestSrcContent.java
Index: TestSrcContent.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/utils/TestSrcContent.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TestSrcContent.java 18 Sep 2002 16:10:43 -0000 1.14
+++ TestSrcContent.java 28 Oct 2002 13:50:40 -0000 1.15
@@ -163,6 +163,7 @@
+ "java\\1src\\1org\\1apache\\1axis\\1"
+ "(?!utils\\1tcpmon\\.java"
+ "|providers\\1BSFProvider\\.java"
+ + "|ime\\1internal\\1util\\1uuid\\1TestUUID\\.java"
+ "|utils\\1CLArgsParser\\.java"
+ "|transport\\1jms\\1SimpleJMSListener\\.java"
+ "|Version\\.java"