Вы находитесь на странице: 1из 12

ClientBase API Model

Model

XiServer List XiSubscription


List

XiSubscriptio
XiServer
n
subscriptio
Context n
items
Server List
XiServer • Responsible for discovering servers
List
and adding them to the list
XiServe
r • Discovery can be through PNRP or
Context
through manual configuration (common
to all clients)
• Client application can add servers to
the list
• “Current Server” is the last used server
– to maintain context when the client
application starts and restarts regularly
Server Object
XiServer • Automatically gets endpoints when the
List client application requests to connect
XiServe to it
r
• Automatically selects the Resource
Context

Management Endpoint binding to use


if not specified by the client application
• Automatically opens the Read, Write,
Poll, Callback endpoints when needed
by the client subscriptions, based on
the binding type of the Resource
Management binding
Subscription List
XiSubscription List • Contains list of XiSubscription objects
XiSubscriptio
• Client applications can subclass the
n
standard subscription subclasses –
XiExcelDataSubscription might contain
row/column information.
• Searchable by the client using List.Find()
• Integrates Polling and Callbacks into a
single Subscribe model, and uses a poll
thread for polling subscriptions that issues
callbacks to the client application.
Subscription
XiSubscription List • Corresponds to an XiList
• Integrates Read/Write/Subscribe
XiSubscriptio
n endpoints as a Property
• “Subscribe” callbacks issued to the client
application. The forward callbacks from
the server, and in the case of polling,
contains a poll thread to get the values.
• Allows the client to maintain the list
contents and give it back to the
Subscription – the Subscription will update
itself, removing items that are gone and
adding new items.
Building the Server List
• Client application instantiates the XiClient object
• ClientBase locates the DiscoveryServer and gets list
of ServerEntries.
• ClientBase locates a manual config file and gets list of
server addresses from it (same as the Discovery
Server uses).
• The client application can also add server addresses
to the ServerList if it knows the servers to which it may
wish to connect.
• For server addresses that were added, the ClientBase
gets the ServerEntries directly from the server.
Connecting to a Server
• Client application requests a connection to a
server in the ServerList, optionally including the
binding type.
• ClientBase gets the EndpointInfo from the MEX
Endpoint in the ServerEntry, ranks the bindings
that are returned, selects the top one, and
connects to the Resource Management
endpoint.
Creating a Subscription
• Client application creates a standard
XiSubscription or a subclass it defined and
includes whether it is to be used for reading,
writing, and/or subscribing, and includes its
other ListAttributes (e.g. UpdateRate, Enabled).
• ClientBase creates the subscription object and
opens the appropriate endpoints using the
ResourceManagement binding as a guide.
Adding Items to Data Subscriptions
• Client application browse for items for a Data
Subscription or can load the list of items from a
file.
• Client application can ask ClientBase to save the
list as a file.
• Client application submits the list of items (e.g.
from a listbox/file) to the Data Subscription.
• In the case where the client application needs to
submit items one at a time, it must issue a Commit
to the ClientBase to cause the server to be
updated.
• ClientBase updates the server.
Updating a Subscription
• Client application can modify its list of
items and its List Attributes and resubmit
to the ClientBase using UpdateList().
• ClientBase will:
– remove items from the server List that are no
longer present,
– add new items to the server List, and
– update the ListAttributes as necessary.
Getting Subscription Updates
• Client application provides a callback for
the subscribe operation.
• Client application can issue a Read() or
Write() if the Subscription Read or Write
property is set.