blob: 6adc653d71ed4554bb690e62f3b7c785c9ddf33d (
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*******************************************************************************
* 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.framework.core.client;
import java.util.List;
import org.eclipse.osee.framework.core.client.internal.InternalClientSessionManager;
import org.eclipse.osee.framework.core.client.internal.OseeApplicationServer;
import org.eclipse.osee.framework.core.data.IUserToken;
import org.eclipse.osee.framework.core.data.OseeSessionGrant;
import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException;
import org.eclipse.osee.framework.database.core.OseeSql;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
/**
* @author Roberto E. Escobar
*/
public class ClientSessionManager {
private ClientSessionManager() {
//
}
public static final String getStatusId() {
return InternalClientSessionManager.STATUS_ID;
}
public static boolean isSessionValid() {
return InternalClientSessionManager.getInstance().isSessionValid();
}
public static void ensureSessionCreated() {
InternalClientSessionManager.getInstance().ensureSessionCreated();
}
private static OseeSessionGrant getSessionGrant() throws OseeAuthenticationRequiredException {
return InternalClientSessionManager.getInstance().getOseeSessionGrant();
}
public static OseeClientSession getSession() throws OseeAuthenticationRequiredException {
return InternalClientSessionManager.getInstance().getOseeSession();
}
public static String getClientBuildDesignation() throws OseeAuthenticationRequiredException {
return getSessionGrant().getClientBuildDesignation();
}
public static boolean isUserCreationRequired() throws OseeAuthenticationRequiredException {
return getSessionGrant().isCreationRequired();
}
public static void clearUserCreationRequired() throws OseeAuthenticationRequiredException {
getSessionGrant().setCreationRequired(false);
}
public static IUserToken getCurrentUserToken() throws OseeAuthenticationRequiredException {
return getSessionGrant().getUserToken();
}
public static String getSessionId() throws OseeAuthenticationRequiredException {
return getSessionGrant().getSessionId();
}
public static String getDataStoreLoginName() throws OseeAuthenticationRequiredException {
return getSessionGrant().getDatabaseInfo().getDatabaseLoginName();
}
public static String getDataStoreDriver() throws OseeAuthenticationRequiredException {
return getSessionGrant().getDatabaseInfo().getDriver();
}
public static String getDataStoreName() throws OseeAuthenticationRequiredException {
return getSessionGrant().getDatabaseInfo().getDatabaseName();
}
public static String getDataStorePath() throws OseeAuthenticationRequiredException {
return getSessionGrant().getDataStorePath();
}
public static boolean isProductionDataStore() throws OseeAuthenticationRequiredException {
return getSessionGrant().getDatabaseInfo().isProduction();
}
public static String getSql(OseeSql sqlEnum) throws OseeCoreException {
String sql = getSessionGrant().getSqlProperties().getProperty(sqlEnum.toString());
if (sql != null) {
return sql;
}
throw new OseeArgumentException("Invalid sql key [%s]", sqlEnum.toString());
}
public static List<String> getAuthenticationProtocols() {
return InternalClientSessionManager.getInstance().getAuthenticationProtocols();
}
public static void authenticateAsGuest() throws OseeCoreException {
InternalClientSessionManager.getInstance().authenticateAsGuest();
}
public static void authenticate(ICredentialProvider credentialProvider) throws OseeCoreException {
InternalClientSessionManager.getInstance().authenticate(credentialProvider);
}
public static void releaseSession() throws OseeCoreException {
InternalClientSessionManager.getInstance().releaseSession();
OseeApplicationServer.reset();
}
public static String getDatabaseInfo() throws OseeAuthenticationRequiredException {
return getSessionGrant().getDatabaseInfo().toString();
}
public static OseeClientSession getSafeSession() {
return InternalClientSessionManager.getInstance().getSafeSession();
}
}
|