View Javadoc

1   /*
2    * $Id: UIProxy.java 1419 2010-11-01 14:12:17Z hoheisel $
3    *
4    * Copyright (c) 2005, The K-Wf Grid Consortium
5    * Fraunhofer Institute for Computer Architecture and Software Technology
6    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
7    */
8   
9   package net.kwfgrid.gwes.uiproxy;
10  
11  /**
12   * @author Andreas Hoheisel
13   *         (<a href="http://www.andreas-hoheisel.de">www.andreas-hoheisel.de</a>)
14   * @version $Id: UIProxy.java 1419 2010-11-01 14:12:17Z hoheisel $
15   */
16  public interface UIProxy {
17  
18      /**
19       * Subscribe for messages at a publisher. This will instantiate a buffer which stores the notification provided by the publisher.
20       * The specification of the subuscription must conform to the format which is defined by the SubscriptionHandler of the UIProxy.
21       *
22       * @param clientid     The UUID of the client.
23       * @param subscription Specification of the subscription.
24       * @param buffertype   The type of the buffer to be created.
25       * @param propkeys     The keys of the properties of the buffer, same index as <code>propvalues</code>.
26       * @param propvalues   The values of the properties of the buffer, same index as <code>propkeys</code>.
27       * @return The UUID of the newly created buffer. Needed to poll notifications from that buffer.
28       * @throws SubscriptionFailed If the subscription failed.
29       */
30      String subscribe(String clientid, String subscription, String buffertype, String[] propkeys, String[] propvalues) throws SubscriptionFailed;
31  
32      /**
33       * Renew the lease for the specified client.
34       * If the client is unknown the request is silently discarded.
35       *
36       * @param clientid The UUID of the client.
37       */
38      void renewLease(String clientid);
39  
40      /**
41       * Set a property of a buffer.
42       * Calling this method will also renew the lease for the specified client.
43       * If the client is not the creator of the buffer, this method will silently discard the request.
44       *
45       * @param clientid The UUID of the client.
46       * @param bufferid The UUID of the buffer.
47       * @param key      The name of the property.
48       * @param value    The value of the property
49       * @throws BufferException If an exception occured when setting the property.
50       */
51      void setBufferProperty(String clientid, String bufferid, String key, String value) throws BufferException;
52  
53      /**
54       * Dispose a buffer.
55       * Calling this method will also renew the lease for the specified client.
56       * If the client is not the creator of the buffer, this method will silently discard the request.
57       *
58       * @param clientid The UUID of the client.
59       * @param bufferid The UUID of the buffer.
60       */
61      void disposeBuffer(String clientid, String bufferid);
62  
63      /**
64       * Dispose a whole client. This will free all resources associated with the client.
65       * If the client is unknown the request will be silently discarded.
66       *
67       * @param clientid The UUID of the client.
68       */
69      void disposeClient(String clientid);
70  
71      /**
72       * Poll all buffered notifications for the specified client and buffer.
73       * Calling this method will also renew the lease for the specified client.
74       * If the client is not the creator of the buffer, this method will silently discard the request and return an empty collection.
75       *
76       * @return A collection of all buffered notifications from the specified buffer.
77       * @throws BufferException        If a exception occured at the buffer when handling a message. In that case the client will have to create a new
78       *                                Buffer.
79       * @throws UnknownClientException If the specified client is unknown to the UIProxy. This may also happen if the lease has timed out for the
80       *                                specified client.
81       * @throws UnknownBufferException If the specified buffer is unknown to the UIProxy. This may also happen if the buffer previously encountered
82       *                                a <code>BufferException</code>.
83       *                                specified client.
84       */
85      String[] poll(String clientid, String bufferid) throws CodecException, BufferException, UnknownClientException, UnknownBufferException;
86  
87  }