Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 19 package gcc.rmi.iiop.compiler; 20 21 import gcc.*; 22 import gcc.rmi.iiop.*; 23 import gcc.rmi.iiop.compiler.SkelCompiler; 24 import gcc.util.*; 25 import java.util.*; 26 27 public class SkelFactory 28 { 29 protected static SkelFactory _sf = new SkelFactory(); 30 31 protected SkelFactory() 32 { 33 } 34 35 public static SkelFactory getInstance() 36 { 37 return _sf; 38 } 39 40 42 private static HashMap _skelClassMap; 43 44 46 protected void init() 47 { 48 _skelClassMap = new HashMap(); 49 } 50 51 protected Class loadStub(Class remoteInterface) 52 { 53 String className = remoteInterface.getName(); 54 String skelClassName = className + "_Skeleton"; 55 56 80 81 Class sc = null; 82 try 83 { 84 sc = Class.forName( skelClassName ); 85 SkelCompiler skelCompiler = new SkelCompiler(sc); 86 sc = skelCompiler.getSkelClass(); 87 } 88 catch( Exception ex ) 89 { 90 throw new SystemException( ex ); 91 } 92 93 return sc; 94 } 95 96 98 public RemoteObject getSkel(Class remoteInterface) 99 { 100 System.out.println( "SkelFactory.getSkel(): remoteInterface: " + remoteInterface ); 101 try 102 { 103 Class sc = (Class)_skelClassMap.get(remoteInterface); 104 if (sc == null) 105 { 106 synchronized (_skelClassMap) 107 { 108 sc = (Class)_skelClassMap.get(remoteInterface); 109 if (sc == null) 110 { 111 sc = loadStub(remoteInterface); 112 _skelClassMap.put(remoteInterface, sc); 113 } 114 } 115 } 116 return (RemoteObject)sc.newInstance(); 118 } 119 catch (Exception ex) 120 { 121 throw new SystemException(ex); 122 } 123 } 124 125 public Object getSkel(String remoteInterface) 126 { 127 return getSkel(ThreadContext.loadClass(remoteInterface)); 128 } 129 } 130
| Popular Tags
|