1 23 package com.sun.enterprise.deployment; 24 25 import com.sun.enterprise.deployment.web.UserDataConstraint; 26 import com.sun.enterprise.util.LocalStringManagerImpl; 27 28 29 34 35 public class UserDataConstraintImpl extends Descriptor implements UserDataConstraint { 36 37 public static final String TRANSPORT_GUARANTEE_NONE = UserDataConstraint.NONE_TRANSPORT; 38 39 public static final String TRANSPORT_GUARANTEE_INTEGRAL = UserDataConstraint.INTEGRAL_TRANSPORT; 40 41 public static final String TRANSPORT_GUARANTEE_CONFIDENTIAL = UserDataConstraint.CONFIDENTIAL_TRANSPORT; 42 43 44 public static final String TRANSPORT_GUARANTEE_CLEAR = UserDataConstraint.CLEAR; 45 private static final String [] transportGuaranteeChoices = { 46 TRANSPORT_GUARANTEE_NONE, 47 TRANSPORT_GUARANTEE_INTEGRAL, 48 TRANSPORT_GUARANTEE_CONFIDENTIAL, 49 }; 50 private String transportGuarantee; 51 private static LocalStringManagerImpl localStrings = 52 new LocalStringManagerImpl(UserDataConstraintImpl.class); 53 54 57 public static final String [] getTransportGuaranteeChoices() { 58 return transportGuaranteeChoices; 59 } 60 61 64 public String getTransportGuarantee() { 65 if (transportGuarantee == null) { 66 transportGuarantee = TRANSPORT_GUARANTEE_NONE; 67 } 68 return transportGuarantee; 69 } 70 71 public String [] getUnacceptableTransportGuarantees(){ 72 String acceptable = getTransportGuarantee(); 73 if(acceptable.equals(TRANSPORT_GUARANTEE_NONE)) 74 return (String []) null; 75 else if (acceptable.equals(TRANSPORT_GUARANTEE_INTEGRAL)){ 76 String [] ret = new String [] {TRANSPORT_GUARANTEE_CLEAR, TRANSPORT_GUARANTEE_CONFIDENTIAL }; 77 return ret; 78 } else if (acceptable.equals(TRANSPORT_GUARANTEE_CONFIDENTIAL)){ 79 String [] ret = new String [] {TRANSPORT_GUARANTEE_CLEAR, TRANSPORT_GUARANTEE_INTEGRAL }; 80 return ret; 81 } 82 return (String []) null; 83 } 84 88 public void setTransportGuarantee(String transportGuarantee) { 89 if (this.isBoundsChecking()) { 90 if ( !UserDataConstraint.NONE_TRANSPORT.equals(transportGuarantee) 91 && !UserDataConstraint.INTEGRAL_TRANSPORT.equals(transportGuarantee) 92 && !UserDataConstraint.CONFIDENTIAL_TRANSPORT.equals(transportGuarantee)) { 93 throw new IllegalArgumentException (localStrings.getLocalString( 94 "enterprise.deployment.exceptiontransportguarentee", 95 "{0} is not a valid transport guarantee", new Object [] {transportGuarantee})); 96 } 97 } 98 this.transportGuarantee = transportGuarantee; 99 } 100 101 104 public void print(StringBuffer toStringBuffer) { 105 toStringBuffer.append("UserDataConstraint "); 106 toStringBuffer.append(" description ").append(super.getDescription()); 107 toStringBuffer.append(" transportGuarantee ").append(getTransportGuarantee()); 108 } 109 } 110 | Popular Tags |