Skip to content

Commit

Permalink
Merge pull request #1356 from ashitsalesforce/master
Browse files Browse the repository at this point in the history
code refactoring
  • Loading branch information
ashitsalesforce authored Oct 22, 2024
2 parents e1c0959 + 32fff55 commit 932e5a1
Show file tree
Hide file tree
Showing 73 changed files with 260 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.List;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;

import com.salesforce.dataloader.action.progress.ILoaderProgress;
import com.salesforce.dataloader.action.visitor.IVisitor;
Expand Down Expand Up @@ -76,7 +76,7 @@ abstract class AbstractAction implements IAction {

protected AbstractAction(Controller controller, ILoaderProgress monitor)
throws DataAccessObjectInitializationException {
this.logger = LogManager.getLogger(getClass());
this.logger = DLLogManager.getLogger(getClass());
this.monitor = monitor;
this.controller = controller;
checkDao(getController().getDao());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
package com.salesforce.dataloader.action;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;

import org.eclipse.jface.resource.ImageDescriptor;

Expand Down Expand Up @@ -57,7 +57,7 @@ public enum OperationInfo {
public static final OperationInfo[] ALL_OPERATIONS_IN_ORDER =
{ insert, update, upsert, delete, undelete, hard_delete, extract, extract_all };

private static final Logger logger = LogManager.getLogger(OperationInfo.class);
private static final Logger logger = DLLogManager.getLogger(OperationInfo.class);

private final Class<? extends IAction> partnerAPIActionClass;
private final Class<? extends IAction> bulkAPIActionClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
package com.salesforce.dataloader.action;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.ImageDescriptor;
Expand Down Expand Up @@ -68,7 +68,7 @@ public enum OperationInfoUIHelper {
public static final OperationInfoUIHelper[] ALL_OPERATIONS_IN_ORDER = { insert, update, upsert, delete, hard_delete,
extract, extract_all };

private static final Logger logger = LogManager.getLogger(OperationInfoUIHelper.class);
private static final Logger logger = DLLogManager.getLogger(OperationInfoUIHelper.class);

private final Class<? extends Wizard> wizardClass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@
import java.util.Collections;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.salesforce.dataloader.util.DLLogManager;

public class NihilistProgressAdapter implements ILoaderProgress {
private String message;
private boolean success = false;
private int numRowsWithError = 0;
private int numberBatchesTotal = 0;
private final Logger logger = LogManager.getLogger(getClass());
private final Logger logger = DLLogManager.getLogger(getClass());
private int workDone;
private int totalWork;
private final List<String> subTasksInOrder = new ArrayList<String>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

/**
Expand All @@ -73,7 +73,7 @@ public abstract class AbstractQueryVisitor extends AbstractVisitor implements IQ
private final List<String> batchIds;
private final int batchSize;
protected final AbstractExtractAction action;
private static final Logger logger = LogManager.getLogger(AbstractQueryVisitor.class);
private static final Logger logger = DLLogManager.getLogger(AbstractQueryVisitor.class);

public AbstractQueryVisitor(AbstractExtractAction action, Controller controller, ILoaderProgress monitor, DataWriter queryWriter,
DataWriter successWriter, DataWriter errorWriter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.io.InputStream;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;

public abstract class AbstractVisitor implements IVisitor {

Expand All @@ -55,7 +55,7 @@ public abstract class AbstractVisitor implements IVisitor {

public AbstractVisitor(Controller controller, ILoaderProgress monitor, DataWriter successWriter,
DataWriter errorWriter) {
this.logger = LogManager.getLogger(getClass());
this.logger = DLLogManager.getLogger(getClass());
this.controller = controller;
this.monitor = monitor;
this.successWriter = successWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import org.apache.commons.beanutils.*;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import java.util.regex.Matcher;
Expand Down Expand Up @@ -83,7 +83,7 @@ public abstract class DAOLoadVisitor extends AbstractVisitor implements DAORowVi
protected List<Row> daoRowList = new ArrayList<Row>();
protected ArrayList<Integer> batchRowToDAORowList = new ArrayList<Integer>();
private int processedDAORowCounter = 0;
private static final Logger logger = LogManager.getLogger(DAOLoadVisitor.class);
private static final Logger logger = DLLogManager.getLogger(DAOLoadVisitor.class);
// following regex pattern is based on info from:
// - https://www.regular-expressions.info/lookaround.html
// - https://www.geeksforgeeks.org/how-to-validate-html-tag-using-regular-expression/#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.util.Map;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

import com.salesforce.dataloader.action.progress.ILoaderProgress;
import com.salesforce.dataloader.config.AppConfig;
Expand All @@ -44,6 +43,7 @@
import com.salesforce.dataloader.exception.ExtractException;
import com.salesforce.dataloader.exception.ExtractExceptionOnServer;
import com.salesforce.dataloader.exception.ParameterLoadException;
import com.salesforce.dataloader.util.DLLogManager;
import com.salesforce.dataloader.util.LoadRateCalculator;
import com.sforce.async.AsyncApiException;
import com.sforce.async.BatchInfo;
Expand All @@ -59,7 +59,7 @@

class BulkApiVisitorUtil {

private static final Logger logger = LogManager.getLogger(BulkApiVisitorUtil.class);
private static final Logger logger = DLLogManager.getLogger(BulkApiVisitorUtil.class);

private final BulkConnection connection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaProperty;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;

import com.salesforce.dataloader.action.progress.ILoaderProgress;
import com.salesforce.dataloader.action.visitor.DAOLoadVisitor;
Expand Down Expand Up @@ -87,7 +87,7 @@
*/
public class BulkLoadVisitor extends DAOLoadVisitor {

private static final Logger logger = LogManager.getLogger(BulkLoadVisitor.class);
private static final Logger logger = DLLogManager.getLogger(BulkLoadVisitor.class);

private static final String SUCCESS_RESULT_COL = "Success";
private static final String ERROR_RESULT_COL = "Error";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import com.salesforce.dataloader.client.ClientBase;
Expand All @@ -47,13 +47,12 @@
import com.sforce.async.ContentType;
import com.sforce.async.JobInfo;
import com.sforce.async.QueryResultList;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
import com.sforce.ws.parser.PullParserException;
import com.sforce.ws.parser.XmlInputStream;

public class BulkV1Connection extends BulkConnection {
private static Logger logger = LogManager.getLogger(BulkV1Connection.class);
private static Logger logger = DLLogManager.getLogger(BulkV1Connection.class);

public BulkV1Connection(ConnectorConfig config) throws AsyncApiException {
super(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private static void writeTo(BufferedInputStream bis, BufferedOutputStream bos) t

import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import com.salesforce.dataloader.client.ClientBase;
Expand Down Expand Up @@ -193,7 +193,7 @@ public class BulkV2Connection extends BulkConnection {
private HashMap<String, String> headers = new HashMap<String, String>();
private Controller controller = null;

private static Logger logger = LogManager.getLogger(BulkV2Connection.class);
private static Logger logger = DLLogManager.getLogger(BulkV2Connection.class);

/**********************************
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.text.SimpleDateFormat;
import java.util.*;

import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import com.salesforce.dataloader.action.progress.ILoaderProgress;
Expand Down Expand Up @@ -64,7 +64,7 @@ public class PartnerQueryVisitor extends AbstractQueryVisitor {
public PartnerQueryVisitor(AbstractExtractAction action, Controller controller, ILoaderProgress monitor, DataWriter queryWriter,
DataWriter successWriter, DataWriter errorWriter) {
super(action, controller, monitor, queryWriter, successWriter, errorWriter);
this.logger = LogManager.getLogger(getClass());
this.logger = DLLogManager.getLogger(getClass());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import com.fasterxml.jackson.core.JsonProcessingException;
Expand All @@ -61,7 +61,7 @@
public class RESTConnection {
private ConnectorConfig connectorConfig;
private Controller controller;
private static Logger logger = LogManager.getLogger(RESTConnection.class);
private static Logger logger = DLLogManager.getLogger(RESTConnection.class);

public RESTConnection(ConnectorConfig config, Controller controller) throws AsyncApiException {
this.connectorConfig = config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
package com.salesforce.dataloader.client;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;

import com.salesforce.dataloader.action.visitor.bulk.BulkV1Connection;
import com.salesforce.dataloader.config.Messages;
Expand All @@ -42,7 +42,7 @@
* @since 17.0
*/
public class BulkV1Client extends RESTClient<BulkV1Connection> {
private static Logger LOG = LogManager.getLogger(BulkV1Client.class);
private static Logger LOG = DLLogManager.getLogger(BulkV1Client.class);

public BulkV1Client(Controller controller) {
super(controller, LOG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
package com.salesforce.dataloader.client;

import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import com.salesforce.dataloader.action.visitor.bulk.BulkV2Connection;
Expand All @@ -35,7 +35,7 @@
import com.sforce.ws.ConnectorConfig;

public class BulkV2Client extends RESTClient<BulkV2Connection> {
private static Logger LOG = LogManager.getLogger(BulkV2Client.class);
private static Logger LOG = DLLogManager.getLogger(BulkV2Client.class);

public BulkV2Client(Controller controller) {
super(controller, LOG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.List;

import org.apache.commons.beanutils.DynaBean;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import com.salesforce.dataloader.action.visitor.rest.RESTConnection;
Expand All @@ -41,7 +41,7 @@

public class CompositeRESTClient extends RESTClient<RESTConnection> {
public static enum ACTION_ENUM {UPDATE, DELETE};
private static Logger LOG = LogManager.getLogger(BulkV2Client.class);
private static Logger LOG = DLLogManager.getLogger(BulkV2Client.class);

public CompositeRESTClient(Controller controller) {
super(controller, LOG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.ProxyAuthenticationStrategy;
import org.apache.http.message.BasicNameValuePair;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

/**
Expand All @@ -95,7 +95,7 @@ public class HttpClientTransport implements HttpTransportInterface {
private ByteArrayOutputStream entityByteOut;
private static CloseableHttpClient currentHttpClient = null;
private static long serverInvocationCount = 0;
private static Logger logger = LogManager.getLogger(HttpClientTransport.class);
private static Logger logger = DLLogManager.getLogger(HttpClientTransport.class);
private HttpResponse httpResponse;
private static final HttpClientTransport singletonTransportInstance = new HttpClientTransport();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

/**
Expand All @@ -92,7 +92,7 @@ public class HttpClientTransportv1 implements HttpTransportInterfacev1 {
private static CloseableHttpClient currentHttpClient = null;
private static boolean reuseConnection = true;
private static long serverInvocationCount = 0;
private static Logger logger = LogManager.getLogger(HttpClientTransport.class);
private static Logger logger = DLLogManager.getLogger(HttpClientTransport.class);

public HttpClientTransportv1() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@

import org.apache.commons.beanutils.DynaBean;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;

import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
Expand All @@ -87,7 +87,7 @@

public class PartnerClient extends ClientBase<PartnerConnection> {

private static Logger LOG = LogManager.getLogger(PartnerClient.class);
private static Logger LOG = DLLogManager.getLogger(PartnerClient.class);

private ConnectorConfig connectorConfig = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.Map;
import java.util.Set;

import org.apache.logging.log4j.LogManager;
import com.salesforce.dataloader.util.DLLogManager;
import org.apache.logging.log4j.Logger;

import com.salesforce.dataloader.dyna.ParentIdLookupFieldFormatter;
Expand All @@ -44,7 +44,7 @@
public class ReferenceEntitiesDescribeMap {

private Map<String, DescribeRefObject> referenceEntitiesDescribeMap = new HashMap<String, DescribeRefObject>();
private static final Logger logger = LogManager.getLogger(ReferenceEntitiesDescribeMap.class);
private static final Logger logger = DLLogManager.getLogger(ReferenceEntitiesDescribeMap.class);
private PartnerClient client = null;
/**
*
Expand Down
Loading

0 comments on commit 932e5a1

Please sign in to comment.