Skip to main content
summaryrefslogtreecommitdiffstats
blob: 84dff6afe22e16210e343edad534d1a443413b16 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * 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:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.ote.service.core;

import java.rmi.RemoteException;
import org.eclipse.osee.connection.service.IServiceConnector;
import org.eclipse.osee.ote.core.environment.UserTestSessionKey;
import org.eclipse.osee.ote.core.environment.interfaces.IHostTestEnvironment;
import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;

/**
 * Encapsulated all information regarding the current connection between a client and a test server.
 * 
 * @author Ken J. Aguilar
 */
class TestHostConnection {
   // intentionally package-private

   private final IServiceConnector serviceConnector;
   private final ITestEnvironment connectEnvironment;
   private final UserTestSessionKey sessionKey;
   private final IHostTestEnvironment host;

   TestHostConnection(IServiceConnector connector, IHostTestEnvironment host, ITestEnvironment connectEnvironment, UserTestSessionKey sessionKey) {
      // intentionally package-private
      if (connector == null) {
         throw new NullPointerException("service connector cannot be null");
      }
      if (connectEnvironment == null) {
         throw new NullPointerException("test environment cannot be null");
      }
      if (sessionKey == null) {
         throw new NullPointerException("session key cannot be null");
      }
      this.serviceConnector = connector;
      this.host = host;
      this.connectEnvironment = connectEnvironment;
      this.sessionKey = sessionKey;
   }

   /**
    * @return the connectedTestHost
    */
   public IServiceConnector getConnectedTestHost() {
      return serviceConnector;
   }

   /**
    * @return the connectEnvironment
    */
   public ITestEnvironment getConnectEnvironment() {
      return connectEnvironment;
   }

   /**
    * @return the sessionKey
    */
   public UserTestSessionKey getSessionKey() {
      return sessionKey;
   }

   /**
    * @return the serviceConnector
    */
   public IServiceConnector getServiceConnector() {
      return serviceConnector;
   }

   void endConnection() throws RemoteException {
      // intentionally package-private

      host.disconnect(sessionKey);
   }
}

Back to the top