1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.audit;
16  
17  import com.liferay.portal.kernel.util.AutoResetThreadLocal;
18  
19  /**
20   * <a href="AuditRequestThreadLocal.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Michael C. Han
23   */
24  public class AuditRequestThreadLocal {
25  
26      public static AuditRequestThreadLocal getAuditThreadLocal() {
27          AuditRequestThreadLocal auditRequestThreadLocal =
28              _auditRequestThreadLocal.get();
29  
30          if (auditRequestThreadLocal == null) {
31              auditRequestThreadLocal = new AuditRequestThreadLocal();
32  
33              _auditRequestThreadLocal.set(auditRequestThreadLocal);
34          }
35  
36          return auditRequestThreadLocal;
37      }
38  
39      public static void removeAuditThreadLocal() {
40          _auditRequestThreadLocal.remove();
41      }
42  
43      public String getClientHost() {
44          return _clientHost;
45      }
46  
47      public String getClientIP() {
48          return _clientIP;
49      }
50  
51      public String getQueryString() {
52          return _queryString;
53      }
54  
55      public long getRealUserId() {
56          return _realUserId;
57      }
58  
59      public String getRequestURL() {
60          return _requestURL;
61      }
62  
63      public String getServerName() {
64          return _serverName;
65      }
66  
67      public int getServerPort() {
68          return _serverPort;
69      }
70  
71      public String getSessionID() {
72          return _sessionID;
73      }
74  
75      public void setClientHost(String clientHost) {
76          _clientHost = clientHost;
77      }
78  
79      public void setClientIP(String clientIP) {
80          _clientIP = clientIP;
81      }
82  
83      public void setQueryString(String queryString) {
84          _queryString = queryString;
85      }
86  
87      public void setRealUserId(long realUserId) {
88          _realUserId = realUserId;
89      }
90  
91      public void setRequestURL(String requestURL) {
92          _requestURL = requestURL;
93      }
94  
95      public void setServerName(String serverName) {
96          _serverName = serverName;
97      }
98  
99      public void setServerPort(int serverPort) {
100         _serverPort = serverPort;
101     }
102 
103     public void setSessionID(String sessionID) {
104         _sessionID = sessionID;
105     }
106 
107     private static ThreadLocal<AuditRequestThreadLocal>
108         _auditRequestThreadLocal =
109             new AutoResetThreadLocal<AuditRequestThreadLocal>();
110 
111     private String _clientHost;
112     private String _clientIP;
113     private String _queryString;
114     private long _realUserId;
115     private String _requestURL;
116     private String _serverName;
117     private int _serverPort;
118     private String _sessionID;
119 
120 }