1 28 29 30 package org.objectweb.ccm.runtime; 31 32 import org.objectweb.corba.runtime.*; 33 34 37 public class ServiceArchiveImpl 38 extends ArchiveServantBase 39 implements Servant, org.coach.ECM.ServiceArchiveOperations 40 { 41 static final private String _class_name = "ServiceArchiveImpl"; 43 44 static final private String _type_id = org.coach.ECM.ServiceArchiveHelper.id(); 46 47 private ORBService _orb_service; 49 private String _uuid; 50 private String _archive_location; 51 private String _dtd_location; 52 53 private String _service_id; 55 private String _code_location; 56 private String _code_entrypoint; 57 private String _csd_location; 58 private String _ccsd_location; 59 private org.coach.ECM.CORBAServiceRef _corbaservice_ref; 61 62 public 64 ServiceArchiveImpl(ORBService orbs, 65 String dtdloc, 66 String uuid, 67 String loc) 68 { 69 super(uuid, loc); 70 71 _orb_service = orbs; 73 _uuid = uuid; 74 _archive_location = loc; 75 _dtd_location = dtdloc; 76 77 _service_id = null; 79 _code_location = null; 80 _code_entrypoint = null; 81 _csd_location = null; 82 _ccsd_location = null; 83 _corbaservice_ref = null; 84 85 initializeInternalFields(); 87 } 88 89 93 final protected ORBService 94 getORBService() 95 { 96 return _orb_service; 97 } 98 99 103 private void 104 initializeInternalFields() 105 { 106 final String opname = "initializeInternalFields"; 107 java.util.zip.ZipFile zip = openZip(); 109 110 java.util.Enumeration entries = zip.entries(); 112 java.util.zip.ZipEntry entry = null; 113 java.util.zip.ZipEntry csdentry = null; 114 while (entries.hasMoreElements()) { 115 entry = (java.util.zip.ZipEntry )entries.nextElement(); 116 if (entry.getName().endsWith(".csd")) { 117 csdentry = entry; 118 } 119 } 120 121 if (csdentry==null) { 123 final String msg = "FAILED (no CSD found in "+_uuid+")"; 125 TheLogger.error(_class_name, opname, msg); 126 return ; 127 } 128 129 String csdfname = extractFile(zip, csdentry); 131 _csd_location = csdfname; 132 133 CSDParser csdparser = CSDParser.parse(_csd_location, _dtd_location, _uuid); 135 136 _code_entrypoint = csdparser.code_entrypoint; 138 139 entries = zip.entries(); 141 java.util.zip.ZipEntry ccsdentry = null; 142 java.util.zip.ZipEntry codelocentry = null; 143 String ccsdname = csdparser.descriptor_location; 144 String codeloc = csdparser.code_location; 145 while (entries.hasMoreElements()) { 146 entry = (java.util.zip.ZipEntry )entries.nextElement(); 147 if (entry.getName().equals(ccsdname)) { 148 ccsdentry = entry; 149 } 150 else if (entry.getName().equals(codeloc)) { 151 codelocentry = entry; 152 } 153 } 154 155 if (codelocentry==null) { 157 final String msg = "FAILED (no code library found in "+_uuid+")"; 159 TheLogger.error(_class_name, opname, msg); 160 return ; 161 } 162 163 String codelocfname = extractFile(zip, codelocentry); 165 _code_location = codelocfname; 166 167 if (ccsdentry==null) { 169 final String msg = "FAILED (CCSD file not found in "+_uuid+")"; 171 TheLogger.error(_class_name, opname, msg); 172 return ; 173 } 174 175 String ccsdfname = extractFile(zip, ccsdentry); 177 _ccsd_location = ccsdfname; 178 179 CCSDParser ccsdparser = CCSDParser.parse(_ccsd_location, _dtd_location, getORBService()); 181 182 _service_id = ccsdparser.getServiceId(); 184 185 _corbaservice_ref = ccsdparser.getCORBAServiceRef(); 187 188 193 try { 195 zip.close(); 196 } catch(java.io.IOException ex) { 197 TheLogger.error(_class_name, opname, "IGNORE", ex); 200 } 201 } 202 203 207 final public void 208 system_configuration_complete(SystemConfiguration cfg) 209 { 210 initializeInternalFields(); 212 } 213 214 final public void 215 destroy() 216 { 217 } 219 220 224 final public String 225 type_id() 226 { 227 return _type_id; 228 } 229 230 final public org.omg.PortableServer.Servant 231 as_native_servant() 232 { 233 return new org.coach.ECM.ServiceArchivePOATie(this); 234 } 235 236 237 241 247 251 final public String 252 service_id() 253 { 254 return _service_id; 255 } 256 257 final public String 258 csd_location() 259 { 260 return _csd_location; 261 } 262 263 final public String 264 ccsd_location() 265 { 266 return _ccsd_location; 267 } 268 269 final public String 270 code_location() 271 { 272 return _code_location; 273 } 274 275 final public String 276 code_entrypoint() 277 { 278 return _code_entrypoint; 279 } 280 281 final public org.coach.ECM.CORBAServiceRef 282 get_corbaservice_ref() 283 throws org.coach.ECM.NoCORBAServiceRefRequired 284 { 285 if (_corbaservice_ref==null) { 286 throw new org.coach.ECM.NoCORBAServiceRefRequired(); 287 } 288 289 return _corbaservice_ref; 290 } 291 292 final public String 293 exec_xpath_request_in_csd(String req) 294 { 295 final String opname = "exec_xpath_request_in_csd"; 296 final String msg = "FAILED (not implemented, rethrown)"; 297 TheLogger.debug(_class_name, opname, msg); 298 299 throw new org.omg.CORBA.NO_IMPLEMENT (); 300 } 301 302 final public String 303 exec_xpath_request_in_ccsd(String req) 304 { 305 final String opname = "exec_xpath_request_in_ccsd"; 306 final String msg = "FAILED (not implemented, rethrown)"; 307 TheLogger.debug(_class_name, opname, msg); 308 309 throw new org.omg.CORBA.NO_IMPLEMENT (); 310 } 311 } 312 | Popular Tags |