1 22 package org.jboss.iiop.csiv2; 23 24 import org.omg.CORBA.LocalObject ; 25 import org.omg.CORBA.Policy ; 26 import org.omg.CORBA.ORB ; 27 28 import org.omg.IOP.Codec ; 29 import org.omg.IOP.TaggedComponent ; 30 31 import org.jboss.iiop.CorbaORBService; 32 import org.jboss.logging.Logger; 33 import org.jboss.metadata.IorSecurityConfigMetaData; 34 35 42 public class CSIv2Policy 43 extends LocalObject 44 implements Policy 45 { 46 private static final Logger log = Logger.getLogger(CSIv2Policy.class); 48 49 public static final int TYPE = 0x87654321; 51 52 private TaggedComponent sslTaggedComponent; 54 private TaggedComponent secTaggedComponent; 55 56 public CSIv2Policy(TaggedComponent sslTaggedComponent, 58 TaggedComponent secTaggedComponent) 59 { 60 this.sslTaggedComponent = sslTaggedComponent; 61 this.secTaggedComponent = secTaggedComponent; 62 } 63 64 public CSIv2Policy(IorSecurityConfigMetaData metadata, Codec codec) 65 { 66 log.debug(metadata); 67 68 70 try { 71 ORB orb = ORB.init(); 73 74 this.sslTaggedComponent = 75 CSIv2Util.createSSLTaggedComponent( 76 metadata, 77 codec, 78 CorbaORBService.getTheActualSSLPort(), 79 orb); 80 81 this.secTaggedComponent = 82 CSIv2Util.createSecurityTaggedComponent( 83 metadata, 84 codec, 85 CorbaORBService.getTheActualSSLPort(), 86 orb); 87 } 88 catch (Exception e) { 89 throw new RuntimeException ("Unexpected exception " + e); 90 } 91 } 92 93 96 public TaggedComponent getSSLTaggedComponent() 97 { 98 return CSIv2Util.createCopy(this.sslTaggedComponent); 99 } 100 101 104 public TaggedComponent getSecurityTaggedComponent() 105 { 106 return CSIv2Util.createCopy(this.secTaggedComponent); 107 } 108 109 113 public Policy copy() 114 { 115 return new CSIv2Policy(getSSLTaggedComponent(), 116 getSecurityTaggedComponent()); 117 } 118 119 122 public void destroy() 123 { 124 this.sslTaggedComponent = null; 125 this.secTaggedComponent = null; 126 } 127 128 132 public int policy_type() 133 { 134 return TYPE; 135 } 136 137 public String toString() 138 { 139 return "CSIv2Policy[" + this.sslTaggedComponent + ", " 140 + this.secTaggedComponent + "]"; 141 } 142 } 143 | Popular Tags |