bwLehrpool Masterserver
Manages authentication and sharing of virtual machines between participating institutions
ServerSession.java
Go to the documentation of this file.
1 package org.openslx.imagemaster.serversession;
2 
3 import java.util.List;
4 
7 
11 public class ServerSession
12 {
13  private static final long TIMEOUT = Globals.getSessionTimeoutServer() * 1000L;
14 
15  private long timeOut = 0;
16  private final LocalSatellite serverUser;
17 
18  public ServerSession( final LocalSatellite serverUser )
19  {
20  this.serverUser = serverUser;
21  this.timeOut = System.currentTimeMillis() + TIMEOUT;
22  }
23 
24  public synchronized void refresh()
25  {
26  if ( timedOut() )
27  return; // Don't allow refreshing timed out session
28  this.timeOut = System.currentTimeMillis() + TIMEOUT;
29  }
30 
31  public synchronized boolean timedOut()
32  {
33  return System.currentTimeMillis() > this.timeOut;
34  }
35 
36  public String getOrganizationId()
37  {
38  return serverUser.organizationId;
39  }
40 
41  public List<String> getAddresses()
42  {
43  return serverUser.addresses;
44  }
45 }
Class to hold global constants and properties from 'config/global.properties'.
Definition: Globals.java:16
static int getSessionTimeoutServer()
Definition: Globals.java:85
ServerSession(final LocalSatellite serverUser)
Holds the session id of the server and manages the timeout.