001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019:
020: package org.apache.synapse;
021:
022: import org.apache.axiom.om.OMAbstractFactory;
023: import org.apache.axiom.om.OMNamespace;
024:
025: import javax.xml.namespace.QName;
026:
027: /**
028: * Global constants for the Apache Synapse project
029: */
030: public final class SynapseConstants {
031:
032: /** The Synapse namespace */
033: public static final String SYNAPSE_NAMESPACE = "http://ws.apache.org/ns/synapse";
034: /** An OMNamespace object for the Synapse NS */
035: public static final OMNamespace SYNAPSE_OMNAMESPACE = OMAbstractFactory
036: .getOMFactory().createOMNamespace(SYNAPSE_NAMESPACE, "syn");
037:
038: /** The name of the main sequence for message mediation */
039: public static final String MAIN_SEQUENCE_KEY = "main";
040: /** The name of the fault sequence to execute on failures during mediation */
041: public static final String FAULT_SEQUENCE_KEY = "fault";
042:
043: /** The name of the Synapse service (used for message mediation) */
044: public static final String SYNAPSE_SERVICE_NAME = "__SynapseService";
045: /** The operation name used by the Synapse service (for message mediation) */
046: public static final QName SYNAPSE_OPERATION_NAME = new QName(
047: "mediate");
048:
049: //- names of modules to be engaged at runtime -
050: /** The Name of the WS-RM Sandesha module */
051: public static final String SANDESHA2_MODULE_NAME = "sandesha2";
052: /** The Name of the WS-A Addressing module */
053: public static final String ADDRESSING_MODULE_NAME = "addressing";
054: /** The Name of the WS-Security Rampart module */
055: public static final String RAMPART_MODULE_NAME = "rampart";
056:
057: //- Standard headers that can be read as get-property('header')-
058: /** Refers to the To header */
059: public static final String HEADER_TO = "To";
060: /** Refers to the From header */
061: public static final String HEADER_FROM = "From";
062: /** Refers to the FaultTo header */
063: public static final String HEADER_FAULT = "FaultTo";
064: /** Refers to the Action header */
065: public static final String HEADER_ACTION = "Action";
066: /** Refers to the ReplyTo header */
067: public static final String HEADER_REPLY_TO = "ReplyTo";
068: /** Refers to the RelatesTo header */
069: public static final String HEADER_RELATES_TO = "RelatesTo";
070: /** Refers to the MessageID header */
071: public static final String HEADER_MESSAGE_ID = "MessageID";
072: /** Message format: pox, soap11, soap12 */
073: public static final String PROPERTY_MESSAGE_FORMAT = "MESSAGE_FORMAT";
074: /** WSDL operation name **/
075: public static final String PROPERTY_OPERATION_NAME = "OperationName";
076: /** WSDL operation namespace **/
077: public static final String PROPERTY_OPERATION_NAMESPACE = "OperationNamespace";
078: /** System time in milliseconds - the offset from epoch (i.e. System.currentTimeMillis) */
079: public static final String SYSTEM_TIME = "SYSTEM_TIME";
080: /** System date */
081: public static final String SYSTEM_DATE = "SYSTEM_DATE";
082:
083: /** The Axis2 client options property name for the Rampart policy */
084: public static final String RAMPART_POLICY = "rampartPolicy";
085: /** The Axis2 client options property name for the Sandesha policy */
086: public static final String SANDESHA_POLICY = "sandeshaPolicy";
087:
088: /** The name of the Parameter set on the Axis2Configuration to hold the Synapse Configuration */
089: public static final String SYNAPSE_CONFIG = "synapse.config";
090: /** The name of the Parameter set on the Axis2Configuration to hold the Synapse Environment */
091: public static final String SYNAPSE_ENV = "synapse.env";
092:
093: /** The name of the system property that will hold the Synapse home directory */
094: public static final String SYNAPSE_HOME = "synapse.home";
095: /** The default synapse.properties file path */
096: public static final String DEFAULT_PROP_PATH = "synapse.properties";
097: /** The name of the system property used to specify/override the Synapse config XML location */
098: public static final String SYNAPSE_XML = "synapse.xml";
099: /** The name of the system property used to specify/override the Synapse properties location */
100: public static final String SYNAPSE_PROPERTIES = "synapse.properties";
101:
102: //- Synapse Message Context Properties -
103: /** The Synapse MC property name that holds the name of the Proxy service thats handling it */
104: public static final String PROXY_SERVICE = "proxy.name";
105: /** The Synapse MC property that marks it as a RESPONSE */
106: public static final String RESPONSE = "RESPONSE";
107: /** The Synapse MC property that marks the message as a OUT_ONLY message */
108: public static final String OUT_ONLY = "OUT_ONLY";
109:
110: //-- error handling --
111: /** The message context property name which holds the error code for the last encountered exception */
112: public static final String ERROR_CODE = "ERROR_CODE";
113: /** The MC property name which holds the error message for the last encountered exception */
114: public static final String ERROR_MESSAGE = "ERROR_MESSAGE";
115: /** The message context property name which holds the error detail (stack trace) for the last encountered exception */
116: public static final String ERROR_DETAIL = "ERROR_DETAIL";
117: /** The message context property name which holds the exception (if any) for the last encountered exception */
118: public static final String ERROR_EXCEPTION = "ERROR_EXCEPTION";
119:
120: /** Sandesha last message property name */
121: public static final String SANDESHA_LAST_MESSAGE = "Sandesha2LastMessage";
122: /** Sandesha last sequence key property name */
123: public static final String SANDESHA_SEQUENCE_KEY = "Sandesha2SequenceKey";
124: /** Sandesha WS-RM specification version property name */
125: public static final String SANDESHA_SPEC_VERSION = "Sandesha2RMSpecVersion";
126:
127: //- Axis2 Message Context Properties used by Synapse -
128: /** an axis2 message context property set to hold the relates to for POX responses */
129: public static final String RELATES_TO_FOR_POX = "synapse.RelatesToForPox";
130:
131: /** an axis2 message context property set to indicate this is a response message for Synapse */
132: public static final String ISRESPONSE_PROPERTY = "synapse.isresponse";
133:
134: //- tracing and statistics constants -
135: /** Tracing logger name */
136: public static final String TRACE_LOGGER = "TRACE_LOGGER";
137: public static final String SERVICE_LOGGER_PREFIX = "SERVICE_LOGGER.";
138:
139: /** The tracing state -off */
140: public static final int TRACING_OFF = 0;
141: /** The tracing state-on */
142: public static final int TRACING_ON = 1;
143: /** The tracing state-unset */
144: public static final int TRACING_UNSET = 2;
145:
146: /** The statistics state -off */
147: public static final int STATISTICS_OFF = 0;
148: /** The statistics state-on */
149: public static final int STATISTICS_ON = 1;
150: /** The statistics state-unset */
151: public static final int STATISTICS_UNSET = 2;
152:
153: /** key for lookup sequence statistics stack */
154: public static final String SEQUENCE_STATS = "synapse.sequence.stats";
155:
156: /** key for lookup Proxy Service statistics stack */
157: public static final String PROXY_STATS = "synapse.proxy.stats";
158:
159: /** key for lookup Proxy Service statistics stack */
160: public static final String SERVICE_STATS = "synapse.service.stats";
161:
162: /** key for lookup Endpoint statistics stack */
163: public static final String ENDPOINT_STATS = "synapse.endpoint.stats";
164:
165: /** Sequence statistics category*/
166: public static final int SEQUENCE_STATISTICS = 0;
167:
168: /** Proxy Service statistics category */
169: public static final int PROXYSERVICE_STATISTICS = 1;
170:
171: /** Endpoint statistics category*/
172: public static final int ENDPOINT_STATISTICS = 2;
173:
174: //- handling of timed out events from the callbacks -
175: /** The System property that states the duration at which the timeout handler runs */
176: public static final String TIMEOUT_HANDLER_INTERVAL = "synapse.timeout_handler_interval";
177:
178: /**
179: * Interval for activating the timeout handler for cleaning up expired requests. Note that
180: * there can be an error as large as the value of the interval. But for smaller intervals
181: * and larger timeouts this error is negligilble.
182: */
183: public static final long DEFAULT_TIMEOUT_HANDLER_INTERVAL = 15000;
184:
185: /**
186: * This is a system wide interval for handling otherwise non-expiring callbacks to
187: * ensure system stability over a period of time
188: */
189: public static final String GLOBAL_TIMEOUT_INTERVAL = "synapse.global_timeout_interval";
190:
191: /**
192: * this is the timeout for otherwise non-expiring callbacks
193: * to ensure system stability over time
194: */
195: public static final long DEFAULT_GLOBAL_TIMEOUT = 24 * 60 * 60 * 1000;
196:
197: /**
198: * don't do anything for response timeouts. this means infinite timeout. this is the default
199: * action, if the timeout configuration is not explicitly set.
200: */
201: public static final int NONE = 100;
202:
203: /** Discard the callback if the timeout for the response is expired */
204: public static final int DISCARD = 101;
205:
206: /**
207: * Discard the callback and activate specified fault sequence if the timeout for the response
208: * is expired
209: */
210: public static final int DISCARD_AND_FAULT = 102;
211:
212: /**
213: * Error codes for message sending. We go with closest HTTP fault codes.
214: */
215: public static final String TIME_OUT = "504";
216: public static final String SENDING_FAULT = "503";
217:
218: //- Endpoints processing constants -
219: /** Property name to store the last endpoint through which the message has flowed */
220: public static final String PROCESSED_ENDPOINT = "processed_endpoint";
221:
222: /** A name to use for anonymous endpoints */
223: public static final String ANONYMOUS_ENDPOINT = "AnonymousEndpoint";
224:
225: /** A name to use for anonymous sequences in the sequence stack */
226: public static final String ANONYMOUS_SEQUENCE = "AnonymousSequence";
227:
228: /** Message format values in EndpointDefinition. Used by address, wsdl endpoints */
229: public static final String FORMAT_POX = "pox";
230: public static final String FORMAT_GET = "get";
231: public static final String FORMAT_SOAP11 = "soap11";
232: public static final String FORMAT_SOAP12 = "soap12";
233:
234: /** Synapse server instance name */
235: public static final String SYNAPSE_SERVER_NAME = "SynapseServerName";
236:
237: public static final String SYNAPSE_DATASOURCES = "synapse.datasources";
238:
239: /** Root for relative path */
240: public static final String RESOLVE_ROOT = "resolve.root";
241:
242: /* URL connection read timeout and connection timeout */
243:
244: public static final int DEFAULT_READTIMEOUT = 100000;
245:
246: public static final int DEFAULT_CONNECTTIMEOUT = 20000;
247:
248: public static final String READTIMEOUT = "Connection.ReadTimeout";
249:
250: public static final String CONNECTTIMEOUT = "Connection.ConnectTimeout";
251:
252: }
|