1 28 29 package ist.coach.itut_q816Components.ChannelFinderProviderComposition; 30 31 import ist.coach.coachEmfCommon.ChannelChangeEventImpl; 32 33 import java.util.Hashtable ; 34 import intt.itu.itut_q816.ChannelInfoType; 35 import intt.itu.itut_q816.ChannelModificationType; 36 42 public class adminSegImpl 43 extends ist.coach.itut_q816Components.ChannelFinderProviderComposition.adminSeg 44 { 45 51 57 public adminSegImpl() 58 { 59 } 60 61 62 68 71 public void 72 register(String channelID, String channelClass, String [] eventTypes, String [] excludedEventTypes, String [] sourceClasses, String [] excludedSourceClasses, org.omg.CORBA.Object channel) 73 throws intt.itu.itut_q816.ChannelAlreadyRegistered, 74 75 intt.itu.itut_x780.ApplicationError 76 { 77 81 System.err.println("ChannelFinder> register is called for " + 82 channelID + " of type " + channelClass); 83 84 if (ChannelFinderProviderImpl.channels.containsKey(channelID)) { 85 System.err.println("ChannelFinder> register found channel already registered.."); 86 throw new intt.itu.itut_q816.ChannelAlreadyRegistered(); 87 } 88 89 intt.itu.itut_q816.ChannelInfoType channelInfo = new ChannelInfoType(channelID, 90 channelClass, 91 eventTypes, 92 excludedEventTypes, 93 sourceClasses, 94 excludedSourceClasses, 95 channel); 96 97 synchronized(ChannelFinderProviderImpl.channels) { 98 ChannelFinderProviderImpl.channels.put(channelID, channelInfo); 99 } 100 101 get_context().push_channelChange_alarm(new ChannelChangeEventImpl( 102 ChannelModificationType.ChannelCreate, 103 channelInfo)); 104 } 105 106 109 public void 110 update(String channelID, String channelClass, String [] eventTypes, String [] excludedEventTypes, 111 String [] sourceClasses, String [] excludedSourceClasses, org.omg.CORBA.Object channel) 112 throws intt.itu.itut_q816.ChannelNotFound, 113 intt.itu.itut_x780.ApplicationError 114 { 115 119 System.err.println("ChannelFinder> update is called for " + 120 channelID + " of type " + channelClass); 121 122 if (! ChannelFinderProviderImpl.channels.containsKey(channelID)) { 123 System.err.println("ChannelFinder> could not find channel " + channelID + " to be updated."); 124 throw new intt.itu.itut_q816.ChannelNotFound(); 125 } 126 127 intt.itu.itut_q816.ChannelInfoType channelInfo = new ChannelInfoType(channelID, 128 channelClass, 129 eventTypes, 130 excludedEventTypes, 131 sourceClasses, 132 excludedSourceClasses, 133 channel); 134 synchronized(ChannelFinderProviderImpl.channels) { 135 ChannelFinderProviderImpl.channels.remove(channelID); 136 ChannelFinderProviderImpl.channels.put(channelID, channelInfo); 137 } 138 get_context().push_channelChange_alarm(new ChannelChangeEventImpl( 139 ChannelModificationType.ChannelUpdate, 140 channelInfo)); 141 } 142 143 146 public void 147 unregister(String channelID) 148 throws intt.itu.itut_q816.ChannelNotFound, 149 intt.itu.itut_x780.ApplicationError 150 { 151 155 intt.itu.itut_q816.ChannelInfoType channelInfo; 156 if (ChannelFinderProviderImpl.channels.containsKey(channelID)) { 157 158 synchronized(ChannelFinderProviderImpl.channels) { 159 160 channelInfo = (intt.itu.itut_q816.ChannelInfoType) 161 ChannelFinderProviderImpl.channels.remove(channelID); 162 } 163 } 164 else 165 throw new intt.itu.itut_q816.ChannelNotFound(); 166 167 get_context().push_channelChange_alarm(new ChannelChangeEventImpl( 168 ChannelModificationType.ChannelDelete, 169 channelInfo)); 170 } 171 172 } 173 | Popular Tags |