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.endpoints.utils;
021:
022: import org.apache.synapse.SynapseConstants;
023:
024: /**
025: * Endpoint definition contains the information about an web services endpoint. It is used by leaf
026: * level endpoints to keep these information (e.g. AddressEndpoint and WSDLEndpoint). An EndpointDefinition
027: * object is used by only one endpoint and they cannot be looked up in the registry.
028: */
029: public class EndpointDefinition {
030:
031: /**
032: * The simple address this endpoint resolves to - if explicitly specified
033: */
034: private String address = null;
035: /**
036: * Should messages be sent in an WS-RM Sequence ?
037: */
038: private boolean reliableMessagingOn = false;
039: /**
040: * Should messages be sent using WS-A?
041: */
042: private boolean addressingOn = false;
043: /**
044: * Should messages be sent using WS-Security?
045: */
046: private boolean securityOn = false;
047: /**
048: * The "key" for any WS-RM Policy overrides to be used
049: */
050: private String wsRMPolicyKey = null;
051: /**
052: * The "key" for any Rampart Security Policy to be used
053: */
054: private String wsSecPolicyKey = null;
055: /**
056: * use a separate listener - implies addressing is on *
057: */
058: private boolean useSeparateListener = false;
059: /**
060: * force REST (POST) on *
061: */
062: private boolean forcePOX = false;
063: /**
064: * force REST (GET) on *
065: */
066: private boolean forceGET = false;
067: /**
068: * force SOAP11 on *
069: */
070: private boolean forceSOAP11 = false;
071: /**
072: * force SOAP11 on *
073: */
074: private boolean forceSOAP12 = false;
075: /**
076: * use MTOM *
077: */
078: private boolean useMTOM = false;
079: /**
080: * use SWA *
081: */
082: private boolean useSwa = false;
083: /**
084: * Endpoint message format. pox/soap11/soap12
085: */
086: private String format = null;
087:
088: /**
089: * timeout duration for waiting for a response. if the user has set some timeout action and
090: * the timeout duration is not set, default is set to 0 seconds. note that if the user has
091: * not set any timeout configuration, default timeout action is set to NONE, which won't do
092: * anything for timeouts.
093: */
094: private long timeoutDuration = 0;
095:
096: /**
097: * action to perform when a timeout occurs (NONE | DISCARD | DISCARD_AND_FAULT) *
098: */
099: private int timeoutAction = SynapseConstants.NONE;
100:
101: /**
102: * To decide to whether statistics should have collected or not
103: */
104: private int statisticsState = SynapseConstants.STATISTICS_UNSET;
105:
106: /**
107: * The variable that indicate tracing on or off for the current mediator
108: */
109: private int traceState = SynapseConstants.TRACING_UNSET;
110:
111: /**
112: * This should return the absolute EPR address referenced by the named endpoint. This may be possibly computed.
113: *
114: * @return an absolute address to be used to reference the named endpoint
115: */
116: public String getAddress() {
117: return address;
118: }
119:
120: /**
121: * Set an absolute URL as the address for this named endpoint
122: *
123: * @param address the absolute address to be used
124: */
125: public void setAddress(String address) {
126: this .address = address;
127: }
128:
129: /**
130: * Is RM turned on on this endpoint?
131: *
132: * @return true if on
133: */
134: public boolean isReliableMessagingOn() {
135: return reliableMessagingOn;
136: }
137:
138: /**
139: * Request that RM be turned on/off on this endpoint
140: *
141: * @param reliableMessagingOn
142: */
143: public void setReliableMessagingOn(boolean reliableMessagingOn) {
144: this .reliableMessagingOn = reliableMessagingOn;
145: }
146:
147: /**
148: * Is WS-A turned on on this endpoint?
149: *
150: * @return true if on
151: */
152: public boolean isAddressingOn() {
153: return addressingOn;
154: }
155:
156: /**
157: * Request that WS-A be turned on/off on this endpoint
158: *
159: * @param addressingOn
160: */
161: public void setAddressingOn(boolean addressingOn) {
162: this .addressingOn = addressingOn;
163: }
164:
165: /**
166: * Is WS-Security turned on on this endpoint?
167: *
168: * @return true if on
169: */
170: public boolean isSecurityOn() {
171: return securityOn;
172: }
173:
174: /**
175: * Request that WS-Sec be turned on/off on this endpoint
176: *
177: * @param securityOn
178: */
179: public void setSecurityOn(boolean securityOn) {
180: this .securityOn = securityOn;
181: }
182:
183: /**
184: * Return the Rampart Security configuration policys' 'key' to be used (See Rampart)
185: *
186: * @return the ORampart Security configuration policys' 'key' to be used (See Rampart)
187: */
188: public String getWsSecPolicyKey() {
189: return wsSecPolicyKey;
190: }
191:
192: /**
193: * Set the Rampart Security configuration policys' 'key' to be used (See Rampart)
194: *
195: * @param wsSecPolicyKey the Rampart Security configuration policys' 'key' to be used (See Rampart)
196: */
197: public void setWsSecPolicyKey(String wsSecPolicyKey) {
198: this .wsSecPolicyKey = wsSecPolicyKey;
199: }
200:
201: /**
202: * Get the WS-RM configuration policys' 'key' to be used (See Sandesha2)
203: *
204: * @return the WS-RM configuration policys' 'key' to be used (See Sandesha2)
205: */
206: public String getWsRMPolicyKey() {
207: return wsRMPolicyKey;
208: }
209:
210: /**
211: * Set the WS-RM configuration policys' 'key' to be used (See Sandesha2)
212: *
213: * @param wsRMPolicyKey the WS-RM configuration policys' 'key' to be used (See Sandesha2)
214: */
215: public void setWsRMPolicyKey(String wsRMPolicyKey) {
216: this .wsRMPolicyKey = wsRMPolicyKey;
217: }
218:
219: public void setUseSeparateListener(boolean b) {
220: this .useSeparateListener = b;
221: }
222:
223: public boolean isUseSeparateListener() {
224: return useSeparateListener;
225: }
226:
227: public void setForcePOX(boolean forcePOX) {
228: this .forcePOX = forcePOX;
229: }
230:
231: public boolean isForcePOX() {
232: return forcePOX;
233: }
234:
235: public boolean isForceGET() {
236: return forceGET;
237: }
238:
239: public void setForceGET(boolean forceGET) {
240: this .forceGET = forceGET;
241: }
242:
243: public void setForceSOAP11(boolean forceSOAP11) {
244: this .forceSOAP11 = forceSOAP11;
245: }
246:
247: public boolean isForceSOAP11() {
248: return forceSOAP11;
249: }
250:
251: public void setForceSOAP12(boolean forceSOAP12) {
252: this .forceSOAP12 = forceSOAP12;
253: }
254:
255: public boolean isForceSOAP12() {
256: return forceSOAP12;
257: }
258:
259: public boolean isUseMTOM() {
260: return useMTOM;
261: }
262:
263: public void setUseMTOM(boolean useMTOM) {
264: this .useMTOM = useMTOM;
265: }
266:
267: public boolean isUseSwa() {
268: return useSwa;
269: }
270:
271: public void setUseSwa(boolean useSwa) {
272: this .useSwa = useSwa;
273: }
274:
275: public long getTimeoutDuration() {
276: return timeoutDuration;
277: }
278:
279: public void setTimeoutDuration(long timeoutDuration) {
280: this .timeoutDuration = timeoutDuration;
281: }
282:
283: public int getTimeoutAction() {
284: return timeoutAction;
285: }
286:
287: public void setTimeoutAction(int timeoutAction) {
288: this .timeoutAction = timeoutAction;
289: }
290:
291: public String getFormat() {
292: return format;
293: }
294:
295: public void setFormat(String format) {
296: this .format = format;
297: }
298:
299: /**
300: * To check whether statistics should have collected or not
301: *
302: * @return Returns the int value that indicate statistics is enabled or not.
303: */
304: public int getStatisticsState() {
305: return statisticsState;
306: }
307:
308: /**
309: * To set the statistics enable variable value
310: *
311: * @param statisticsState Indicates whether statictics is enable or not
312: */
313: public void setStatisticsState(int statisticsState) {
314: this .statisticsState = statisticsState;
315: }
316:
317: public int getTraceState() {
318: return traceState;
319: }
320:
321: public void setTraceState(int traceState) {
322: this.traceState = traceState;
323: }
324: }
|