1 /* 2 * Copyright [2006] [University Corporation for Advanced Internet Development, Inc.] 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 package org.opensaml.ws.message.encoder; 18 19 import org.opensaml.ws.message.MessageContext; 20 21 /** 22 * Encodes a message onto the outbound transport. 23 * 24 * Message encoders <strong>MUST</strong> must be thread safe and stateless. 25 */ 26 public interface MessageEncoder { 27 28 /** 29 * Encodes the message in the binding specific manner. 30 * 31 * @param messageContext current message context 32 * 33 * @throws MessageEncodingException thrown if the problem can not be encoded 34 */ 35 public void encode(MessageContext messageContext) throws MessageEncodingException; 36 37 /** 38 * Indicates whether this encoder, given the current message context, provides end-to-end message confidentiality. 39 * 40 * @param messageContext the current message context 41 * 42 * @return true if the encoder provides end-to-end message confidentiality, false if not 43 * 44 * @throws MessageEncodingException thrown if the encoder encounter an error while attempt to evaluate its ability 45 * to provide message confidentiality. 46 */ 47 public boolean providesMessageConfidentiality(MessageContext messageContext) throws MessageEncodingException; 48 49 /** 50 * Indicates whether this encoder, given the current message context, provides end-to-end message integrity. 51 * 52 * @param messageContext the current message context 53 * 54 * @return true if the encoder provides end-to-end message integrity, false if not 55 * 56 * @throws MessageEncodingException thrown if the encoder encounter an error while attempt to evaluate its ability 57 * to provide message integrity. 58 */ 59 public boolean providesMessageIntegrity(MessageContext messageContext) throws MessageEncodingException; 60 }