1 25 26 package org.objectweb.openccm.deploytool; 27 35 public class TearDownTool { 36 42 private String assemblyName=null; 43 44 private String iorFile=null; 45 46 private String fileURL=null; 47 private void 53 computeArgs(String args[]) 54 { 55 for(int i=0;i<args.length;i++){ 56 if(args[i].startsWith("-N-F")) 57 this.iorFile=args[i].substring(4); 58 else if(args[i].startsWith("-N-U")){ 59 this.fileURL=args[i].substring(4); 60 } 61 else if(args[i].startsWith("-N")) 62 this.assemblyName=System.getProperty("Assemblies_ns_dir")+ 63 args[i].substring(2); 64 } 65 } 66 67 73 77 public TearDownTool(String args[]){ 78 try{ 79 computeArgs(args); 80 tearDown(); 81 } 82 catch(Exception e) 83 { 84 85 if(iorFile!=null||fileURL!=null){ 86 88 } 89 else{ 90 System.err.println("Cannot tear_down the assembly "+assemblyName); 91 } 92 } 93 94 95 } 96 97 106 public void 107 tearDown() 108 throws Exception 109 { 110 111 if(assemblyName!=null) { 113 org.omg.CosNaming.NamingContextExt context= 114 org.omg.CosNaming.NamingContextExtHelper 115 .narrow(org.objectweb.openccm.corba.TheNameService 116 .getNamingContext() 117 .getNamingContext()); 118 119 org.omg.Components.Deployment.Assembly assemblyObject= 120 org.omg.Components 121 .Deployment.AssemblyHelper 122 .narrow(context.resolve(context.to_name(assemblyName))); 123 124 assemblyObject.tear_down(); 126 } 127 else { java.io.InputStream in ; 129 if(fileURL!=null) 130 { 131 java.net.URL URL=new java.net.URL (fileURL); 133 in=URL.openStream(); 135 } 136 else 137 { 138 in=new java.io.FileInputStream (iorFile); 139 } 140 141 byte [] tab=new byte[in.available()]; 142 in.read(tab); 144 String ior=new String (tab); 146 org.omg.CORBA.Object obj= 148 org.objectweb.openccm.corba.TheORBSingleton.getORB(). 149 string_to_object(ior.trim()); 150 org.omg.Components.CCMObjectHelper.narrow(obj).remove(); 152 } 153 154 } 155 156 public static void main(String args[]){ 157 org.objectweb.openccm.corba.TheORB.initialize(args); 159 new TearDownTool(args); 161 162 org.objectweb.openccm.corba.TheORB.destroy(); 163 } 164 165 } 166 | Popular Tags |