1 26 27 package org.objectweb.openccm.Deployment; 28 29 import java.net.URL ; 30 import java.util.Hashtable ; 31 import org.omg.Components.Cookie; 32 import org.omg.Components.Deployment.Assembly; 33 34 35 40 public class AssemblyFactoryImpl extends org.omg.Components.Deployment.AssemblyFactoryPOA 41 { 42 private Hashtable assemblies ; 44 45 public AssemblyFactoryImpl() 46 { 47 assemblies=new java.util.Hashtable (); 48 } 49 50 54 public Cookie 55 create_assembly(String assembly_loc) 56 throws org.omg.Components.Deployment.InvalidLocation, 57 org.omg.Components.CreateFailure 58 { 59 org.objectweb.openccm.Components.CookieImpl c= 60 new org.objectweb.openccm.Components.CookieImpl(""+System.currentTimeMillis()); 61 URL url=null; 62 try{ 63 url=new URL (assembly_loc); 64 } 65 catch(Exception e){ 66 e.printStackTrace(); 67 throw new org.omg.Components.Deployment.InvalidLocation(); 68 } 69 AssemblyImpl ass=new AssemblyImpl(url); 70 ass._this(org.objectweb.openccm.corba.TheORB.getORB()); 71 assemblies.put(c,ass); 72 return c; 73 } 74 75 79 public Assembly lookup(org.omg.Components.Cookie c) 80 throws org.omg.Components.Deployment.InvalidAssembly 81 { 82 if(!assemblies.containsKey(c)) throw new org.omg.Components.Deployment.InvalidAssembly(); return ((AssemblyImpl)assemblies.get(c))._this(); 85 } 86 87 91 public void destroy(org.omg.Components.Cookie c) 92 throws org.omg.Components.Deployment.InvalidAssembly, org.omg.Components.RemoveFailure 93 { 94 if(!assemblies.containsKey(c)) 95 throw new org.omg.Components.Deployment.InvalidAssembly(); 96 97 AssemblyImpl ass=(AssemblyImpl)assemblies.remove(c); 98 ass.unregisterAssembly(); 99 ass.tear_down(); 100 } 101 102 } 103 | Popular Tags |