5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-08 04:11:09 +08:00

SQOOP-2710. Sqoop2: Move user from context classes to parent TransferableContext

(Jarcec via Hari)
This commit is contained in:
Hari Shreedharan 2015-12-02 12:04:58 -08:00
parent cde1c3ac9e
commit e2fc4a75e8
6 changed files with 16 additions and 65 deletions

View File

@ -35,13 +35,10 @@ public class DestroyerContext extends TransferableContext {
private Schema schema;
private String user;
public DestroyerContext(ImmutableContext context, boolean success, Schema schema, String user) {
super(context);
super(context, user);
this.success = success;
this.schema = schema;
this.user = user;
}
/**
@ -62,12 +59,4 @@ public Schema getSchema() {
return schema;
}
/**
* Return user associated with this step.
*
* @return
*/
public String getUser() {
return user;
}
}

View File

@ -36,13 +36,10 @@ public class ExtractorContext extends TransferableContext {
private final Schema schema;
private final String user;
public ExtractorContext(ImmutableContext context, DataWriter writer, Schema schema, String user) {
super(context);
super(context, user);
this.writer = writer;
this.schema = schema;
this.user = user;
}
/**
@ -61,13 +58,4 @@ public DataWriter getDataWriter() {
public Schema getSchema() {
return schema;
}
/**
* Return the user
*
* @return
*/
public String getUser() {
return user;
}
}

View File

@ -31,11 +31,8 @@
@InterfaceStability.Unstable
public class InitializerContext extends TransferableContext {
private String user;
public InitializerContext(MutableContext context, String user) {
super(context);
this.user = user;
super(context, user);
}
/**
@ -51,12 +48,4 @@ public MutableContext getContext() {
return (MutableContext)super.getContext();
}
/**
* Return the user
*
* @return
*/
public String getUser() {
return user;
}
}

View File

@ -36,13 +36,10 @@ public class LoaderContext extends TransferableContext {
private final Schema schema;
private final String user;
public LoaderContext(ImmutableContext context, DataReader reader, Schema schema, String user) {
super(context);
super(context, user);
this.reader = reader;
this.schema = schema;
this.user = user;
}
/**
@ -62,14 +59,4 @@ public DataReader getDataReader() {
public Schema getSchema() {
return schema;
}
/**
* Return the String representing the user.
*
* @return
*/
public String getUser() {
return user;
}
}

View File

@ -37,13 +37,10 @@ public class PartitionerContext extends TransferableContext {
private boolean skipMaxPartitionCheck = false;
private String user;
public PartitionerContext(ImmutableContext context, long maxPartitions, Schema schema, String user) {
super(context);
super(context, user);
this.maxPartitions = maxPartitions;
this.schema = schema;
this.user = user;
}
/**
@ -92,13 +89,4 @@ public boolean getSkipMaxPartitionCheck() {
public Schema getSchema() {
return schema;
}
/**
* Return user that submitted job
*
* @return
*/
public String getUser() {
return user;
}
}

View File

@ -30,8 +30,11 @@ public abstract class TransferableContext {
ImmutableContext context;
public TransferableContext(ImmutableContext context) {
private String user;
public TransferableContext(ImmutableContext context, String user) {
this.context = context;
this.user = user;
}
/**
@ -77,4 +80,11 @@ public int getInt(String key, int defaultValue) {
public boolean getBoolean(String key, boolean defaultValue) {
return context.getBoolean(key, defaultValue);
}
/**
* Return user who started this job (e.g. the one who run "start job" in shell)
*/
public String getUser() {
return user;
}
}