Skip to main content
summaryrefslogtreecommitdiffstats
blob: a4204aa570ab88e1e26b7a0c84b85b90f9be1bb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
 * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.session.remote;

import org.eclipse.emf.cdo.common.util.CDOException;
import org.eclipse.emf.cdo.session.remote.CDORemoteSessionEvent.MessageReceived;

/**
 * Represents a remote session that is connected to the same repository as the
 * {@link CDORemoteSessionManager#getLocalSession() local session} that the {@link #getManager() remote session manager}
 * points to.
 * 
 * @author Eike Stepper
 * @since 2.0
 */
public interface CDORemoteSession extends Comparable<CDORemoteSession>
{
  /**
   * Returns the remote session manager that manages this remote session.
   */
  public CDORemoteSessionManager getManager();

  /**
   * Returns the session ID of this remote session.
   */
  public int getSessionID();

  /**
   * Returns the user ID of this remote session.
   */
  public String getUserID();

  /**
   * Returns <code>true</code> if this remote session is subscribed to changes in the set of remote sessions and
   * delivers {@link MessageReceived custom data events}, <code>false</code> otherwise.
   */
  public boolean isSubscribed();

  /**
   * Sends a unicast message to this remote session if it is subscribed.
   * 
   * @return <code>true</code> if the server received the custom data message, <code>false</code> otherwise.
   *         <b>Note:</b> No assumption must be made on whether the recipient session received the message and was able
   *         to handle it adequately!
   * @throws CDOException
   *           if this remote session is not subscribed.
   * @see #isSubscribed()
   * @since 3.0
   */
  public boolean sendMessage(CDORemoteSessionMessage message);
}

Back to the top