View Javadoc

1   /*
2    * Copyright  1999-2004 The Apache Software Foundation.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  
18  package org.apache.sandesha;
19  
20  import org.apache.axis.message.addressing.util.AddressingUtils;
21  
22  /***
23   * class Constants
24   *
25   * @author Amila Navarathna
26   * @author Jaliya Ekanayaka
27   * @author Sudar Nimalan
28   * @author Chamikara Jayalath
29   */
30  public interface Constants {
31  
32      int INVOKER_THREADS = 10;
33      int SENDER_THREADS = 2;
34  
35      int DEFAULR_CLIENT_SIDE_LISTENER_PORT = 9090;
36      int DEFAULT_SIMPLE_AXIS_SERVER_PORT = 8080;
37  
38      String HTTP = "http";
39      String COLON = ":";
40      String SLASH = "/";
41      String UUID = "uuid:";
42      String ASTERISK = "*";
43  
44      String URL_RM_SERVICE = "/axis/services/RMService";
45      String IGNORE_ACTION = "ignoreAction";
46      String RESPONSE = "Response";
47      String CONTEXT = "context";
48      String INVOKER = "invoker";
49      String THREAD_POOL_SIZE = "threadPoolSize";
50  
51      long RETRANSMISSION_INTERVAL = 4000L;
52      long ACKNOWLEDGEMENT_INTERVAL = 200L;
53      long INACTIVITY_TIMEOUT = 600000L;
54      long RMINVOKER_SLEEP_TIME = 2000L;
55      long SENDER_SLEEP_TIME = 2000L;
56      long CLIENT_RESPONSE_CHECKING_INTERVAL = 500L;
57      long CLIENT_WAIT_PERIOD_FOR_COMPLETE = 1000L;
58  
59      int SERVER_QUEUE_ACCESSOR = 1;
60      int SERVER_DATABASE_ACCESSOR = 2;
61  
62      int MSG_TYPE_CREATE_SEQUENCE_REQUEST = 1;
63      int MSG_TYPE_CREATE_SEQUENCE_RESPONSE = 2;
64      int MSG_TYPE_SERVICE_REQUEST = 3;
65      int MSG_TYPE_SERVICE_RESPONSE = 4;
66      int MSG_TYPE_ACKNOWLEDGEMENT = 5;
67      int MSG_TYPE_TERMINATE_SEQUENCE = 6;
68  
69      //To identify the end point
70      byte SERVER = (byte) 1;
71      byte CLIENT = (byte) 0;
72  
73      int SYNCHRONOUS = 0;
74  
75      public interface WSA {
76          String NS_ADDRESSING_ANONYMOUS = AddressingUtils.getAnonymousRoleURI();
77      }
78  
79      public interface WSRM {
80          String NS_PREFIX_RM = "wsrm";
81          String NS_URI_RM = "http://schemas.xmlsoap.org/ws/2005/02/rm";
82          String ACTION_CREATE_SEQUENCE = WSRM.NS_URI_RM + "/CreateSequence";
83          String ACTION_CREATE_SEQUENCE_RESPONSE = WSRM.NS_URI_RM + "/CreateSequenceResponse";
84          String ACTION_TERMINATE_SEQUENCE = WSRM.NS_URI_RM + "/TerminateSequence";
85          String SEQUENCE_ACKNOWLEDGEMENT_ACTION = WSRM.NS_URI_RM + "/SequenceAcknowledgement";
86  
87          String ACK_RANGE = "AcknowledgementRange";
88          String UPPER = "Upper";
89          String LOWER = "Lower";
90          String ACK_REQUESTED = "AckRequested";
91          String MSG_NUMBER = "MessageNumber";
92          String CREATE_SEQUENCE = "CreateSequence";
93          String CREATE_SEQUENCE_RESPONSE = "CreateSequenceResponse";
94          String FAULT_CODE = "FaultCode";
95          String LAST_MSG = "LastMessage";
96          String NACK = "Nack";
97          String SEQUENCE = "Sequence";
98          String SEQUENCE_ACK = "SequenceAcknowledgement";
99          String TERMINATE_DEQUENCE = "TerminateSequence";
100         String SEQUENCE_FAULT = "SequenceFault";
101         String ACKS_TO = "AcksTo";
102         String SEQUENCE_OFFER = "Offer";
103         String ACCEPT = "Accept";
104         String IDENTIFIER = "Identifier";
105 
106         double MAX_MSG_NO = 18446744073709551615.0d;
107     }
108 
109     public interface FaultMessages {
110         String SERVER_INTERNAL_ERROR = "Server Interanal Error";
111 
112         String NO_ADDRESSING_HEADERS = "No Addressing Headers Available in this Message";
113         String NO_TO = "Required header <wsa:To> NOT found.";
114 
115         String NO_RM_HEADES = "No RM Headers Available in this Message";
116 
117         String INVALID_ACKNOWLEDGEMENT = "The SequenceAcknowledgement violates the cumulative " +
118                 "cknowledgement invariant.";
119         String UNKNOWN_SEQUENCE = "The value of wsrm:Identifier is not a known Sequence " +
120                 "identifier.";
121         String MSG_NO_ROLLOVER = "The maximum value for wsrm:MessageNumber has been exceeded.";
122         String LAST_MSG_NO_EXCEEDED = "The value for wsrm:MessageNumber exceeds the value of the" +
123                 " MessageNumber accompanying a LastMessage element in this Sequence.";
124         String INVALID_MESSAGE = "Invalid Message";
125     }
126 
127     public interface FaultCodes {
128         String WSRM_SERVER_INTERNAL_ERROR = "ServerInternalError";
129         String IN_CORRECT_MESSAGE = "Incorrect Message";
130         String WSRM_FAULT_INVALID_ACKNOWLEDGEMENT = "wsrm:InvalidAcknowledgement";
131         String WSRM_FAULT_UNKNOWN_SEQUENCE = "wsrm:UnknownSequence";
132         String WSRM_FAULT_MSG_NO_ROLLOVER = "wsrm:MessageNumberRollover";
133         String WSRM_FAULR_LAST_MSG_NO_EXCEEDED = "wsrm:LastMessageNumberExceeded";
134     }
135 
136     public interface ErrorMessages {
137         String CLIENT_PROPERTY_VALIDATION_ERROR = "ERROR: To perform the operation, " +
138                 "ReplyTo address must be specified. This EPR will not be the Sandesha end point. " +
139                 "If it should be Sandesha end point, please set the propety 'sync' " +
140                 "to false in call.";
141         String MESSAGE_NUMBER_NOT_SPECIFIED = "ERROR: Message Number Not Specified or Action " +
142                 "is null";
143 
144         String SET_APPROVED_OUT_SEQ = "ERROR: setApprovedOutSequence()";
145 
146         String CANNOT_SEND_THE_TERMINATE_SEQ = "SERVER ERROR: Cannot send the TerminateSequence " +
147                 "from Server";
148 
149         String NULL_REQUEST_MSG = "ERROR : NULL REQUEST MESSAGE";
150 
151         String SEQ_IS_NOT_CREATED = "ERROR: Sequence was not created correcly in the in queue";
152 
153     }
154 
155     public interface InfomationMessage {
156         String SENDING_CREATE_SEQ = "INFO: SENDING CREATE SEQUENCE REQUEST ....\n";
157         String SENDING_CREATE_SEQ_RES = "INFO: SENDING CREATE SEQUENCE RESPONSE ....\n";
158         String SENDING_TERMINATE_SEQ = "INFO: SENDING TERMINATE SEQUENCE REQUEST ....\n";
159         String SENDING_ACK = "INFO: SENDING ACKNOWLEDGEMENT ....\n";
160         String SENDING_REQ = "INFO: SENDING REQUEST MESSAGE ....\n";
161         String SENDING_RES = "INFO: SENDING RESPONSE MESSAGE ....\n";
162         String PROVIDER_RECEIVED_MSG = "INFO: RMPROVIDER RECEIVED A SOAP REQUEST....\n";
163         String SENDER_STARTED = "INFO: SENDER STARTED ....\n";
164         String WAITING_TO_STOP_CLIENT = "INFO: WATING TO STOP CLIENT ....\n";
165 
166     }
167 
168     //Constants related to the queue.
169     public interface Queue {
170         String ADD_ERROR = "Error in adding message";
171         String QUEUE_INCONSIS = "Inconsistent queue";
172         String MESSAGE_EXISTS = "Message already exists";
173         String SEQUENCE_ABSENT = "Sequence id does not exist............";
174         String RESPONSE_SEQ_NULL = "ERROR: RESPONSE SEQ IS NULL";
175         String SEQUENCE_ID_NULL = "Sequence Id is null";
176         String MESSAGE_ID_NULL = "Message is null";
177     }
178 
179 
180     public interface ClientProperties {
181 
182         short IN_OUT = (short) 1;
183         short IN_ONLY = (short) 2;
184 
185         String PROPERTY_FILE = "sandesha.properties";
186         String WSRM_POLICY_FILE = "WSRMPolicy.xml";
187 
188         String CLIENT_LISTENER_PORT = "CLIENT_LISTENER_PORT";
189         String SIMPLE_AXIS_SERVER_PORT_POPERTY = "SIMPLE_AXIS_SERVER_PORT";
190 
191         String FROM = "from";
192         String REPLY_TO = "replyTo";
193         String MSG_NUMBER = "msgNumber";
194         String LAST_MESSAGE = "lastMessage";
195         String SYNC = "sync";
196         String ACTION = "action";
197         String ACKS_TO = "acksTo";
198         String TO = "to";
199         String FAULT_TO = "faultTo";
200         String SEND_OFFER = "offer";
201         String SOURCE_URL = "sourceURL";
202         String MEP = "mep";
203         String CALL_KEY = "callKey";
204         String REPORT = "report";
205 
206         String REQUEST_HANDLER = "requestHandler";
207         String RESPONSE_HANDLER = "responseHandler";
208         String LISTENER_REQUEST_HANDLER = "listenerRequestHandler";
209         String LISTENER_RESPONSE_HANDLER = "listenerResponseHandler";
210 
211         String PROVIDER_CLASS = "providerClass";
212         String DEFAULT_PROVIDER_CLASS = "org.apache.axis.providers.java.RPCProvider";
213 
214         String CLASS_NAME = "className";
215         String RMSERVICE = "RMService";
216         String RMSERVICE_CLASS = "org.apache.sandesha.client.RMService";
217         String ALLOWED_METHODS = "allowedMethods";
218     }
219 
220     public interface WSRMPolicy {
221         String INA_TIMEOUT = "InactivityTimeout";
222         String BASE_TX_INTERVAL = "BaseRetransmissionInterval";
223         String ACK_INTERVAL = "AcknowledgementInterval";
224         String EXP_BACKOFF = "ExponentialBackoff";
225 
226         String WSRM = "http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
227         String BIN_BACKOFF = "BinaryBackoff";
228     }
229 
230     String INVOKE_STRATEGY = "invokeStrategy";
231     String DEFAULT_STRATEGY = "org.apache.sandesha.server.ThreadPoolInvokeStrategy:threadPoolSize=10";
232     String INVOKE_HANDLER = "invokeHandler";
233     String DEFAULT_HANDLER = "org.apache.sandesha.server.InvokeHandlerImpl:invoker=org.apache.axis.providers.java." +
234             "RPCProvider";
235 
236 }
237