Coverage Report - javax.security.auth.message.MessagePolicy
 
Classes in this File Line Coverage Branch Coverage Complexity
MessagePolicy
0%
0/10
0%
0/4
1.8
MessagePolicy$ProtectionPolicy
N/A
N/A
1.8
MessagePolicy$Target
N/A
N/A
1.8
MessagePolicy$TargetPolicy
0%
0/10
0%
0/6
1.8
 
 1  
 /**
 2  
  *  Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  *  contributor license agreements.  See the NOTICE file distributed with
 4  
  *  this work for additional information regarding copyright ownership.
 5  
  *  The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  *  (the "License"); you may not use this file except in compliance with
 7  
  *  the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  *  Unless required by applicable law or agreed to in writing, software
 12  
  *  distributed under the License is distributed on an "AS IS" BASIS,
 13  
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  *  See the License for the specific language governing permissions and
 15  
  *  limitations under the License.
 16  
  */
 17  
 package javax.security.auth.message;
 18  
 
 19  
 /**
 20  
  * @version $Rev: 768352 $ $Date: 2009-04-24 09:26:01 -0700 (Fri, 24 Apr 2009) $
 21  
  */
 22  
 public class MessagePolicy {
 23  
 
 24  
     private final TargetPolicy[] targetPolicies;
 25  
     private final boolean mandatory;
 26  
 
 27  0
     public MessagePolicy(TargetPolicy[] targetPolicies, boolean mandatory) throws IllegalArgumentException {
 28  0
         if (targetPolicies == null) {
 29  0
             throw new IllegalArgumentException("targetPolicies is null");
 30  
         }
 31  0
         this.targetPolicies = targetPolicies;
 32  0
         this.mandatory = mandatory;
 33  0
     }
 34  
 
 35  
     public TargetPolicy[] getTargetPolicies() {
 36  0
         if (targetPolicies.length == 0) {
 37  0
             return null;
 38  
         }
 39  0
         return targetPolicies;
 40  
     }
 41  
 
 42  
     public boolean isMandatory() {
 43  0
         return mandatory;
 44  
     }
 45  
 
 46  
     public static interface ProtectionPolicy {
 47  
 
 48  
         static String AUTHENTICATE_CONTENT = "#authenticateContent";
 49  
         static String AUTHENTICATE_RECIPIENT = "#authenticateRecipient";
 50  
         static String AUTHENTICATE_SENDER = "#authenticateSender";
 51  
 
 52  
         String getID();
 53  
     }
 54  
 
 55  
     public static interface Target {
 56  
 
 57  
         Object get(MessageInfo messageInfo);
 58  
 
 59  
         void put(MessageInfo messageInfo, Object data);
 60  
 
 61  
         void remove(MessageInfo messageInfo);
 62  
     }
 63  
 
 64  
     public static class TargetPolicy {
 65  
 
 66  
         private final Target[] targets;
 67  
         private final ProtectionPolicy protectionPolicy;
 68  
 
 69  0
         public TargetPolicy(Target[] targets, ProtectionPolicy protectionPolicy) throws IllegalArgumentException {
 70  0
             if (protectionPolicy == null) {
 71  0
                 throw new IllegalArgumentException("protectionPolicy is null");
 72  
             }
 73  0
             this.targets = targets;
 74  0
             this.protectionPolicy = protectionPolicy;
 75  0
         }
 76  
 
 77  
         public Target[] getTargets() {
 78  0
             if (targets == null || targets.length == 0) {
 79  0
                 return null;
 80  
             }
 81  0
             return targets;
 82  
         }
 83  
 
 84  
         public ProtectionPolicy getProtectionPolicy() {
 85  0
             return protectionPolicy;
 86  
         }
 87  
     }
 88  
 }