1 26 27 package org.objectweb.openccm.command.lib; 28 29 import org.objectweb.util.cmdline.lib.DefaultCommandLine; 31 32 39 40 public class IR3Destroy 41 extends CommandOnIR3Base 42 implements org.objectweb.openccm.command.api.IR3Destroy 43 { 44 50 56 57 public 58 IR3Destroy() 59 { 60 super(new DefaultCommandLine("ir3_destroy", 62 "omg_idl_scoped_name", 63 "Destroy an object from the OpenCCM Interface Repository", 64 true)); 65 } 66 67 73 79 85 92 public int 93 run(java.lang.String [] args) 94 { 95 if(!checkComponentRepository()) 97 return -1; 98 99 if(!destroy(args[0])) 101 return -1; 102 103 return 0; 105 } 106 107 113 119 126 public boolean 127 destroy(String scoped_name) 128 { 129 org.omg.CORBA.Contained contained = getComponentRepository().lookup(scoped_name); 131 if(contained == null) 132 { 133 getConsole().error(scoped_name + " not found in the OpenCCM Interface Repository!"); 134 return false; 135 } 136 137 try 139 { 140 contained.destroy(); 141 } 142 catch(org.omg.CORBA.BAD_INV_ORDER sysExc) 143 { 144 switch(sysExc.minor) 145 { 146 case org.objectweb.openccm.ir3.SystemExceptionMinorValues.Dependency: 147 getConsole().error(scoped_name + 148 " not destroyed because dependency exits in the OpenCCM Interface Repository preventing destruction!"); 149 return false; 150 151 case org.objectweb.openccm.ir3.SystemExceptionMinorValues.CanNotBeDestroyed: 152 getConsole().error(scoped_name + 153 " not destroyed because indestructible object!"); 154 return false; 155 } 156 } 157 158 getConsole().message(scoped_name + " destroyed successfully."); 160 return true; 161 } 162 163 169 174 public static void 175 main(String [] args) 176 { 177 IR3Destroy ir3destroy = new IR3Destroy(); 178 ir3destroy.runMain(args); 179 } 180 } 181 | Popular Tags |