You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/06/14 23:14:49 UTC

svn commit: r190657 [17/23] - in /incubator/beehive/trunk/system-controls: ./ ant/ samples/ejb/ samples/ejb/client/org/apache/beehive/controls/system/ejb/sample/client/ samples/ejb/control/org/apache/beehive/controls/system/ejb/sample/control/ samples/ejb/ejb/META-INF/ samples/ejb/ejb/org/apache/beehive/controls/system/ejb/sample/bean/ samples/jdbc/jdbcControlSample/ samples/jdbc/jdbcControlSample/META-INF/ samples/jdbc/jdbcControlSample/WEB-INF/ samples/jdbc/jdbcControlSample/WEB-INF/src/ samples/jdbc/jdbcControlSample/WEB-INF/src/controls/ samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/ samples/jdbc/jdbcControlSample/WEB-INF/src/shared/ samples/jms/ samples/jms/src/org/apache/beehive/controls/system/jms/samples/ samples/webservice/amazon/ samples/webservice/amazon/junit/ samples/webservice/amazon/schemas/ samples/webservice/common/src/test/ samples/webservice/google/ samples/webservice/google/junit/model/ samples/webservice/google/rpc_schemas/ samples/webservice/google/servlet/ samples/webservice/wsm_samples_client/ samples/webservice/wsm_samples_client/junit/ samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/ samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/ samples/webservice/xmlbeans/ samples/webservice/xmlbeans/junit/ src/ejb/ src/ejb/org/apache/beehive/controls/system/ejb/ src/ejb/schema/ src/jdbc/ src/jdbc/org/apache/beehive/controls/system/jdbc/ src/jdbc/org/apache/beehive/controls/system/jdbc/parser/ src/jms/ src/jms/org/apache/beehive/controls/system/jms/ src/jms/org/apache/beehive/controls/system/jms/impl/ src/jms/org/apache/beehive/controls/system/jndi/ src/jms/org/apache/beehive/controls/system/jndi/impl/ src/webservice/ src/webservice/org/apache/beehive/controls/system/webservice/ src/webservice/org/apache/beehive/controls/system/webservice/generator/ src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ src/webservice/org/apache/beehive/controls/system/webservice/utils/ test/ant/ test/conf/ test/src/jdbc/controls/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/dbconnection/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/errors/ test/src/jdbc/controls/org/apache/beehive/controls/system/jdbc/test/results/ test/src/jdbc/controls/schemas/badusers/ test/src/jdbc/controls/schemas/users/ test/src/jdbc/jdbc-container/ test/src/jdbc/jdbc-container/application/ test/src/jdbc/jdbc-container/src/org/apache/beehive/controls/system/jdbc/containertest/ test/src/jdbc/jdbc-container/webapp/WEB-INF/ test/src/jdbc/jdbc-container/webapp/conf/Catalina/localhost/ test/src/jdbc/junitTests/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/dbconnection/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/errors/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/results/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/sqlparser/ test/src/jdbc/junitTests/org/apache/beehive/controls/system/jdbc/units/utils/ test/src/webservice/ test/src/webservice/jcxgen-tests/ test/src/webservice/jcxgen-tests/tests/org/apache/beehive/controls/system/webservice/units/jcxgen/ test/src/webservice/schemas/ test/src/webservice/servers/webapp/WEB-INF/ test/src/webservice/servers/webapp/WEB-INF/src/org/apache/beehive/doclitwrap/ test/src/webservice/servers/webapp/WEB-INF/src/web/ test/src/webservice/servers/webapp/WEB-INF/webservices/web/complex/ test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/dlwservice/

Modified: incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/JMSControl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/JMSControl.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/JMSControl.java (original)
+++ incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/JMSControl.java Tue Jun 14 14:14:42 2005
@@ -1,471 +1,471 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.controls.system.jms;
-
-import java.util.Map;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import javax.jms.Session;
-
-import org.apache.beehive.controls.api.ControlException;
-import org.apache.beehive.controls.api.packaging.FeatureInfo;
-import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
-import org.apache.beehive.controls.api.bean.ControlInterface;
-import org.apache.beehive.controls.api.bean.AnnotationConstraints;
-import org.apache.beehive.controls.api.properties.PropertySet;
-
-/**
- * The control interface for the jms control.
- */
-@ControlInterface (defaultBinding="org.apache.beehive.controls.system.jms.impl.JMSControlImpl")
-public interface JMSControl
-{
-    /**
-     * The destination type. 
-     */
-    enum DestinationType 
-    { 
-        /** The destination is set from the object obtained from JNDI. */
-        Auto, 
-        /** The destination must be a javax.jms.QueueSender. */
-        Queue, 
-        /** The destination must be a javax.jms.TopicPublisher. */
-        Topic 
-    };
-    
-    /**
-     * The header type. Corresponds to the JMS* bean properties on a JMS message.
-     */
-    enum HeaderType 
-    { 
-        /** @see javax.jms.Message#getJMSCorrelationID */
-        JMSCorrelationID, 
-        /** @see javax.jms.Message#getJMSDeliveryMode */
-        JMSDeliveryMode, 
-        /** @see javax.jms.Message#getJMSPriority */
-        JMSPriority, 
-        /** @see javax.jms.Message#getJMSExpiration */
-        JMSExpiration, 
-        /** @see javax.jms.Message#getJMSMessageID */
-        JMSMessageID, 
-        /** @see javax.jms.Message#getJMSType */
-        JMSType, 
-        /** @see javax.jms.Message#getJMSRedelivered */
-        JMSRedelivered, 
-        /** @see javax.jms.Message#getJMSTimestamp */
-        JMSTimestamp 
-    };
-    
-    /**
-     * The message type. 
-     */
-    enum MessageType 
-    { 
-        /** Message is determined from the body instance class. If the method is not annotated with Body, then the message type is Map. */
-        Auto, 
-        /** Message is a {@link javax.jms.TextMessage} */
-        Text, 
-        /** Message is a {@link javax.jms.BytesMessage} */
-        Bytes, 
-        /** Message is a {@link javax.jms.ObjectMessage} */
-        Object, 
-        /** Message is a {@link javax.jms.MapMessage} */
-        Map, 
-        /** Message is a {@link javax.jms.Message} as given by the Body parameter */
-        JMSMessage 
-    };
-
-    /**
-     * The delivery mode.
-     */
-    enum DeliveryMode 
-    { 
-        /**
-         * @see javax.jms.DeliveryMode#NON_PERSISTENT
-         */
-        NonPersistent, 
-        /**
-         * @see javax.jms.DeliveryMode#PERSISTENT
-         */
-        Persistent,
-        /** The default for the provider */
-        Auto
-    };
-    
-    /**
-     * The acknowledge mode.
-     */   
-    enum AcknowledgeMode 
-    { 
-        /**
-         * @see javax.jms.Session#AUTO_ACKNOWLEDGE
-         */
-        Auto, 
-        /**
-         * @see javax.jms.Session#CLIENT_ACKNOWLEDGE
-         */
-        Client, 
-        /**
-         * @see javax.jms.Session#DUPS_OK_ACKNOWLEDGE
-         */
-        DupsOk 
-    };
-
-    /**
-     * Indicates the JMSCorrelationID message header. 
-     *
-     * @deprecated
-     * @see HeaderType#JMSCorrelationID
-     */
-    public static final String HEADER_CORRELATIONID = HeaderType.JMSCorrelationID.toString();
-
-    /**
-     * Indicates the JMSDeliveryMode message header. 
-     * 
-     * @deprecated
-     * @see HeaderType#JMSDeliveryMode
-     */
-    public static final String HEADER_DELIVERYMODE = HeaderType.JMSDeliveryMode.toString();
-
-    /**
-     * Indicates the JMSExpiration message header. 
-     * Use with the getHeaders and setHeaders methods.
-     * 
-     * @deprecated
-     * @see HeaderType#JMSExpiration
-     */
-    public static final String HEADER_EXPIRATION = HeaderType.JMSExpiration.toString();
-
-    /**
-     * Indicates the JMSMessageID message header. 
-     * 
-     * @deprecated
-     * @see HeaderType#JMSMessageID
-     */
-    public static final String HEADER_MESSAGEID = HeaderType.JMSMessageID.toString();
-
-    /**
-     * Indicates the JMSPriority message header. 
-     * 
-     * @deprecated
-     * @see HeaderType#JMSPriority
-     */
-    public static final String HEADER_PRIORITY = HeaderType.JMSPriority.toString();
-
-    /**
-     * Indicates the JMSRedelivered message header. 
-     * 
-     * @deprecated
-     * @see HeaderType#JMSRedelivered
-     */
-    public static final String HEADER_REDELIVERED = HeaderType.JMSRedelivered.toString();
-
-    /**
-     * Indicates the JMSTimestamp message header. 
-     * 
-     * @deprecated
-     * @see HeaderType#JMSTimestamp
-     */
-    public static final String HEADER_TIMESTAMP = HeaderType.JMSTimestamp.toString();
-
-    /**
-     * Indicates the JMSType message header. 
-     * 
-     * @deprecated
-     * @see HeaderType#JMSType
-     */
-    public static final String HEADER_TYPE = HeaderType.JMSType.toString();
-    
-    /**
-     * Get the {@link Session}.
-     * @return the session.
-     */
-    public Session getSession() throws ControlException;
-    
-    /**
-     * Get the {@link javax.jms.Connection}.
-     *
-     * @return the connection.
-     */
-    public javax.jms.Connection getConnection() throws ControlException;
-    
-    /**
-     * Get the {@link javax.jms.Destination}.
-     * 
-     * @return an instance destination object.
-     */
-    public javax.jms.Destination getDestination() throws ControlException;
-
-
-    /**
-     * Sets the JMS headers to be assigned to the next JMS message
-     * sent. Note that these headers are set only on the next message,
-     * subsequent messages will not get these headers. Also note that
-     * if the body is a message itself,
-     * then any header set through this map will override headers set
-     * in the message.
-     * 
-     * @param headers A map of header names (Strings or HeaderType) to header values.
-     */
-    public void setHeaders(Map headers);
-    
-    /**
-     * Sets a JMS header to be assigned to the next JMS message
-     * sent. Note that this headers is set only on the next message,
-     * subsequent messages will not get this header. Also note that
-     * if the body is a message itself,
-     * then the header set here will override the header set
-     * in the message.
-     * 
-     * @param type the header type.
-     * @param value the value for the header.
-     */
-    public void setHeader(JMSControl.HeaderType type,Object value);
-    
-    /**
-     * Sets the JMS properties to be assigned to the next JMS message
-     * sent. Note that these properties are set only on the next
-     * message, subsequent messages will not get these
-     * properties. Also note that if the next message is sent through
-     * a publish method, then any property set through this
-     * map will override properties set in the message itself.
-     * 
-     * @param properties A map of property names (Strings) to property
-     * values.
-     */
-    public void setProperties(Map properties); 
-    
-    /**
-     * Set the given JMS property to be assigned to the next JMS message sent. Note that
-     * this property is set only on the next message, subsequent messages will not get this
-     * property. Also note that if the body is a message itself, then the property set here
-     * will override the property set in the message.
-     * 
-     * @param name the property name.
-     * @param value the property value.
-     */
-    public void setProperty(String name,Object value); 
-
-    /**
-     * The message type used by the method. The default is to use the type of the body parameter.
-     */
-    @PropertySet(prefix="Message")
-    @Target({ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    public @interface Message
-    {             
-        @FeatureInfo(shortDescription="The message type")
-    	public JMSControl.MessageType value() default JMSControl.MessageType.Auto;
-    }
-
-    /**
-     * The method parameter representing a message property with the given name.
-     * For more information, see the property getter and setter methods on {@link Message}.
-     */
-    @Target({ElementType.PARAMETER})
-    @Retention(RetentionPolicy.RUNTIME)
-    public @interface Property
-    {
-        /**
-         * The property name.
-         */
-        public String name();
-    }
-    
-    /**
-     * The method parameter representing a message property with the given name and value.
-     * For more information, see the property getter and setter methods on {@link Message}.
-     */
-    @PropertySet(prefix="Property")
-    @Target({ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    public @interface PropertyValue
-    {
-        /**
-         * The property name.
-         */
-        public String name();
-        
-       /**
-        * The property value.
-        */
-        public String value();
-        
-        /**
-         * The property type.
-         */
-        public Class type() default String.class;
-        
-    }
-    
-    /**
-     * The method/parameter annotation representing a message priority. If not given
-     * then the default for the JMS provider is used.
-     */ 
-    @PropertySet(prefix="Priority")
-    @Target({ElementType.PARAMETER,ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    @AnnotationConstraints.AllowExternalOverride
-    public @interface Priority
-    {
-        @AnnotationMemberTypes.Optional
-        public int value() default -1;
-    }
-
-    /**
-     * The method/parameter representing the message JMS type. 
-     */ 
-    @PropertySet(prefix="Type")
-    @Target({ElementType.PARAMETER, ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    public @interface Type
-    {
-        public String value() default "";
-    } 
-
-    /**
-     * The method/parameter representing the message JMS CorrelationID. 
-     */ 
-    @PropertySet(prefix="CorrelationId")
-    @Target({ElementType.PARAMETER,ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    public @interface CorrelationId
-    {
-        public String value() default "";
-    }  
-
-    /**
-     * The method parameter representing a message expiration in milliseconds. 
-     * If not given then the default for the JMS provider is used.
-     */ 
-    @PropertySet(prefix="Expiration")
-    @Target({ElementType.PARAMETER,ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    @AnnotationConstraints.AllowExternalOverride
-    public @interface Expiration
-    {
-        @AnnotationMemberTypes.Optional
-        public long value() default -1L;
-    }
-
-    /**
-     * The method parameter representing a message delivery mode. 
-     * If not given then the default for the JMS provider is used.
-     */ 
-    @PropertySet(prefix="Delivery")
-    @Target({ElementType.PARAMETER,ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    public @interface Delivery
-    {
-        public JMSControl.DeliveryMode value() default JMSControl.DeliveryMode.Auto;
-    }
-
-    /**
-     * The method parameter representing one or more properties. 
-     */ 
-    @PropertySet(prefix="Properties")
-    @Target({ElementType.METHOD})
-    @Retention(RetentionPolicy.RUNTIME)
-    public @interface Properties
-    {
-        public PropertyValue[] value();
-    }
-
-    /**
-     * The JMS destination annotation for a extended class method.
-     */     
-    @PropertySet
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target({ElementType.TYPE,ElementType.FIELD})
-    @AnnotationConstraints.AllowExternalOverride
-    public @interface Destination
-    {
-        /**
-         * The JNDI name of the queue or topic.
-         */
-        // BUG: There should be a JMS_TOPIC_OR_QUEUE resource type.
-        @FeatureInfo(shortDescription="JNDI name of the queue or topic")
-        @AnnotationMemberTypes.JndiName( resourceType = AnnotationMemberTypes.JndiName.ResourceType.OTHER )
-    	public String sendJndiName();
-        
-        /**
-         * The Correlation-Id for messages.
-         */
-        @FeatureInfo(shortDescription="Correlation-Id for messages")
-        @AnnotationMemberTypes.Optional
-    	public String sendCorrelationProperty() default "";
-        
-        /**
-         * The JNDI name of queue connection factory.
-         */
-        @FeatureInfo(shortDescription="JNDI name of queue connection factory")
-    	public String jndiConnectionFactory();
-        
-        /**
-         * The destination type (DestinationType). The default is to use the type of the destination object named by the JNDI name.
-         */
-        @FeatureInfo(shortDescription="The destination type (DestinationType). The default is to use the type of the destination object named by the JNDI name")
-        @AnnotationMemberTypes.Optional
-        public JMSControl.DestinationType sendType() default JMSControl.DestinationType.Auto; 
-        
-        /**
-         * True if send is transacted. The default is transacted.
-         */
-        @FeatureInfo(shortDescription="True if send is transacted. The default is transacted")
-        @AnnotationMemberTypes.Optional
-        public boolean transacted() default true;
-        
-        /**
-         * The acknowledge mode. The default is to use auto-acknowledge.
-         */
-        @FeatureInfo(shortDescription="The acknowledge mode. The default is to use auto-acknowledge")
-        @AnnotationMemberTypes.Optional
-        public JMSControl.AcknowledgeMode acknowledgeMode() default JMSControl.AcknowledgeMode.Auto;
-        
-        /**
-         * The JNDI context factory.
-         */
-        @FeatureInfo(shortDescription="JNDI context factory")
-        @AnnotationMemberTypes.Optional
-    	public String jndiContextFactory() default "";
-        
-        /**
-         * The JNDI provider URL.
-         */
-        @FeatureInfo(shortDescription="JNDI provider URL")      
-        @AnnotationMemberTypes.Optional
-        @AnnotationMemberTypes.URI
-    	public String jndiProviderURL() default "";
-        
-        /**
-         * The JNDI security principal.
-         */
-        @FeatureInfo(shortDescription="JNDI security principal")      
-        @AnnotationMemberTypes.Optional
-    	public String jndiUsername() default "";
-
-        /**
-         * The JNDI security credentials.
-         */
-        @FeatureInfo(shortDescription="JNDI security credentials")      
-        @AnnotationMemberTypes.Optional
-    	public String jndiPassword() default "";
-    }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.jms;
+
+import java.util.Map;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import javax.jms.Session;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.bean.AnnotationConstraints;
+import org.apache.beehive.controls.api.properties.PropertySet;
+
+/**
+ * The control interface for the jms control.
+ */
+@ControlInterface (defaultBinding="org.apache.beehive.controls.system.jms.impl.JMSControlImpl")
+public interface JMSControl
+{
+    /**
+     * The destination type. 
+     */
+    enum DestinationType 
+    { 
+        /** The destination is set from the object obtained from JNDI. */
+        Auto, 
+        /** The destination must be a javax.jms.QueueSender. */
+        Queue, 
+        /** The destination must be a javax.jms.TopicPublisher. */
+        Topic 
+    };
+    
+    /**
+     * The header type. Corresponds to the JMS* bean properties on a JMS message.
+     */
+    enum HeaderType 
+    { 
+        /** @see javax.jms.Message#getJMSCorrelationID */
+        JMSCorrelationID, 
+        /** @see javax.jms.Message#getJMSDeliveryMode */
+        JMSDeliveryMode, 
+        /** @see javax.jms.Message#getJMSPriority */
+        JMSPriority, 
+        /** @see javax.jms.Message#getJMSExpiration */
+        JMSExpiration, 
+        /** @see javax.jms.Message#getJMSMessageID */
+        JMSMessageID, 
+        /** @see javax.jms.Message#getJMSType */
+        JMSType, 
+        /** @see javax.jms.Message#getJMSRedelivered */
+        JMSRedelivered, 
+        /** @see javax.jms.Message#getJMSTimestamp */
+        JMSTimestamp 
+    };
+    
+    /**
+     * The message type. 
+     */
+    enum MessageType 
+    { 
+        /** Message is determined from the body instance class. If the method is not annotated with Body, then the message type is Map. */
+        Auto, 
+        /** Message is a {@link javax.jms.TextMessage} */
+        Text, 
+        /** Message is a {@link javax.jms.BytesMessage} */
+        Bytes, 
+        /** Message is a {@link javax.jms.ObjectMessage} */
+        Object, 
+        /** Message is a {@link javax.jms.MapMessage} */
+        Map, 
+        /** Message is a {@link javax.jms.Message} as given by the Body parameter */
+        JMSMessage 
+    };
+
+    /**
+     * The delivery mode.
+     */
+    enum DeliveryMode 
+    { 
+        /**
+         * @see javax.jms.DeliveryMode#NON_PERSISTENT
+         */
+        NonPersistent, 
+        /**
+         * @see javax.jms.DeliveryMode#PERSISTENT
+         */
+        Persistent,
+        /** The default for the provider */
+        Auto
+    };
+    
+    /**
+     * The acknowledge mode.
+     */   
+    enum AcknowledgeMode 
+    { 
+        /**
+         * @see javax.jms.Session#AUTO_ACKNOWLEDGE
+         */
+        Auto, 
+        /**
+         * @see javax.jms.Session#CLIENT_ACKNOWLEDGE
+         */
+        Client, 
+        /**
+         * @see javax.jms.Session#DUPS_OK_ACKNOWLEDGE
+         */
+        DupsOk 
+    };
+
+    /**
+     * Indicates the JMSCorrelationID message header. 
+     *
+     * @deprecated
+     * @see HeaderType#JMSCorrelationID
+     */
+    public static final String HEADER_CORRELATIONID = HeaderType.JMSCorrelationID.toString();
+
+    /**
+     * Indicates the JMSDeliveryMode message header. 
+     * 
+     * @deprecated
+     * @see HeaderType#JMSDeliveryMode
+     */
+    public static final String HEADER_DELIVERYMODE = HeaderType.JMSDeliveryMode.toString();
+
+    /**
+     * Indicates the JMSExpiration message header. 
+     * Use with the getHeaders and setHeaders methods.
+     * 
+     * @deprecated
+     * @see HeaderType#JMSExpiration
+     */
+    public static final String HEADER_EXPIRATION = HeaderType.JMSExpiration.toString();
+
+    /**
+     * Indicates the JMSMessageID message header. 
+     * 
+     * @deprecated
+     * @see HeaderType#JMSMessageID
+     */
+    public static final String HEADER_MESSAGEID = HeaderType.JMSMessageID.toString();
+
+    /**
+     * Indicates the JMSPriority message header. 
+     * 
+     * @deprecated
+     * @see HeaderType#JMSPriority
+     */
+    public static final String HEADER_PRIORITY = HeaderType.JMSPriority.toString();
+
+    /**
+     * Indicates the JMSRedelivered message header. 
+     * 
+     * @deprecated
+     * @see HeaderType#JMSRedelivered
+     */
+    public static final String HEADER_REDELIVERED = HeaderType.JMSRedelivered.toString();
+
+    /**
+     * Indicates the JMSTimestamp message header. 
+     * 
+     * @deprecated
+     * @see HeaderType#JMSTimestamp
+     */
+    public static final String HEADER_TIMESTAMP = HeaderType.JMSTimestamp.toString();
+
+    /**
+     * Indicates the JMSType message header. 
+     * 
+     * @deprecated
+     * @see HeaderType#JMSType
+     */
+    public static final String HEADER_TYPE = HeaderType.JMSType.toString();
+    
+    /**
+     * Get the {@link Session}.
+     * @return the session.
+     */
+    public Session getSession() throws ControlException;
+    
+    /**
+     * Get the {@link javax.jms.Connection}.
+     *
+     * @return the connection.
+     */
+    public javax.jms.Connection getConnection() throws ControlException;
+    
+    /**
+     * Get the {@link javax.jms.Destination}.
+     * 
+     * @return an instance destination object.
+     */
+    public javax.jms.Destination getDestination() throws ControlException;
+
+
+    /**
+     * Sets the JMS headers to be assigned to the next JMS message
+     * sent. Note that these headers are set only on the next message,
+     * subsequent messages will not get these headers. Also note that
+     * if the body is a message itself,
+     * then any header set through this map will override headers set
+     * in the message.
+     * 
+     * @param headers A map of header names (Strings or HeaderType) to header values.
+     */
+    public void setHeaders(Map headers);
+    
+    /**
+     * Sets a JMS header to be assigned to the next JMS message
+     * sent. Note that this headers is set only on the next message,
+     * subsequent messages will not get this header. Also note that
+     * if the body is a message itself,
+     * then the header set here will override the header set
+     * in the message.
+     * 
+     * @param type the header type.
+     * @param value the value for the header.
+     */
+    public void setHeader(JMSControl.HeaderType type,Object value);
+    
+    /**
+     * Sets the JMS properties to be assigned to the next JMS message
+     * sent. Note that these properties are set only on the next
+     * message, subsequent messages will not get these
+     * properties. Also note that if the next message is sent through
+     * a publish method, then any property set through this
+     * map will override properties set in the message itself.
+     * 
+     * @param properties A map of property names (Strings) to property
+     * values.
+     */
+    public void setProperties(Map properties); 
+    
+    /**
+     * Set the given JMS property to be assigned to the next JMS message sent. Note that
+     * this property is set only on the next message, subsequent messages will not get this
+     * property. Also note that if the body is a message itself, then the property set here
+     * will override the property set in the message.
+     * 
+     * @param name the property name.
+     * @param value the property value.
+     */
+    public void setProperty(String name,Object value); 
+
+    /**
+     * The message type used by the method. The default is to use the type of the body parameter.
+     */
+    @PropertySet(prefix="Message")
+    @Target({ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface Message
+    {             
+        @FeatureInfo(shortDescription="The message type")
+    	public JMSControl.MessageType value() default JMSControl.MessageType.Auto;
+    }
+
+    /**
+     * The method parameter representing a message property with the given name.
+     * For more information, see the property getter and setter methods on {@link Message}.
+     */
+    @Target({ElementType.PARAMETER})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface Property
+    {
+        /**
+         * The property name.
+         */
+        public String name();
+    }
+    
+    /**
+     * The method parameter representing a message property with the given name and value.
+     * For more information, see the property getter and setter methods on {@link Message}.
+     */
+    @PropertySet(prefix="Property")
+    @Target({ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface PropertyValue
+    {
+        /**
+         * The property name.
+         */
+        public String name();
+        
+       /**
+        * The property value.
+        */
+        public String value();
+        
+        /**
+         * The property type.
+         */
+        public Class type() default String.class;
+        
+    }
+    
+    /**
+     * The method/parameter annotation representing a message priority. If not given
+     * then the default for the JMS provider is used.
+     */ 
+    @PropertySet(prefix="Priority")
+    @Target({ElementType.PARAMETER,ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    @AnnotationConstraints.AllowExternalOverride
+    public @interface Priority
+    {
+        @AnnotationMemberTypes.Optional
+        public int value() default -1;
+    }
+
+    /**
+     * The method/parameter representing the message JMS type. 
+     */ 
+    @PropertySet(prefix="Type")
+    @Target({ElementType.PARAMETER, ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface Type
+    {
+        public String value() default "";
+    } 
+
+    /**
+     * The method/parameter representing the message JMS CorrelationID. 
+     */ 
+    @PropertySet(prefix="CorrelationId")
+    @Target({ElementType.PARAMETER,ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface CorrelationId
+    {
+        public String value() default "";
+    }  
+
+    /**
+     * The method parameter representing a message expiration in milliseconds. 
+     * If not given then the default for the JMS provider is used.
+     */ 
+    @PropertySet(prefix="Expiration")
+    @Target({ElementType.PARAMETER,ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    @AnnotationConstraints.AllowExternalOverride
+    public @interface Expiration
+    {
+        @AnnotationMemberTypes.Optional
+        public long value() default -1L;
+    }
+
+    /**
+     * The method parameter representing a message delivery mode. 
+     * If not given then the default for the JMS provider is used.
+     */ 
+    @PropertySet(prefix="Delivery")
+    @Target({ElementType.PARAMETER,ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface Delivery
+    {
+        public JMSControl.DeliveryMode value() default JMSControl.DeliveryMode.Auto;
+    }
+
+    /**
+     * The method parameter representing one or more properties. 
+     */ 
+    @PropertySet(prefix="Properties")
+    @Target({ElementType.METHOD})
+    @Retention(RetentionPolicy.RUNTIME)
+    public @interface Properties
+    {
+        public PropertyValue[] value();
+    }
+
+    /**
+     * The JMS destination annotation for a extended class method.
+     */     
+    @PropertySet
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE,ElementType.FIELD})
+    @AnnotationConstraints.AllowExternalOverride
+    public @interface Destination
+    {
+        /**
+         * The JNDI name of the queue or topic.
+         */
+        // BUG: There should be a JMS_TOPIC_OR_QUEUE resource type.
+        @FeatureInfo(shortDescription="JNDI name of the queue or topic")
+        @AnnotationMemberTypes.JndiName( resourceType = AnnotationMemberTypes.JndiName.ResourceType.OTHER )
+    	public String sendJndiName();
+        
+        /**
+         * The Correlation-Id for messages.
+         */
+        @FeatureInfo(shortDescription="Correlation-Id for messages")
+        @AnnotationMemberTypes.Optional
+    	public String sendCorrelationProperty() default "";
+        
+        /**
+         * The JNDI name of queue connection factory.
+         */
+        @FeatureInfo(shortDescription="JNDI name of queue connection factory")
+    	public String jndiConnectionFactory();
+        
+        /**
+         * The destination type (DestinationType). The default is to use the type of the destination object named by the JNDI name.
+         */
+        @FeatureInfo(shortDescription="The destination type (DestinationType). The default is to use the type of the destination object named by the JNDI name")
+        @AnnotationMemberTypes.Optional
+        public JMSControl.DestinationType sendType() default JMSControl.DestinationType.Auto; 
+        
+        /**
+         * True if send is transacted. The default is transacted.
+         */
+        @FeatureInfo(shortDescription="True if send is transacted. The default is transacted")
+        @AnnotationMemberTypes.Optional
+        public boolean transacted() default true;
+        
+        /**
+         * The acknowledge mode. The default is to use auto-acknowledge.
+         */
+        @FeatureInfo(shortDescription="The acknowledge mode. The default is to use auto-acknowledge")
+        @AnnotationMemberTypes.Optional
+        public JMSControl.AcknowledgeMode acknowledgeMode() default JMSControl.AcknowledgeMode.Auto;
+        
+        /**
+         * The JNDI context factory.
+         */
+        @FeatureInfo(shortDescription="JNDI context factory")
+        @AnnotationMemberTypes.Optional
+    	public String jndiContextFactory() default "";
+        
+        /**
+         * The JNDI provider URL.
+         */
+        @FeatureInfo(shortDescription="JNDI provider URL")      
+        @AnnotationMemberTypes.Optional
+        @AnnotationMemberTypes.URI
+    	public String jndiProviderURL() default "";
+        
+        /**
+         * The JNDI security principal.
+         */
+        @FeatureInfo(shortDescription="JNDI security principal")      
+        @AnnotationMemberTypes.Optional
+    	public String jndiUsername() default "";
+
+        /**
+         * The JNDI security credentials.
+         */
+        @FeatureInfo(shortDescription="JNDI security credentials")      
+        @AnnotationMemberTypes.Optional
+    	public String jndiPassword() default "";
+    }
+}

Propchange: incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/JMSControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jms/impl/JMSControlImpl.jcs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/JndiControl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/JndiControl.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/JndiControl.java (original)
+++ incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/JndiControl.java Tue Jun 14 14:14:42 2005
@@ -1,91 +1,91 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-
-package org.apache.beehive.controls.system.jndi;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import javax.naming.InitialContext;
-
-import org.apache.beehive.controls.api.ControlException;
-import org.apache.beehive.controls.api.packaging.FeatureInfo;
-import org.apache.beehive.controls.api.properties.PropertySet;
-import org.apache.beehive.controls.api.bean.ControlInterface;
-import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
-
-/**
- * The Jndi Control encapsulates access to the JNDI context. It
- * provides annotation for setting the factory and provider URL.
- */
-@ControlInterface (defaultBinding="org.apache.beehive.controls.system.jndi.impl.JndiControlImpl")
-public interface JndiControl
-{
-    /**
-     * Get a JNDI based resource.
-     * @param resource the resource name.
-     * @param resourceClass the resource class.
-     * @return the resource object.
-     * @throws ControlException
-     */
-    public Object getResource(String resource,Class resourceClass) throws ControlException;
-
-    /**
-     * Get the JNDI initial context.
-     * @return the initial context.
-     *
-     * @throws ControlException
-     */
-    public InitialContext getInitialContext() throws ControlException;
-
-    @PropertySet
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target({ElementType.TYPE,ElementType.FIELD})
-    public @interface Properties
-    {
-        /**
-         * The JNDI context factory class name.
-         */
-        @FeatureInfo(shortDescription="JNDI context factory")
-        @AnnotationMemberTypes.Optional
-        String factory();
-
-        /**
-         * The JNDI provider URL.
-         */
-        @FeatureInfo(shortDescription="JNDI provider URL")      
-        @AnnotationMemberTypes.Optional
-        @AnnotationMemberTypes.URI
-        String url();
-
-        /**
-         * The JNDI security principal.
-         */
-        @FeatureInfo(shortDescription="JNDI security principal")      
-        @AnnotationMemberTypes.Optional
-    	public String jndiSecurityPrincipal() default "";
-
-        /**
-         * The JNDI security credentials.
-         */
-        @FeatureInfo(shortDescription="JNDI security credentials")      
-        @AnnotationMemberTypes.Optional
-    	public String jndiSecurityCredentials() default "";
-    }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+package org.apache.beehive.controls.system.jndi;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import javax.naming.InitialContext;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.packaging.FeatureInfo;
+import org.apache.beehive.controls.api.properties.PropertySet;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
+
+/**
+ * The Jndi Control encapsulates access to the JNDI context. It
+ * provides annotation for setting the factory and provider URL.
+ */
+@ControlInterface (defaultBinding="org.apache.beehive.controls.system.jndi.impl.JndiControlImpl")
+public interface JndiControl
+{
+    /**
+     * Get a JNDI based resource.
+     * @param resource the resource name.
+     * @param resourceClass the resource class.
+     * @return the resource object.
+     * @throws ControlException
+     */
+    public Object getResource(String resource,Class resourceClass) throws ControlException;
+
+    /**
+     * Get the JNDI initial context.
+     * @return the initial context.
+     *
+     * @throws ControlException
+     */
+    public InitialContext getInitialContext() throws ControlException;
+
+    @PropertySet
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE,ElementType.FIELD})
+    public @interface Properties
+    {
+        /**
+         * The JNDI context factory class name.
+         */
+        @FeatureInfo(shortDescription="JNDI context factory")
+        @AnnotationMemberTypes.Optional
+        String factory();
+
+        /**
+         * The JNDI provider URL.
+         */
+        @FeatureInfo(shortDescription="JNDI provider URL")      
+        @AnnotationMemberTypes.Optional
+        @AnnotationMemberTypes.URI
+        String url();
+
+        /**
+         * The JNDI security principal.
+         */
+        @FeatureInfo(shortDescription="JNDI security principal")      
+        @AnnotationMemberTypes.Optional
+    	public String jndiSecurityPrincipal() default "";
+
+        /**
+         * The JNDI security credentials.
+         */
+        @FeatureInfo(shortDescription="JNDI security credentials")      
+        @AnnotationMemberTypes.Optional
+    	public String jndiSecurityCredentials() default "";
+    }
+}

Propchange: incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/JndiControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.jcs
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.jcs?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.jcs (original)
+++ incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.jcs Tue Jun 14 14:14:42 2005
@@ -1,129 +1,129 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.controls.system.jndi.impl;
-
-import java.util.Hashtable;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.apache.beehive.controls.api.ControlException;
-import org.apache.beehive.controls.api.context.ControlBeanContext;
-import org.apache.beehive.controls.api.context.Context;
-import org.apache.beehive.controls.api.bean.ControlImplementation;
-import org.apache.beehive.controls.system.jndi.JndiControl;
-
-/**
- * Implementation of the jndi control.
- */
-@ControlImplementation
-public class JndiControlImpl
-    implements JndiControl, java.io.Serializable {
-
-    /**
-     * @see JndiControl#getResource(String, Class)
-     */
-    public Object getResource(String resource,Class resourceClass) throws ControlException
-    {
-        try
-        {
-        	InitialContext cntxt = getInitialContext();
-	        Object obj = cntxt.lookup(resource);
-	        if(resourceClass != null && !(resourceClass.isInstance(obj)))
-	        {
-	            throw new ControlException("JNDI resource '"+resource+"' is not an instance of '"+resourceClass.getName()+"'");
-	        }
-	        return obj;
-        }
-        catch(NamingException e)
-        {
-            throw new ControlException("Cannot load JNDI resource '"+resource+"'",e);
-        }
-    }
-    
-    /**
-     * Get the initial context.
-     * @return the initial context.
-     */
-    public InitialContext getInitialContext() throws ControlException
-    {
-    	if(_initialContext != null)
-    	{
-    		return _initialContext;
-    	}
-    	Properties props = (Properties) _context.getControlPropertySet(Properties.class);
-        String url = nullIfEmpty(props.url());
-        String factory = nullIfEmpty(props.factory());
-	    if(url == null && factory == null)
-	    {
-	        try
-	        {
-				return new InitialContext();
-	        }
-	        catch(NamingException e)
-	        {        	
-	        	throw new ControlException("Cannot get default JNDI initial context",e);
-	        }
-        
-		}
-        if(url == null || factory == null)
-        {
-            throw new ControlException("Both the provider-url and jndi factory need to be provided");
-           
-        }
-        Hashtable<String,String> env = new Hashtable<String,String>();
-        env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, factory);
-        env.put(javax.naming.Context.PROVIDER_URL,url);
-        String username = nullIfEmpty(props.jndiSecurityPrincipal());
-        if(username != null)
-        {
-        	env.put(javax.naming.Context.SECURITY_PRINCIPAL,username);
-        }
-        String password = nullIfEmpty(props.jndiSecurityCredentials());
-        if(password != null)
-        {
-        	env.put(javax.naming.Context.SECURITY_CREDENTIALS,password);
-        }
-        try
-        {
-        	return _initialContext = new InitialContext(env);
-        }
-        catch(NamingException e)
-        {        	
-        	throw new ControlException("Cannot get JNDI initial context at provider '"+url+"' with factory '"+factory+"'",e);
-        }
-    }
-    /**
-     * Return null if the given string is null or an empty string.
-     * @param str a string.
-     * @return null or the string.
-     */
-    protected String nullIfEmpty(String str)
-    {
-    	if(str == null || str.trim().length() == 0)
-    	{
-    		return null;
-    	}
-    	return str;
-    }
-    /* Control Managed Field(s) */
-    @Context ControlBeanContext _context;
-
-    /* Private Field(s) */
-    /** The initial context. */
-    private transient InitialContext _initialContext;
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.jndi.impl;
+
+import java.util.Hashtable;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.context.Context;
+import org.apache.beehive.controls.api.bean.ControlImplementation;
+import org.apache.beehive.controls.system.jndi.JndiControl;
+
+/**
+ * Implementation of the jndi control.
+ */
+@ControlImplementation
+public class JndiControlImpl
+    implements JndiControl, java.io.Serializable {
+
+    /**
+     * @see JndiControl#getResource(String, Class)
+     */
+    public Object getResource(String resource,Class resourceClass) throws ControlException
+    {
+        try
+        {
+        	InitialContext cntxt = getInitialContext();
+	        Object obj = cntxt.lookup(resource);
+	        if(resourceClass != null && !(resourceClass.isInstance(obj)))
+	        {
+	            throw new ControlException("JNDI resource '"+resource+"' is not an instance of '"+resourceClass.getName()+"'");
+	        }
+	        return obj;
+        }
+        catch(NamingException e)
+        {
+            throw new ControlException("Cannot load JNDI resource '"+resource+"'",e);
+        }
+    }
+    
+    /**
+     * Get the initial context.
+     * @return the initial context.
+     */
+    public InitialContext getInitialContext() throws ControlException
+    {
+    	if(_initialContext != null)
+    	{
+    		return _initialContext;
+    	}
+    	Properties props = (Properties) _context.getControlPropertySet(Properties.class);
+        String url = nullIfEmpty(props.url());
+        String factory = nullIfEmpty(props.factory());
+	    if(url == null && factory == null)
+	    {
+	        try
+	        {
+				return new InitialContext();
+	        }
+	        catch(NamingException e)
+	        {        	
+	        	throw new ControlException("Cannot get default JNDI initial context",e);
+	        }
+        
+		}
+        if(url == null || factory == null)
+        {
+            throw new ControlException("Both the provider-url and jndi factory need to be provided");
+           
+        }
+        Hashtable<String,String> env = new Hashtable<String,String>();
+        env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, factory);
+        env.put(javax.naming.Context.PROVIDER_URL,url);
+        String username = nullIfEmpty(props.jndiSecurityPrincipal());
+        if(username != null)
+        {
+        	env.put(javax.naming.Context.SECURITY_PRINCIPAL,username);
+        }
+        String password = nullIfEmpty(props.jndiSecurityCredentials());
+        if(password != null)
+        {
+        	env.put(javax.naming.Context.SECURITY_CREDENTIALS,password);
+        }
+        try
+        {
+        	return _initialContext = new InitialContext(env);
+        }
+        catch(NamingException e)
+        {        	
+        	throw new ControlException("Cannot get JNDI initial context at provider '"+url+"' with factory '"+factory+"'",e);
+        }
+    }
+    /**
+     * Return null if the given string is null or an empty string.
+     * @param str a string.
+     * @return null or the string.
+     */
+    protected String nullIfEmpty(String str)
+    {
+    	if(str == null || str.trim().length() == 0)
+    	{
+    		return null;
+    	}
+    	return str;
+    }
+    /* Control Managed Field(s) */
+    @Context ControlBeanContext _context;
+
+    /* Private Field(s) */
+    /** The initial context. */
+    private transient InitialContext _initialContext;
+}

Propchange: incubator/beehive/trunk/system-controls/src/jms/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.jcs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/system-controls/src/webservice/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/build.xml?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/build.xml (original)
+++ incubator/beehive/trunk/system-controls/src/webservice/build.xml Tue Jun 14 14:14:42 2005
@@ -1,63 +1,63 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<project name="Service Control Build" default="build" basedir=".">
-
-    <import file="../../systemcontrols-imports.xml"/>
-
-    <property name="module.name" value="webservice-control"/>
-    <property name="module.dir" location="${src.dir}/webservice"/>
-    <property name="wsc.version" value="svn-snapshot"/>
-
-    <path id="module.classpath">
-        <path refid="webservices.dependency.path"/>
-        <path refid="controls.dependency.path"/>
-        <path refid="velocity.dependency.path"/>
-        <path refid="log4j.dependency.path"/>
-        <path refid="xbean.dependency.path"/>
-        <path refid="tools.dependency.path"/>
-    </path>
-
-    <!-- ========================================= -->
-    <!-- build - build the webservice control      -->
-    <!-- ========================================= -->
-    <target name="build" description="Builds webservice control.">
-
-        <mkdir dir="${classes.dir}/${module.name}"/>
-        <mkdir dir="${gen.src.dir}/${module.name}"/>
-
-        <build-controls srcdir="${module.dir}" 
-                        destdir="${classes.dir}/${module.name}"
-                        tempdir="${gen.src.dir}/${module.name}" 
-                        classpathref="module.classpath"/>
-
-        <copy todir="${classes.dir}/${module.name}">
-            <fileset dir="${module.dir}">
-                <include name="**/*.properties"/>
-            </fileset>
-        </copy>
-
-        <jar destfile="${build.lib.dir}/${wsmcontrol.jar.name}" basedir="${classes.dir}/${module.name}">
-          <manifest>
-            <attribute name="Extension-Name" value="Beehive Web Service Control"/>
-            <attribute name="Specification-Title" value="Beehive Web Service Control"/>
-            <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
-            <attribute name="Specification-Version" value="${beehive.version}"/>
-            <attribute name="Implementation-Title" value="Beehive Web Service Control"/>
-            <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
-            <attribute name="Implementation-Version" value="${beehive.version}"/>
-            <attribute name="Web-Service-Control-Version" value="${beehive.version}"/>
-          </manifest>
-        </jar>
-    </target>
-
-    <!-- ========================================= -->
-    <!-- clean - delete all binaries and artifacts -->
-    <!-- ========================================= -->
-
-    <target name="clean">
-        <delete dir="${classes.dir}/${module.name}"/>
-        <delete dir="${gen.src.dir}/${module.name}"/>
-        <delete file="${build.lib.dir}/${wsmcontrol.jar.name}"/>
-    </target>
-
-</project>
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="Service Control Build" default="build" basedir=".">
+
+    <import file="../../systemcontrols-imports.xml"/>
+
+    <property name="module.name" value="webservice-control"/>
+    <property name="module.dir" location="${src.dir}/webservice"/>
+    <property name="wsc.version" value="svn-snapshot"/>
+
+    <path id="module.classpath">
+        <path refid="webservices.dependency.path"/>
+        <path refid="controls.dependency.path"/>
+        <path refid="velocity.dependency.path"/>
+        <path refid="log4j.dependency.path"/>
+        <path refid="xbean.dependency.path"/>
+        <path refid="tools.dependency.path"/>
+    </path>
+
+    <!-- ========================================= -->
+    <!-- build - build the webservice control      -->
+    <!-- ========================================= -->
+    <target name="build" description="Builds webservice control.">
+
+        <mkdir dir="${classes.dir}/${module.name}"/>
+        <mkdir dir="${gen.src.dir}/${module.name}"/>
+
+        <build-controls srcdir="${module.dir}" 
+                        destdir="${classes.dir}/${module.name}"
+                        tempdir="${gen.src.dir}/${module.name}" 
+                        classpathref="module.classpath"/>
+
+        <copy todir="${classes.dir}/${module.name}">
+            <fileset dir="${module.dir}">
+                <include name="**/*.properties"/>
+            </fileset>
+        </copy>
+
+        <jar destfile="${build.lib.dir}/${wsmcontrol.jar.name}" basedir="${classes.dir}/${module.name}">
+          <manifest>
+            <attribute name="Extension-Name" value="Beehive Web Service Control"/>
+            <attribute name="Specification-Title" value="Beehive Web Service Control"/>
+            <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
+            <attribute name="Specification-Version" value="${beehive.version}"/>
+            <attribute name="Implementation-Title" value="Beehive Web Service Control"/>
+            <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
+            <attribute name="Implementation-Version" value="${beehive.version}"/>
+            <attribute name="Web-Service-Control-Version" value="${beehive.version}"/>
+          </manifest>
+        </jar>
+    </target>
+
+    <!-- ========================================= -->
+    <!-- clean - delete all binaries and artifacts -->
+    <!-- ========================================= -->
+
+    <target name="clean">
+        <delete dir="${classes.dir}/${module.name}"/>
+        <delete dir="${gen.src.dir}/${module.name}"/>
+        <delete file="${build.lib.dir}/${wsmcontrol.jar.name}"/>
+    </target>
+
+</project>

Propchange: incubator/beehive/trunk/system-controls/src/webservice/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java (original)
+++ incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java Tue Jun 14 14:14:42 2005
@@ -1,185 +1,185 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.controls.system.webservice;
-
-import javax.xml.namespace.QName;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.net.URL;
-
-import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
-import org.apache.beehive.controls.api.bean.ControlInterface;
-import org.apache.beehive.controls.api.properties.PropertySet;
-import org.w3c.dom.Element;
-
-/**
- * <p>
- * Provides simplified access to web services. A service control provides an interface between an application and a
- * web service, which allows an application to invoke the service's operations. Using a web service control, you
- * can connect to any web service for which a WSDL file is available.
- * </p>
- * <p>
- * Typically, a service control is used by creating the control from a WSDL file.  Then, the target web service's
- * operations are exposed as methods of the control.
- * </p>
- */
-@ControlInterface (defaultBinding = "org.apache.beehive.controls.system.webservice.jaxrpc.ServiceControlImpl")
-public interface ServiceControl {
-
-    /**
-     * Location URL for target service. Multiple URLs may be specified and first URL of the appropriate scheme will be
-     * used.
-     */
-    @PropertySet(
-            prefix = "Location",
-            externalConfig = true,
-            optional = true,
-            hasSetters = false
-    )
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target({ElementType.TYPE, ElementType.FIELD})
-    public @interface Location {
-        String[] urls();
-    }
-
-    /**
-     * OperationName is only used when the target WSDL defines operations with names that are invalid as Java Method
-     * names.
-     */
-    @PropertySet(
-            prefix = "OperationName",
-            externalConfig = false,
-            optional = true,
-            hasSetters = false
-    )
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target({ElementType.METHOD})
-    public @interface OperationName {
-        String value();
-    }
-
-    /**
-     * Path to WSDL - required annotation.
-     */
-    @PropertySet(
-            prefix = "WSDL",
-            externalConfig = false,
-            optional = false,
-            hasSetters = false
-    )
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target({ElementType.TYPE})
-    public @interface WSDL {
-        @AnnotationMemberTypes.FilePath
-        String path();
-        String service() default "";
-    }
-
-    /**
-     * Manual control over URL of the target service.
-     *
-     * @param url The new destination for callbacks.
-     */
-    public void setEndPoint(URL url);
-
-    /**
-     * Gets the URL that the Service control instance will use as the base URL.
-     *
-     * @return The URL that will be used.
-     */
-    public URL getEndPoint();
-
-    /**
-     * Specifies the QName for the port within the WSDL which the Service Control should use.
-     *
-     * @param wsdlPortName The QName of the port to use.
-     */
-    public void setWsdlPort(QName wsdlPortName);
-
-    /**
-     * Returns the QName of the port that will be used by the Service Control to call the webservice.
-     *
-     * @return The QName of the port that will be used.
-     */
-    public QName getWsdlPort();
-
-    /**
-     * Sets the username that will be sent with the next outgoing Service control method invocation. Used if the Service
-     * control uses HTTP basic authentication.
-     *
-     * @param username The username to send for authentication.
-     */
-    public void setUsername(String username);
-
-    /**
-     * Retrieves the username string that was set by the most recent call to setUsername.
-     *
-     * @return The username set by the setUsername method.
-     */
-    public String getUsername();
-
-    /**
-     * Sets the password that will be sent with the next outgoing Service control method invocation. Used if the Service
-     * control uses HTTP basic authentication.
-     *
-     * @param password The password to send for authentication.
-     */
-    public void setPassword(String password);
-
-    /**
-     * Retrieves the password string that was set by the most recent call to the setPassword method.
-     *
-     * @return The password set by the setPassword method.
-     */
-    public String getPassword();
-
-    /**
-     * Retrieves the SOAP headers that were included in the most recent arriving callback from this Service control.
-     *
-     * @return An array of the SOAP input header elements for this control's most recently receive callback.
-     */
-    public Element[] getInputHeaders();
-
-    /**
-     * Sets the SOAP headers that will be included in the next outgoing method invocation message to the Service
-     * control.
-     *
-     * @param headers An array of the new SOAP output header elements.
-     */
-    public void setOutputHeaders(Element[] headers);
-
-    /**
-     * Sets the timeout for the underlying HttpURLConnection (in millisecs, default is 0 which means no timeout,
-     * negative values are converted to 0).
-     */
-    public void setTimeout(int timeout);
-
-    /**
-     * Gets the timeout that has been set by setTimeout() for the underlying HttpURLConnection (returned in millisecs, a
-     * value of 0 means no timeout).
-     */
-    public int getTimeout();
-
-    /**
-     * Clears all parameters that were set by previous calls to the setOutputHeaders, setPassword, or setUsername
-     * methods.
-     */
-    public void reset();
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice;
+
+import javax.xml.namespace.QName;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.net.URL;
+
+import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
+import org.apache.beehive.controls.api.bean.ControlInterface;
+import org.apache.beehive.controls.api.properties.PropertySet;
+import org.w3c.dom.Element;
+
+/**
+ * <p>
+ * Provides simplified access to web services. A service control provides an interface between an application and a
+ * web service, which allows an application to invoke the service's operations. Using a web service control, you
+ * can connect to any web service for which a WSDL file is available.
+ * </p>
+ * <p>
+ * Typically, a service control is used by creating the control from a WSDL file.  Then, the target web service's
+ * operations are exposed as methods of the control.
+ * </p>
+ */
+@ControlInterface (defaultBinding = "org.apache.beehive.controls.system.webservice.jaxrpc.ServiceControlImpl")
+public interface ServiceControl {
+
+    /**
+     * Location URL for target service. Multiple URLs may be specified and first URL of the appropriate scheme will be
+     * used.
+     */
+    @PropertySet(
+            prefix = "Location",
+            externalConfig = true,
+            optional = true,
+            hasSetters = false
+    )
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE, ElementType.FIELD})
+    public @interface Location {
+        String[] urls();
+    }
+
+    /**
+     * OperationName is only used when the target WSDL defines operations with names that are invalid as Java Method
+     * names.
+     */
+    @PropertySet(
+            prefix = "OperationName",
+            externalConfig = false,
+            optional = true,
+            hasSetters = false
+    )
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.METHOD})
+    public @interface OperationName {
+        String value();
+    }
+
+    /**
+     * Path to WSDL - required annotation.
+     */
+    @PropertySet(
+            prefix = "WSDL",
+            externalConfig = false,
+            optional = false,
+            hasSetters = false
+    )
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.TYPE})
+    public @interface WSDL {
+        @AnnotationMemberTypes.FilePath
+        String path();
+        String service() default "";
+    }
+
+    /**
+     * Manual control over URL of the target service.
+     *
+     * @param url The new destination for callbacks.
+     */
+    public void setEndPoint(URL url);
+
+    /**
+     * Gets the URL that the Service control instance will use as the base URL.
+     *
+     * @return The URL that will be used.
+     */
+    public URL getEndPoint();
+
+    /**
+     * Specifies the QName for the port within the WSDL which the Service Control should use.
+     *
+     * @param wsdlPortName The QName of the port to use.
+     */
+    public void setWsdlPort(QName wsdlPortName);
+
+    /**
+     * Returns the QName of the port that will be used by the Service Control to call the webservice.
+     *
+     * @return The QName of the port that will be used.
+     */
+    public QName getWsdlPort();
+
+    /**
+     * Sets the username that will be sent with the next outgoing Service control method invocation. Used if the Service
+     * control uses HTTP basic authentication.
+     *
+     * @param username The username to send for authentication.
+     */
+    public void setUsername(String username);
+
+    /**
+     * Retrieves the username string that was set by the most recent call to setUsername.
+     *
+     * @return The username set by the setUsername method.
+     */
+    public String getUsername();
+
+    /**
+     * Sets the password that will be sent with the next outgoing Service control method invocation. Used if the Service
+     * control uses HTTP basic authentication.
+     *
+     * @param password The password to send for authentication.
+     */
+    public void setPassword(String password);
+
+    /**
+     * Retrieves the password string that was set by the most recent call to the setPassword method.
+     *
+     * @return The password set by the setPassword method.
+     */
+    public String getPassword();
+
+    /**
+     * Retrieves the SOAP headers that were included in the most recent arriving callback from this Service control.
+     *
+     * @return An array of the SOAP input header elements for this control's most recently receive callback.
+     */
+    public Element[] getInputHeaders();
+
+    /**
+     * Sets the SOAP headers that will be included in the next outgoing method invocation message to the Service
+     * control.
+     *
+     * @param headers An array of the new SOAP output header elements.
+     */
+    public void setOutputHeaders(Element[] headers);
+
+    /**
+     * Sets the timeout for the underlying HttpURLConnection (in millisecs, default is 0 which means no timeout,
+     * negative values are converted to 0).
+     */
+    public void setTimeout(int timeout);
+
+    /**
+     * Gets the timeout that has been set by setTimeout() for the underlying HttpURLConnection (returned in millisecs, a
+     * value of 0 means no timeout).
+     */
+    public int getTimeout();
+
+    /**
+     * Clears all parameters that were set by previous calls to the setOutputHeaders, setPassword, or setUsername
+     * methods.
+     */
+    public void reset();
+}

Propchange: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/ServiceControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/generator/ExtensionMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java (original)
+++ incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java Tue Jun 14 14:14:42 2005
@@ -1,185 +1,185 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.controls.system.webservice.jaxrpc;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.Handler;
-import javax.xml.rpc.handler.HandlerInfo;
-import javax.xml.rpc.handler.MessageContext;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Element;
-
-public class HeaderHandler implements Handler {
-
-    static Logger logger = Logger.getLogger(HeaderHandler.class);
-
-    static ThreadLocal localInHeaders = new ThreadLocal();
-
-    static ThreadLocal localOutHeaders = new ThreadLocal();
-
-    /**
-     * Sign outgoing request message.
-     */
-    public boolean handleRequest(MessageContext mc) {
-        System.out.println("In HeaderHandler's handleRequest myOutHeaders: "
-                + localOutHeaders.get());
-
-        try {
-            SOAPMessageContext smc = (SOAPMessageContext) mc;
-            SOAPMessage msg = smc.getMessage();
-            logger.debug("Request message body: "
-                    + msg.getSOAPBody().toString() + "\n header: "
-                    + msg.getSOAPHeader().toString());
-           SOAPPart part = msg.getSOAPPart();
-            SOAPEnvelope envelope = part.getEnvelope();
-            SOAPHeader header = envelope.getHeader();
-
-            /**
-             * Create new header element. We don't specify a role on this header
-             * element, meaning the target role is the "ultimate destination".
-             */
-            Element[] elemsToAdd = (Element[]) localOutHeaders.get();
-
-            if (null == elemsToAdd) {
-                logger.debug("no header to send");
-                return true;
-            }
-            for (Element nxtElement : elemsToAdd) {
-                header
-                        .addChildElement(new org.apache.axis.message.SOAPHeaderElement(
-                                nxtElement)); // NOTE: Axis specific
-            }
-
-        } catch (SOAPException e) {
-            e.printStackTrace();
-            logger.error("Failed to add header.", e);
-        }
-
-        return true;
-    }
-
-    /**
-     * 
-     */
-    static public void reset() {
-        localInHeaders = new ThreadLocal();
-        localOutHeaders = new ThreadLocal();
-
-    }
-
-    /**
-     * Check incoming response message.
-     */
-    public boolean handleResponse(MessageContext mc) {
-        System.out.println("In HeaderHandler's handleResponse");
-
-        try {
-            SOAPMessageContext smc = (SOAPMessageContext) mc;
-            SOAPMessage msg = smc.getMessage();
-            logger.debug("Response message body: "
-                    + msg.getSOAPBody().toString() + "\n header: "
-                    + msg.getSOAPHeader().toString());
-            SOAPPart part = msg.getSOAPPart();
-            SOAPEnvelope envelope = part.getEnvelope();
-            SOAPHeader header = envelope.getHeader();
-            if (header == null)
-                return true;
-
-            Iterator it = header.extractAllHeaderElements();
-            ArrayList<Element> list = new ArrayList<Element>();
-            while (it.hasNext()) {
-                SOAPElement nxtSoapElement = (SOAPElement) it.next();
-                list.add((Element) nxtSoapElement.cloneNode(true));
-            }
-
-            Element[] elems = (Element[]) list
-                    .toArray(new Element[list.size()]); // Use generics
-            localInHeaders.set(elems);
-
-        } catch (SOAPException e) {
-            e.printStackTrace();
-            logger.error("Error extracting the header.", e);
-        }
-
-        logger.debug("myInHeaders: " + localInHeaders.get());
-        return true;
-    }
-
-    /**
-     * Check incoming response message.
-     */
-    public boolean handleFault(MessageContext mc) {
-        System.out.println("In HeaderHandler's handleFault");
-        return true;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see javax.xml.rpc.handler.Handler#init(javax.xml.rpc.handler.HandlerInfo)
-     */
-    public void init(HandlerInfo arg0) {
-        System.out.println("In HeaderHandler's init");
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see javax.xml.rpc.handler.Handler#destroy()
-     */
-    public void destroy() {
-        logger.debug("In HeaderHandler's destroy");
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see javax.xml.rpc.handler.Handler#getHeaders()
-     */
-    public QName[] getHeaders() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /**
-     * @return Returns the inHeaders.
-     */
-    static public Element[] getInHeaders() {
-        return (Element[]) localInHeaders.get();
-    }
-
-    /**
-     * @param outHeaders
-     *            The outHeaders to set.
-     */
-    static public void setOutHeaders(Element[] outHeaders) {
-        localOutHeaders.set(outHeaders);
-    }
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.jaxrpc;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.Handler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+
+public class HeaderHandler implements Handler {
+
+    static Logger logger = Logger.getLogger(HeaderHandler.class);
+
+    static ThreadLocal localInHeaders = new ThreadLocal();
+
+    static ThreadLocal localOutHeaders = new ThreadLocal();
+
+    /**
+     * Sign outgoing request message.
+     */
+    public boolean handleRequest(MessageContext mc) {
+        System.out.println("In HeaderHandler's handleRequest myOutHeaders: "
+                + localOutHeaders.get());
+
+        try {
+            SOAPMessageContext smc = (SOAPMessageContext) mc;
+            SOAPMessage msg = smc.getMessage();
+            logger.debug("Request message body: "
+                    + msg.getSOAPBody().toString() + "\n header: "
+                    + msg.getSOAPHeader().toString());
+           SOAPPart part = msg.getSOAPPart();
+            SOAPEnvelope envelope = part.getEnvelope();
+            SOAPHeader header = envelope.getHeader();
+
+            /**
+             * Create new header element. We don't specify a role on this header
+             * element, meaning the target role is the "ultimate destination".
+             */
+            Element[] elemsToAdd = (Element[]) localOutHeaders.get();
+
+            if (null == elemsToAdd) {
+                logger.debug("no header to send");
+                return true;
+            }
+            for (Element nxtElement : elemsToAdd) {
+                header
+                        .addChildElement(new org.apache.axis.message.SOAPHeaderElement(
+                                nxtElement)); // NOTE: Axis specific
+            }
+
+        } catch (SOAPException e) {
+            e.printStackTrace();
+            logger.error("Failed to add header.", e);
+        }
+
+        return true;
+    }
+
+    /**
+     * 
+     */
+    static public void reset() {
+        localInHeaders = new ThreadLocal();
+        localOutHeaders = new ThreadLocal();
+
+    }
+
+    /**
+     * Check incoming response message.
+     */
+    public boolean handleResponse(MessageContext mc) {
+        System.out.println("In HeaderHandler's handleResponse");
+
+        try {
+            SOAPMessageContext smc = (SOAPMessageContext) mc;
+            SOAPMessage msg = smc.getMessage();
+            logger.debug("Response message body: "
+                    + msg.getSOAPBody().toString() + "\n header: "
+                    + msg.getSOAPHeader().toString());
+            SOAPPart part = msg.getSOAPPart();
+            SOAPEnvelope envelope = part.getEnvelope();
+            SOAPHeader header = envelope.getHeader();
+            if (header == null)
+                return true;
+
+            Iterator it = header.extractAllHeaderElements();
+            ArrayList<Element> list = new ArrayList<Element>();
+            while (it.hasNext()) {
+                SOAPElement nxtSoapElement = (SOAPElement) it.next();
+                list.add((Element) nxtSoapElement.cloneNode(true));
+            }
+
+            Element[] elems = (Element[]) list
+                    .toArray(new Element[list.size()]); // Use generics
+            localInHeaders.set(elems);
+
+        } catch (SOAPException e) {
+            e.printStackTrace();
+            logger.error("Error extracting the header.", e);
+        }
+
+        logger.debug("myInHeaders: " + localInHeaders.get());
+        return true;
+    }
+
+    /**
+     * Check incoming response message.
+     */
+    public boolean handleFault(MessageContext mc) {
+        System.out.println("In HeaderHandler's handleFault");
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.xml.rpc.handler.Handler#init(javax.xml.rpc.handler.HandlerInfo)
+     */
+    public void init(HandlerInfo arg0) {
+        System.out.println("In HeaderHandler's init");
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.xml.rpc.handler.Handler#destroy()
+     */
+    public void destroy() {
+        logger.debug("In HeaderHandler's destroy");
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see javax.xml.rpc.handler.Handler#getHeaders()
+     */
+    public QName[] getHeaders() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * @return Returns the inHeaders.
+     */
+    static public Element[] getInHeaders() {
+        return (Element[]) localInHeaders.get();
+    }
+
+    /**
+     * @param outHeaders
+     *            The outHeaders to set.
+     */
+    static public void setOutHeaders(Element[] outHeaders) {
+        localOutHeaders.set(outHeaders);
+    }
 }

Propchange: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java?rev=190657&r1=190656&r2=190657&view=diff
==============================================================================
--- incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java (original)
+++ incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java Tue Jun 14 14:14:42 2005
@@ -1,74 +1,74 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.controls.system.webservice.utils;
-
-import java.lang.reflect.Field;
-
-import javax.xml.rpc.holders.Holder;
-
-public class HolderUtils {
-
-	public static void stuffHolderValue(Holder holder, Object value)
-			throws NoSuchFieldException, IllegalAccessException {
-        Field valueField = holder.getClass().getField("value");
-		Object curValueInHolder = valueField.get(holder);
-		Class classOfValueFieldInHolder;
-		if (curValueInHolder == null) {
-			classOfValueFieldInHolder = valueField.getType();
-		} else {
-			classOfValueFieldInHolder = curValueInHolder.getClass();
-		}
-
-		if (null == value) {
-			setFieldInObject(valueField, holder, null);
-			return;
-		}
-		if (classOfValueFieldInHolder.isAssignableFrom(value.getClass())) {
-			setFieldInObject(valueField, holder, value);
-
-		} else { // we need to convert the class to the holder type
-
-			try {
-				Object convertedValue = org.apache.axis.utils.JavaUtils
-						.convert(value, classOfValueFieldInHolder);
-				setFieldInObject(valueField, holder, convertedValue);
-			} catch (IllegalArgumentException e) {
-
-				e.printStackTrace();
-			} catch (IllegalAccessException e) {
-
-				e.printStackTrace();
-			}
-		}
-
-	}
-
-	private static void setFieldInObject(Field valueField, Object destObject, Object value)
-        throws IllegalArgumentException,
-			IllegalAccessException {
-		if (valueField.getType().isPrimitive()) {
-			if (value == null)
-				; // Don't need to set anything
-			else
-				valueField.set(destObject, value);
-		} else {
-			valueField.set(destObject, value);
-		}
-	}
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.utils;
+
+import java.lang.reflect.Field;
+
+import javax.xml.rpc.holders.Holder;
+
+public class HolderUtils {
+
+	public static void stuffHolderValue(Holder holder, Object value)
+			throws NoSuchFieldException, IllegalAccessException {
+        Field valueField = holder.getClass().getField("value");
+		Object curValueInHolder = valueField.get(holder);
+		Class classOfValueFieldInHolder;
+		if (curValueInHolder == null) {
+			classOfValueFieldInHolder = valueField.getType();
+		} else {
+			classOfValueFieldInHolder = curValueInHolder.getClass();
+		}
+
+		if (null == value) {
+			setFieldInObject(valueField, holder, null);
+			return;
+		}
+		if (classOfValueFieldInHolder.isAssignableFrom(value.getClass())) {
+			setFieldInObject(valueField, holder, value);
+
+		} else { // we need to convert the class to the holder type
+
+			try {
+				Object convertedValue = org.apache.axis.utils.JavaUtils
+						.convert(value, classOfValueFieldInHolder);
+				setFieldInObject(valueField, holder, convertedValue);
+			} catch (IllegalArgumentException e) {
+
+				e.printStackTrace();
+			} catch (IllegalAccessException e) {
+
+				e.printStackTrace();
+			}
+		}
+
+	}
+
+	private static void setFieldInObject(Field valueField, Object destObject, Object value)
+        throws IllegalArgumentException,
+			IllegalAccessException {
+		if (valueField.getType().isPrimitive()) {
+			if (value == null)
+				; // Don't need to set anything
+			else
+				valueField.set(destObject, value);
+		} else {
+			valueField.set(destObject, value);
+		}
+	}
+
+}

Propchange: incubator/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/utils/HolderUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native