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: */package org.apache.cxf.ws.rm;
019:
020: import java.util.ResourceBundle;
021:
022: import org.apache.cxf.common.i18n.BundleUtils;
023: import org.apache.cxf.common.i18n.Message;
024:
025: /**
026: * Utility class to construct SequenceFaults.
027: */
028:
029: class SequenceFaultFactory {
030:
031: private static final ResourceBundle BUNDLE = BundleUtils
032: .getBundle(SequenceFaultFactory.class);
033:
034: SequenceFault createUnknownSequenceFault(Identifier sid) {
035: SequenceFaultType sf = RMUtils.getWSRMFactory()
036: .createSequenceFaultType();
037: sf.setFaultCode(RMConstants.getUnknownSequenceFaultCode());
038: Message msg = new Message("UNKNOWN_SEQ_EXC", BUNDLE);
039: SequenceFault fault = new SequenceFault(msg.toString());
040: fault.setSequenceFault(sf);
041: fault.setDetail(sid);
042: fault.setSender(true);
043: return fault;
044: }
045:
046: SequenceFault createSequenceTerminatedFault(Identifier sid,
047: boolean sender) {
048: SequenceFaultType sf = RMUtils.getWSRMFactory()
049: .createSequenceFaultType();
050: sf.setFaultCode(RMConstants.getSequenceTerminatedFaultCode());
051: Message msg = new Message("SEQ_TERMINATED_EXC", BUNDLE);
052: SequenceFault fault = new SequenceFault(msg.toString());
053: fault.setSequenceFault(sf);
054: fault.setDetail(sid);
055: fault.setSender(sender);
056: return fault;
057: }
058:
059: SequenceFault createInvalidAcknowledgementFault(
060: SequenceAcknowledgement ack) {
061: SequenceFaultType sf = RMUtils.getWSRMFactory()
062: .createSequenceFaultType();
063: sf
064: .setFaultCode(RMConstants
065: .getInvalidAcknowledgmentFaultCode());
066: Message msg = new Message("INVALID_ACK_EXC", BUNDLE);
067: SequenceFault fault = new SequenceFault(msg.toString());
068: fault.setSequenceFault(sf);
069: fault.setDetail(ack);
070: fault.setSender(true);
071: return fault;
072: }
073:
074: SequenceFault createMessageNumberRolloverFault(Identifier sid) {
075: SequenceFaultType sf = RMUtils.getWSRMFactory()
076: .createSequenceFaultType();
077: sf
078: .setFaultCode(RMConstants
079: .getMessageNumberRolloverFaultCode());
080: Message msg = new Message("MESSAGE_NR_ROLLOVER_EXC", BUNDLE);
081: SequenceFault fault = new SequenceFault(msg.toString());
082: fault.setSequenceFault(sf);
083: fault.setDetail(sid);
084: fault.setSender(true);
085: return fault;
086: }
087:
088: SequenceFault createLastMessageNumberExceededFault(Identifier sid) {
089: SequenceFaultType sf = RMUtils.getWSRMFactory()
090: .createSequenceFaultType();
091: sf.setFaultCode(RMConstants
092: .getLastMessageNumberExceededFaultCode());
093: Message msg = new Message("LAST_MESSAGE_NUMBER_EXCEEDED_EXC",
094: BUNDLE);
095: SequenceFault fault = new SequenceFault(msg.toString());
096: fault.setSequenceFault(sf);
097: fault.setDetail(sid);
098: fault.setSender(true);
099: return fault;
100: }
101:
102: SequenceFault createCreateSequenceRefusedFault() {
103: SequenceFaultType sf = RMUtils.getWSRMFactory()
104: .createSequenceFaultType();
105: sf
106: .setFaultCode(RMConstants
107: .getCreateSequenceRefusedFaultCode());
108: Message msg = new Message("CREATE_SEQ_REFUSED", BUNDLE);
109: SequenceFault fault = new SequenceFault(msg.toString());
110: fault.setSequenceFault(sf);
111: fault.setSender(true);
112: return fault;
113: }
114:
115: }
|