Review Board 1.7.22


SQOOP-1143 Sqoop2: Provide server audit log for operations upon metadata structures

Review Request #12932 - Created July 24, 2013 and submitted

Mengwei Ding
SQOOP-1143
Reviewers
Sqoop
abe, hshreedharan, jarcec
sqoop-sqoop2
commit e1043afccdafc866b376df812f3a6fd7976f777a
Author: Mengwei Ding <mengwei.ding@gmail.com>
Date:   Tue Jul 23 16:51:53 2013 -0700

    SQOOP-1143 Sqoop2: Provide server audit log for operations upon metadata structures

:000000 100644 0000000... 881532d... A	core/src/main/java/org/apache/sqoop/audit/AuditLogger.java
:000000 100644 0000000... d056a34... A	core/src/main/java/org/apache/sqoop/audit/AuditLoggerConstants.java
:000000 100644 0000000... 5999e1c... A	core/src/main/java/org/apache/sqoop/audit/AuditLoggerError.java
:000000 100644 0000000... 17a996f... A	core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java
:000000 100644 0000000... bfc0d62... A	core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java
:100644 100644 90bb327... d4c3b39... M	core/src/main/java/org/apache/sqoop/core/SqoopServer.java
:100755 100755 76596b4... bb01016... M	dist/src/main/server/conf/sqoop.properties
:100644 100644 62be8f4... 875729f... M	server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java
:100644 100644 4c389cc... d1b6b9a... M	server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
:100644 100644 04ffc3c... 616e974... M	server/src/main/java/org/apache/sqoop/handler/FrameworkRequestHandler.java
:100644 100644 0d15329... 59a4511... M	server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
:100644 100644 65686a8... 6d9777a... M	server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
:100644 100644 f92d107... 64c4536... M	server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java
Do some manual test for new functionalities.

Unit test passed.
core/src/main/java/org/apache/sqoop/audit/AuditLogger.java
New File

    
   
1
/**

    
   
2
 * Licensed to the Apache Software Foundation (ASF) under one

    
   
3
 * or more contributor license agreements.  See the NOTICE file

    
   
4
 * distributed with this work for additional information

    
   
5
 * regarding copyright ownership.  The ASF licenses this file

    
   
6
 * to you under the Apache License, Version 2.0 (the

    
   
7
 * "License"); you may not use this file except in compliance

    
   
8
 * with the License.  You may obtain a copy of the License at

    
   
9
 *

    
   
10
 *     http://www.apache.org/licenses/LICENSE-2.0

    
   
11
 *

    
   
12
 * Unless required by applicable law or agreed to in writing, software

    
   
13
 * distributed under the License is distributed on an "AS IS" BASIS,

    
   
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    
   
15
 * See the License for the specific language governing permissions and

    
   
16
 * limitations under the License.

    
   
17
 */

    
   
18
package org.apache.sqoop.audit;

    
   
19

   

    
   
20
import java.util.Map;

    
   
21

   

    
   
22
import org.apache.sqoop.core.SqoopConfiguration;

    
   
23

   

    
   
24
/**

    
   
25
 * Interface to define an audit logger

    
   
26
 */

    
   
27
public abstract class AuditLogger {

    
   
28

   

    
   
29
  /**

    
   
30
   * The name of this logger

    
   
31
   */

    
   
32
  private String loggerName;

    
   
33

   

    
   
34
  /**

    
   
35
   * Initialize the logger

    
   
36
   */

    
   
37
  abstract void initialize();

    
   
38

   

    
   
39
  /**

    
   
40
   * Called to log an audit event

    
   
41
   *

    
   
42
   * @param username Name of the user executing the request.

    
   
43
   * @param ip Remote address of the request.

    
   
44
   * @param operation The type of the event.

    
   
45
   * @param objectType The type of the object to be operated upon.

    
   
46
   * @param objectId The id of the object to be operated upon.

    
   
47
   */

    
   
48
  abstract void logAuditEvent(String username, String ip,

    
   
49
      String operation, String objectType, String objectId);

    
   
50

   

    
   
51
  public String getLoggerName() {

    
   
52
    return loggerName;

    
   
53
  }

    
   
54

   

    
   
55
  public void setLoggerName(String loggerName) {

    
   
56
    this.loggerName = loggerName;

    
   
57
  }

    
   
58

   

    
   
59
  /**

    
   
60
   * Parse out all configurations for current logger

    
   
61
   * @return all configurations

    
   
62
   */

    
   
63
  protected Map<String, String> getLoggerConfig() {

    
   
64
    String prefix = AuditLoggerConstants.PREFIX_AUDITLOGGER_CONFIG + getLoggerName() + ".";

    
   
65
    return SqoopConfiguration.getInstance().getContext().getNestedProperties(prefix);

    
   
66
  }

    
   
67
}
core/src/main/java/org/apache/sqoop/audit/AuditLoggerConstants.java
New File
 
core/src/main/java/org/apache/sqoop/audit/AuditLoggerError.java
New File
 
core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java
New File
 
core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java
New File
 
core/src/main/java/org/apache/sqoop/core/SqoopServer.java
Revision 90bb327 New Change
 
dist/src/main/server/conf/sqoop.properties
Revision 76596b4 New Change
 
server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java
Revision 62be8f4 New Change
 
server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java
Revision 4c389cc New Change
 
server/src/main/java/org/apache/sqoop/handler/FrameworkRequestHandler.java
Revision 04ffc3c New Change
 
server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java
Revision 0d15329 New Change
 
server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java
Revision 65686a8 New Change
 
server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java
Revision f92d107 New Change
 
  1. core/src/main/java/org/apache/sqoop/audit/AuditLogger.java: Loading...
  2. core/src/main/java/org/apache/sqoop/audit/AuditLoggerConstants.java: Loading...
  3. core/src/main/java/org/apache/sqoop/audit/AuditLoggerError.java: Loading...
  4. core/src/main/java/org/apache/sqoop/audit/AuditLoggerManager.java: Loading...
  5. core/src/main/java/org/apache/sqoop/audit/FileAuditLogger.java: Loading...
  6. core/src/main/java/org/apache/sqoop/core/SqoopServer.java: Loading...
  7. dist/src/main/server/conf/sqoop.properties: Loading...
  8. server/src/main/java/org/apache/sqoop/handler/ConnectionRequestHandler.java: Loading...
  9. server/src/main/java/org/apache/sqoop/handler/ConnectorRequestHandler.java: Loading...
  10. server/src/main/java/org/apache/sqoop/handler/FrameworkRequestHandler.java: Loading...
  11. server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java: Loading...
  12. server/src/main/java/org/apache/sqoop/handler/SubmissionRequestHandler.java: Loading...
  13. server/src/main/java/org/apache/sqoop/handler/VersionRequestHandler.java: Loading...