Package cern.dip.mock
Class MockDipFactory
- java.lang.Object
-
- cern.dip.mock.MockDipFactory
-
- All Implemented Interfaces:
DipFactory
public class MockDipFactory extends java.lang.Object implements DipFactory
-
-
Field Summary
Fields Modifier and Type Field Description java.util.HashMap<java.lang.String,java.util.Collection<MockDipSubscription>>
m_publicationNameToSubscription
java.util.HashMap<MockDipSubscription,DipSubscriptionListener>
m_subscriptionToListener
-
Constructor Summary
Constructors Constructor Description MockDipFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DipBrowser
createDipBrowser()
Create a browser object with which the namespace of DIP may be viewed.DipData
createDipData()
Creates a new DipData object.DipPublication
createDipPublication(java.lang.String topicName, DipPublicationErrorHandler handler)
Creates a new DipPublication object for the topic specified by topicName.DipSubscription
createDipSubscription(java.lang.String topicName, DipSubscriptionListener listener)
Creates a new DipSubscription object for the topic specified by topicName.void
destroyDipPublication(DipPublication publication)
Destroys DipPublication object previously created by createDipPublication().void
destroyDipSubscription(DipSubscription subscription)
Destroys DipSubscription object previously created by createDipSubscription().int
getTimeout()
Get the write and connection timeout to be used for DIP communication.void
onPublicationUpdate(DipPublication publication, DipData value)
Use this method to programmatically cause on update on all registered subscription listeners.void
setDNSNode(java.lang.String nodeName)
Specifies the DNS to be used for the DIP communication.void
setTimeout(int timeout)
Set the write and connection timeout to be used for DIP communication.
-
-
-
Field Detail
-
m_publicationNameToSubscription
public java.util.HashMap<java.lang.String,java.util.Collection<MockDipSubscription>> m_publicationNameToSubscription
-
m_subscriptionToListener
public java.util.HashMap<MockDipSubscription,DipSubscriptionListener> m_subscriptionToListener
-
-
Method Detail
-
setDNSNode
public void setDNSNode(java.lang.String nodeName)
Description copied from interface:DipFactory
Specifies the DNS to be used for the DIP communication. This setting applies for both the publications and the subscriptions. This method shall be used prior the creation of subscriptions or publications as these become active immediatly. Further calls will be ignored.- Specified by:
setDNSNode
in interfaceDipFactory
- Parameters:
nodeName
- name of the DNS to be used.
-
setTimeout
public void setTimeout(int timeout)
Description copied from interface:DipFactory
Set the write and connection timeout to be used for DIP communication.- Specified by:
setTimeout
in interfaceDipFactory
- Parameters:
timeout
- Timeout in seconds to be applied to new connections.
-
getTimeout
public int getTimeout()
Description copied from interface:DipFactory
Get the write and connection timeout to be used for DIP communication.- Specified by:
getTimeout
in interfaceDipFactory
-
createDipSubscription
public DipSubscription createDipSubscription(java.lang.String topicName, DipSubscriptionListener listener) throws DipException
Description copied from interface:DipFactory
Creates a new DipSubscription object for the topic specified by topicName. Data published on this topic, as well as abnormal events such as disconnections, will be delivered to the listener object.- Specified by:
createDipSubscription
in interfaceDipFactory
- Parameters:
topicName
- name of the subscription topiclistener
- is user object which implements- Throws:
DipException
- if the subscription cannot be created.- See Also:
interface, used to receive data as well as the state of publication.
-
createDipPublication
public DipPublication createDipPublication(java.lang.String topicName, DipPublicationErrorHandler handler) throws DipException
Description copied from interface:DipFactory
Creates a new DipPublication object for the topic specified by topicName. This object can then be used to publish new data on the topic. The handler specified by this call is used to inform the Publication developer of any ansynchronous (errors which can not be directly associated with any DipPublication method call).- Specified by:
createDipPublication
in interfaceDipFactory
- Parameters:
topicName
- name of the subscription topic - must be uniquehandler
- - used for handling aysnch. DIP errors.- Throws:
DipException
- if the publication cannot be created.- See Also:
interface,
-
destroyDipSubscription
public void destroyDipSubscription(DipSubscription subscription) throws DipException
Description copied from interface:DipFactory
Destroys DipSubscription object previously created by createDipSubscription().- Specified by:
destroyDipSubscription
in interfaceDipFactory
- Throws:
DipException
- if the subscription is not found.
-
destroyDipPublication
public void destroyDipPublication(DipPublication publication) throws DipException
Description copied from interface:DipFactory
Destroys DipPublication object previously created by createDipPublication().- Specified by:
destroyDipPublication
in interfaceDipFactory
- Throws:
DipException
- if the subscription is not found.
-
createDipData
public DipData createDipData()
Description copied from interface:DipFactory
Creates a new DipData object. DipData objects have to be created for publishing complex data.- Specified by:
createDipData
in interfaceDipFactory
-
createDipBrowser
public DipBrowser createDipBrowser()
Description copied from interface:DipFactory
Create a browser object with which the namespace of DIP may be viewed.- Specified by:
createDipBrowser
in interfaceDipFactory
-
onPublicationUpdate
public void onPublicationUpdate(DipPublication publication, DipData value)
Use this method to programmatically cause on update on all registered subscription listeners.- Parameters:
publication
- The publication that was updated.value
- The DipData packet to send to all listeners.
-
-