com.eg.agent.android.EGAgent Maven / Gradle / Ivy
The newest version!
package com.eg.agent.android;
import com.eg.agent.android.common.Data;
import com.eg.agent.android.connectivity.Facade;
import com.eg.agent.android.logging.EGAgentLog;
import com.eg.agent.android.logging.EGAgentLogManager;
import com.eg.agent.android.util.EncodInterface;
import com.eg.agent.android.util.Error;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* Created by Venkateswari.J on 4/24/2017.
*/
public final class EGAgent {
private static final String VERSION = "2.1.3";
private static final MetricsInterface NULL_AGENT_IMPL = new BaseAgent();
private static Object implLock = new Object();
private static MetricsInterface impl;
static EGAgentLog agentLog = EGAgentLogManager.getAgentLog();
static {
impl = NULL_AGENT_IMPL;
}
public EGAgent() {
}
public static void setImpl(MetricsInterface impl) {
agentLog.debug("EGAgent:setImpl:impl::"+impl);
Object var1 = implLock;
synchronized (implLock) {
if (impl == null) {
EGAgent.impl = NULL_AGENT_IMPL;
} else {
EGAgent.impl = impl;
}
}
agentLog.debug("EGAgent:setImpl:EGAgent.impl::"+EGAgent.impl);
}
public static MetricsInterface getImpl() {
MetricsInterface agentImpl;
synchronized (implLock) {
if (impl == null) {
setImpl(NULL_AGENT_IMPL);
}
agentImpl = impl;
}
return agentImpl;
}
public static String getVersion() {
return "1.0";
}
public static String getCrossProcessId() {
return getImpl().getCrossProcessId();
}
public static int getStackTraceLimit() {
return getImpl().getStackTraceLimit();
}
public static int getResponseBodyLimit() {
return getImpl().getResponseBodyLimit();
}
public static void addTransactionData(Data transactionData) {
getImpl().addTransactionData(transactionData);
}
public static List getAndClearTransactionData() {
return getImpl().getAndClearTransactionData();
}
public static void mergeTransactionData(List transactionDataList) {
getImpl().mergeTransactionData(transactionDataList);
}
public static void addErrorData(Error errorData) {
getImpl().addErrorData(errorData);
}
public static List getAndClearErrorData() {
return getImpl().getAndClearErrorData();
}
public static void mergeErrorData(List errorDataList) {
getImpl().mergeErrorData(errorDataList);
}
public static String getActiveNetworkCarrier() {
return getImpl().getNetworkCarrier();
}
public static void disable() {
getImpl().disable();
}
public static boolean isDisabled() {
return getImpl().isDisabled();
}
public static boolean waitForConnect(long time, TimeUnit unit) throws InterruptedException {
return getImpl().waitForConnect(time, unit);
}
public static boolean waitForHarvest(long time, TimeUnit unit) throws InterruptedException {
return getImpl().waitForHarvest(time, unit);
}
public static void start() {
getImpl().start();
}
public static void stop() {
getImpl().stop();
}
public static void setLocation(String countryCode, String adminRegion) {
getImpl().setLocation(countryCode, adminRegion);
}
public static EncodInterface getEncoder() {
return getImpl().getEncoder();
}
public static Facade getCatFacade() {
return getImpl().getCatFacade();
}
public static String getActiveNetworkWanType() {
return getImpl().getNetworkWanType();
}
public static DeviceData getDeviceInformation() {
return getImpl().getDeviceInformation();
}
public static ApplicationData getApplicationInformation() {
return getImpl().getApplicationInformation();
}
}