ist.palcom.info
Class ModifiableInfoHandler

java.lang.Object
  extended by ist.palcom.info.ModifiableInfoHandler
All Implemented Interfaces:
InfoHandler, InfoListener

public class ModifiableInfoHandler
extends java.lang.Object
implements InfoHandler, InfoListener

An InfoHandler implementation, with updating methods added.


Constructor Summary
ModifiableInfoHandler()
           
 
Method Summary
 void addInfoListener(InfoListener l)
          Adds a listener for InfoEvents posted after the list changes.
 boolean assemblyIsEstablished(PRDAssemblyVer ai)
           
 boolean assemblyIsPossible(PRDAssemblyVer assemblyInfo)
           
 void clear()
          Clears the list of Infos.
 boolean connectionIsPossible(PRDConnection connectionInfo)
           
 boolean containsInfoThatEquals(PRDData info)
          Returns true if the InfoHandler contains an info that equals info.
 boolean containsInfoThatIsAboutTheSameEntity(PRDData info)
          Returns true if the InfoHandler contains an info that is about the same entity as info.
 void eventReceived(Event event)
           
 void fireAllInfos()
          Send out InfoEvents for all infos to listeners.
 PRDDevice getDeviceInfo(DeviceID deviceID)
           
 PRDData getInfo(int index)
           
 PRDData getInfoThatEquals(PRDData info)
           
 PRDData getInfoThatIsAboutTheSameEntity(PRDData info)
           
 java.lang.String getLongName(LocalSID serviceLocalSID)
          Returns the long name of the service with a given LocalSID, or null if it does not exist in this handler.
 PRDConnection[] getMatchingConnectionInfos(PRDData info1, PRDData info2)
           
 int getNumberOfInfos()
           
 PRDServiceFMDescription getServiceDescription(LocalSID providerLocalSID)
           
 PRDServiceListItem getServiceListItem(LocalSID serviceLocalSID)
           
 ServiceStatusEvent getServiceStatusEvent(LocalSID serviceLocalSID)
           
 PRDServiceList getSubserviceList(LocalSID parentLocalSID)
           
 void infoReceived(InfoEvent event)
          Called as an info event has been received.
 void removeInfo(PRDData info)
          Removes the info from the list, that is about the same entity as info.
 void removeInfoListener(InfoListener l)
          Removes a listener previously added with addInfoListener().
 boolean servicesMatch(PRDData info1, PRDData info2)
           
 void updateInfo(PRDData info)
          Adds an Info to the list, or, if an info about the same entity is already in the list, updates it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModifiableInfoHandler

public ModifiableInfoHandler()
Method Detail

getNumberOfInfos

public int getNumberOfInfos()
Specified by:
getNumberOfInfos in interface InfoHandler

getInfo

public PRDData getInfo(int index)
Specified by:
getInfo in interface InfoHandler
Returns:
The Info at index index, or null if there is no such item.

getInfoThatEquals

public PRDData getInfoThatEquals(PRDData info)
Specified by:
getInfoThatEquals in interface InfoHandler
Returns:
The Info in the list that equals info, or null if none exists.

getInfoThatIsAboutTheSameEntity

public PRDData getInfoThatIsAboutTheSameEntity(PRDData info)
Specified by:
getInfoThatIsAboutTheSameEntity in interface InfoHandler
Returns:
The Info in the list that is about the same entity, or null if none exists.

updateInfo

public void updateInfo(PRDData info)
Adds an Info to the list, or, if an info about the same entity is already in the list, updates it. InfoEvents will be sent to registered listeners, if the info is changed in the list.


removeInfo

public void removeInfo(PRDData info)
Removes the info from the list, that is about the same entity as info. If there is no such Info in the list, nothing happens (comparison with equals). If an Info is removed, InfoEvents will be sent to registered listeners.


infoReceived

public void infoReceived(InfoEvent event)
Description copied from interface: InfoListener
Called as an info event has been received. May be called several times with info about the same entity. The info may change between calls, so stored infos should be updated. The event may contain a flag that the info should no longer be kept..

Specified by:
infoReceived in interface InfoListener

eventReceived

public void eventReceived(Event event)

fireAllInfos

public void fireAllInfos()
Send out InfoEvents for all infos to listeners.


clear

public void clear()
Clears the list of Infos. InfoEvents may be generated and passed to listeners that have registered in this object.


containsInfoThatEquals

public boolean containsInfoThatEquals(PRDData info)
Description copied from interface: InfoHandler
Returns true if the InfoHandler contains an info that equals info.

Specified by:
containsInfoThatEquals in interface InfoHandler

containsInfoThatIsAboutTheSameEntity

public boolean containsInfoThatIsAboutTheSameEntity(PRDData info)
Description copied from interface: InfoHandler
Returns true if the InfoHandler contains an info that is about the same entity as info.

Specified by:
containsInfoThatIsAboutTheSameEntity in interface InfoHandler

addInfoListener

public void addInfoListener(InfoListener l)
Description copied from interface: InfoHandler
Adds a listener for InfoEvents posted after the list changes.

Specified by:
addInfoListener in interface InfoHandler

removeInfoListener

public void removeInfoListener(InfoListener l)
Description copied from interface: InfoHandler
Removes a listener previously added with addInfoListener().

Specified by:
removeInfoListener in interface InfoHandler

getServiceListItem

public PRDServiceListItem getServiceListItem(LocalSID serviceLocalSID)
Specified by:
getServiceListItem in interface InfoHandler
Returns:
The service list item in this handler's list which has LocalSID serviceLocalSID. The whole trees will be searched, and a service or a sublist will be returned if it matches. Null is returned if no matching service list item is found.

getServiceStatusEvent

public ServiceStatusEvent getServiceStatusEvent(LocalSID serviceLocalSID)

getDeviceInfo

public PRDDevice getDeviceInfo(DeviceID deviceID)
Specified by:
getDeviceInfo in interface InfoHandler
Returns:
The DeviceInfo in this handler's list which has String deviceID. Null is returned if no matching device info is found.

getServiceDescription

public PRDServiceFMDescription getServiceDescription(LocalSID providerLocalSID)
Specified by:
getServiceDescription in interface InfoHandler
Returns:
The ServiceDescription in this handler's list for the provider which has LocalSID providerLocalSID. Null is returned if no matching device info is found.

getSubserviceList

public PRDServiceList getSubserviceList(LocalSID parentLocalSID)
Specified by:
getSubserviceList in interface InfoHandler
Returns:
The list of subservices for the info with LocalSID parentLocalSID.

getLongName

public java.lang.String getLongName(LocalSID serviceLocalSID)
Description copied from interface: InfoHandler
Returns the long name of the service with a given LocalSID, or null if it does not exist in this handler.

Specified by:
getLongName in interface InfoHandler

connectionIsPossible

public boolean connectionIsPossible(PRDConnection connectionInfo)
Specified by:
connectionIsPossible in interface InfoHandler
Returns:
True if the connection in connectionInfo is possible, i.e. if ServiceInfos for both its parties are in this InfoHandler.

assemblyIsEstablished

public boolean assemblyIsEstablished(PRDAssemblyVer ai)
Specified by:
assemblyIsEstablished in interface InfoHandler
Returns:
True if the assembly in assemblyInfo is fully established, i.e. if ConnectionInfos for all its connections are in this InfoHandler, and they are all active.

assemblyIsPossible

public boolean assemblyIsPossible(PRDAssemblyVer assemblyInfo)
Specified by:
assemblyIsPossible in interface InfoHandler
Returns:
True if the assembly in assemblyInfo is possible, i.e. if all its connections are possible, in the same sense as for InfoHandler.connectionIsPossible(PRDConnection).

servicesMatch

public boolean servicesMatch(PRDData info1,
                             PRDData info2)
Specified by:
servicesMatch in interface InfoHandler
Returns:
true if there is at least one matching customer-service pair in info1 and info2, looking in this InfoHandler. The whole trees of subservices are examined.

getMatchingConnectionInfos

public PRDConnection[] getMatchingConnectionInfos(PRDData info1,
                                                  PRDData info2)
Specified by:
getMatchingConnectionInfos in interface InfoHandler
Returns:
an array of ConnectionInfos for matching customer-service pairs in info1 and info2, looking in this InfoHandler.