1 28 29 package ist.coach.itut_q816Components.FactoryFinderProviderComposition; 30 31 import intt.itu.itut_x780.UIDType; 32 import intt.itu.itut_x780.ApplicationError; 33 import intt.itu.itut_q816.FactoryInfoType; 34 35 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl; 36 42 public class adminSegImpl 43 extends ist.coach.itut_q816Components.FactoryFinderProviderComposition.adminSeg 44 { 45 51 57 public adminSegImpl() 58 { 59 } 60 61 67 70 public void 71 register(String factoryClass, intt.itu.itut_x780.ManagedObjectFactory factoryRef) 72 throws intt.itu.itut_x780.ApplicationError 73 { 74 if (factoryClass == null || factoryClass.length() == 0) { 78 ApplicationErrorInfoTypeImpl error_code = 79 new ApplicationErrorInfoTypeImpl(); 80 error_code.error = new UIDType( 81 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 82 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 83 error_code.details = new String ("Factory class name is not specified!"); 84 85 throw new ApplicationError(error_code); 86 } 87 if (factoryRef == null) { 88 ApplicationErrorInfoTypeImpl error_code = 89 new ApplicationErrorInfoTypeImpl(); 90 error_code.error = new UIDType( 91 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value, 92 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value); 93 error_code.details = new String ("Factory reference is not provided!"); 94 95 throw new ApplicationError(error_code); 96 } 97 98 FactoryInfoType factory_info = new FactoryInfoType(factoryClass, factoryRef); 99 synchronized(FactoryFinderProviderImpl.factories) { 100 FactoryFinderProviderImpl.factories.put(factoryClass, factory_info); 101 } 102 } 103 104 107 public void 108 unregister(String factoryClass, intt.itu.itut_x780.ManagedObjectFactory factoryRef) 109 throws intt.itu.itut_q816.FactoryNotFound, 110 111 intt.itu.itut_x780.ApplicationError 112 { 113 117 if (! FactoryFinderProviderImpl.factories.containsKey(factoryClass)) 118 throw new intt.itu.itut_q816.FactoryNotFound(factoryClass + 119 " has not been registered"); 120 synchronized(FactoryFinderProviderImpl.factories) { 121 FactoryFinderProviderImpl.factories.remove(factoryClass); 122 } 123 } 124 125 } 126 | Popular Tags |