Commit 40e639ed by apoorvnaik Committed by Madhan Neethiraj

ATLAS-1407: improve LOG statement performance

parent 3725dcf1
...@@ -112,7 +112,7 @@ public class AtlasService implements FalconService, ConfigurationChangeListener ...@@ -112,7 +112,7 @@ public class AtlasService implements FalconService, ConfigurationChangeListener
@Override @Override
public void onAdd(Entity entity) throws FalconException { public void onAdd(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onAdd(" + entity + ")"); LOG.debug("==> AtlasService.onAdd({})", entity);
} }
try { try {
...@@ -123,14 +123,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener ...@@ -123,14 +123,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onAdd(" + entity + ")"); LOG.debug("<== AtlasService.onAdd({})", entity);
} }
} }
@Override @Override
public void onRemove(Entity entity) throws FalconException { public void onRemove(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onRemove(" + entity + ")"); LOG.debug("==> AtlasService.onRemove({})", entity);
} }
try { try {
...@@ -141,14 +141,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener ...@@ -141,14 +141,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onRemove(" + entity + ")"); LOG.debug("<== AtlasService.onRemove({})", entity);
} }
} }
@Override @Override
public void onChange(Entity entity, Entity entity1) throws FalconException { public void onChange(Entity entity, Entity entity1) throws FalconException {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onChange(" + entity + ", " + entity1 + ")"); LOG.debug("==> AtlasService.onChange({}, {})", entity, entity1);
} }
try { try {
...@@ -159,14 +159,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener ...@@ -159,14 +159,14 @@ public class AtlasService implements FalconService, ConfigurationChangeListener
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onChange(" + entity + ", " + entity1 + ")"); LOG.debug("<== AtlasService.onChange({}, {})", entity, entity1);
} }
} }
@Override @Override
public void onReload(Entity entity) throws FalconException { public void onReload(Entity entity) throws FalconException {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasService.onReload(" + entity + ")"); LOG.debug("==> AtlasService.onReload({})", entity);
} }
try { try {
...@@ -177,7 +177,7 @@ public class AtlasService implements FalconService, ConfigurationChangeListener ...@@ -177,7 +177,7 @@ public class AtlasService implements FalconService, ConfigurationChangeListener
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasService.onReload(" + entity + ")"); LOG.debug("<== AtlasService.onReload({})", entity);
} }
} }
......
...@@ -142,7 +142,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher { ...@@ -142,7 +142,7 @@ public class FalconHook extends AtlasHook implements FalconEventPublisher {
}); });
} }
} catch (Throwable t) { } catch (Throwable t) {
LOG.warn("Error in processing data " + data, t); LOG.warn("Error in processing data {}", data, t);
} }
} }
......
...@@ -343,7 +343,7 @@ public class FalconHookIT { ...@@ -343,7 +343,7 @@ public class FalconHookIT {
if (System.currentTimeMillis() >= mustEnd) { if (System.currentTimeMillis() >= mustEnd) {
fail("Assertions failed. Failing after waiting for timeout " + timeout + " msecs", e); fail("Assertions failed. Failing after waiting for timeout " + timeout + " msecs", e);
} }
LOG.debug("Waiting up to " + (mustEnd - System.currentTimeMillis()) + " msec as assertion failed", e); LOG.debug("Waiting up to {} msec as assertion failed", mustEnd - System.currentTimeMillis(), e);
Thread.sleep(400); Thread.sleep(400);
} }
} }
......
...@@ -44,7 +44,7 @@ public class HiveHook implements ExecuteWithHookContext { ...@@ -44,7 +44,7 @@ public class HiveHook implements ExecuteWithHookContext {
@Override @Override
public void run(final HookContext hookContext) throws Exception { public void run(final HookContext hookContext) throws Exception {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> HiveHook.run(" + hookContext + ")"); LOG.debug("==> HiveHook.run({})", hookContext);
} }
try { try {
...@@ -55,7 +55,7 @@ public class HiveHook implements ExecuteWithHookContext { ...@@ -55,7 +55,7 @@ public class HiveHook implements ExecuteWithHookContext {
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== HiveHook.run(" + hookContext + ")"); LOG.debug("<== HiveHook.run({})", hookContext);
} }
} }
......
...@@ -179,7 +179,7 @@ public class HiveMetaStoreBridge { ...@@ -179,7 +179,7 @@ public class HiveMetaStoreBridge {
} }
private Referenceable createOrUpdateDBInstance(Database hiveDB, Referenceable dbRef) { private Referenceable createOrUpdateDBInstance(Database hiveDB, Referenceable dbRef) {
LOG.info("Importing objects from databaseName : " + hiveDB.getName()); LOG.info("Importing objects from databaseName : {}", hiveDB.getName());
if (dbRef == null) { if (dbRef == null) {
dbRef = new Referenceable(HiveDataTypes.HIVE_DB.getName()); dbRef = new Referenceable(HiveDataTypes.HIVE_DB.getName());
...@@ -206,12 +206,12 @@ public class HiveMetaStoreBridge { ...@@ -206,12 +206,12 @@ public class HiveMetaStoreBridge {
*/ */
private Referenceable registerInstance(Referenceable referenceable) throws Exception { private Referenceable registerInstance(Referenceable referenceable) throws Exception {
String typeName = referenceable.getTypeName(); String typeName = referenceable.getTypeName();
LOG.debug("creating instance of type " + typeName); LOG.debug("creating instance of type {}", typeName);
String entityJSON = InstanceSerialization.toJson(referenceable, true); String entityJSON = InstanceSerialization.toJson(referenceable, true);
LOG.debug("Submitting new entity {} = {}", referenceable.getTypeName(), entityJSON); LOG.debug("Submitting new entity {} = {}", referenceable.getTypeName(), entityJSON);
List<String> guids = getAtlasClient().createEntity(entityJSON); List<String> guids = getAtlasClient().createEntity(entityJSON);
LOG.debug("created instance for type " + typeName + ", guid: " + guids); LOG.debug("created instance for type {}, guid: {}", typeName, guids);
return new Referenceable(guids.get(guids.size() - 1), referenceable.getTypeName(), null); return new Referenceable(guids.get(guids.size() - 1), referenceable.getTypeName(), null);
} }
...@@ -497,9 +497,9 @@ public class HiveMetaStoreBridge { ...@@ -497,9 +497,9 @@ public class HiveMetaStoreBridge {
private Referenceable registerTable(Referenceable dbReference, Table table) throws Exception { private Referenceable registerTable(Referenceable dbReference, Table table) throws Exception {
String dbName = table.getDbName(); String dbName = table.getDbName();
String tableName = table.getTableName(); String tableName = table.getTableName();
LOG.info("Attempting to register table [" + tableName + "]"); LOG.info("Attempting to register table [{}]", tableName);
Referenceable tableReference = getTableReference(table); Referenceable tableReference = getTableReference(table);
LOG.info("Found result " + tableReference); LOG.info("Found result {}", tableReference);
if (tableReference == null) { if (tableReference == null) {
tableReference = createTableInstance(dbReference, table); tableReference = createTableInstance(dbReference, table);
tableReference = registerInstance(tableReference); tableReference = registerInstance(tableReference);
...@@ -514,7 +514,7 @@ public class HiveMetaStoreBridge { ...@@ -514,7 +514,7 @@ public class HiveMetaStoreBridge {
private void updateInstance(Referenceable referenceable) throws AtlasServiceException { private void updateInstance(Referenceable referenceable) throws AtlasServiceException {
String typeName = referenceable.getTypeName(); String typeName = referenceable.getTypeName();
LOG.debug("updating instance of type " + typeName); LOG.debug("updating instance of type {}", typeName);
String entityJSON = InstanceSerialization.toJson(referenceable, true); String entityJSON = InstanceSerialization.toJson(referenceable, true);
LOG.debug("Updating entity {} = {}", referenceable.getTypeName(), entityJSON); LOG.debug("Updating entity {} = {}", referenceable.getTypeName(), entityJSON);
...@@ -524,13 +524,13 @@ public class HiveMetaStoreBridge { ...@@ -524,13 +524,13 @@ public class HiveMetaStoreBridge {
public Referenceable fillStorageDesc(StorageDescriptor storageDesc, String tableQualifiedName, public Referenceable fillStorageDesc(StorageDescriptor storageDesc, String tableQualifiedName,
String sdQualifiedName, Id tableId) throws Exception { String sdQualifiedName, Id tableId) throws Exception {
LOG.debug("Filling storage descriptor information for " + storageDesc); LOG.debug("Filling storage descriptor information for {}", storageDesc);
Referenceable sdReferenceable = new Referenceable(HiveDataTypes.HIVE_STORAGEDESC.getName()); Referenceable sdReferenceable = new Referenceable(HiveDataTypes.HIVE_STORAGEDESC.getName());
sdReferenceable.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, sdQualifiedName); sdReferenceable.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, sdQualifiedName);
SerDeInfo serdeInfo = storageDesc.getSerdeInfo(); SerDeInfo serdeInfo = storageDesc.getSerdeInfo();
LOG.debug("serdeInfo = " + serdeInfo); LOG.debug("serdeInfo = {}", serdeInfo);
// SkewedInfo skewedInfo = storageDesc.getSkewedInfo(); // SkewedInfo skewedInfo = storageDesc.getSkewedInfo();
String serdeInfoName = HiveDataTypes.HIVE_SERDE.getName(); String serdeInfoName = HiveDataTypes.HIVE_SERDE.getName();
...@@ -594,7 +594,7 @@ public class HiveMetaStoreBridge { ...@@ -594,7 +594,7 @@ public class HiveMetaStoreBridge {
List<Referenceable> colList = new ArrayList<>(); List<Referenceable> colList = new ArrayList<>();
int columnPosition = 0; int columnPosition = 0;
for (FieldSchema fs : schemaList) { for (FieldSchema fs : schemaList) {
LOG.debug("Processing field " + fs); LOG.debug("Processing field {}", fs);
Referenceable colReferenceable = new Referenceable(HiveDataTypes.HIVE_COLUMN.getName()); Referenceable colReferenceable = new Referenceable(HiveDataTypes.HIVE_COLUMN.getName());
colReferenceable.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, colReferenceable.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
getColumnQualifiedName((String) tableReference.get(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME), fs.getName())); getColumnQualifiedName((String) tableReference.get(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME), fs.getName()));
......
...@@ -201,7 +201,7 @@ public class HiveITBase { ...@@ -201,7 +201,7 @@ public class HiveITBase {
if (System.currentTimeMillis() >= mustEnd) { if (System.currentTimeMillis() >= mustEnd) {
fail("Assertions failed. Failing after waiting for timeout " + timeout + " msecs", e); fail("Assertions failed. Failing after waiting for timeout " + timeout + " msecs", e);
} }
LOG.debug("Waiting up to " + (mustEnd - System.currentTimeMillis()) + " msec as assertion failed", e); LOG.debug("Waiting up to {} msec as assertion failed", mustEnd - System.currentTimeMillis(), e);
Thread.sleep(5000); Thread.sleep(5000);
} }
} }
......
...@@ -43,7 +43,7 @@ public class SqoopHook extends SqoopJobDataPublisher { ...@@ -43,7 +43,7 @@ public class SqoopHook extends SqoopJobDataPublisher {
@Override @Override
public void publish(SqoopJobDataPublisher.Data data) throws Exception { public void publish(SqoopJobDataPublisher.Data data) throws Exception {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> SqoopHook.run(" + data + ")"); LOG.debug("==> SqoopHook.run({})", data);
} }
try { try {
...@@ -54,7 +54,7 @@ public class SqoopHook extends SqoopJobDataPublisher { ...@@ -54,7 +54,7 @@ public class SqoopHook extends SqoopJobDataPublisher {
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== SqoopHook.run(" + data + ")"); LOG.debug("<== SqoopHook.run({})", data);
} }
} }
......
...@@ -49,7 +49,7 @@ public class StormAtlasHook implements ISubmitterHook { ...@@ -49,7 +49,7 @@ public class StormAtlasHook implements ISubmitterHook {
public void notify(TopologyInfo topologyInfo, Map stormConf, StormTopology stormTopology) public void notify(TopologyInfo topologyInfo, Map stormConf, StormTopology stormTopology)
throws IllegalAccessException { throws IllegalAccessException {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> StormAtlasHook.notify(" + topologyInfo + ", " + stormConf + ", " + stormTopology + ")"); LOG.debug("==> StormAtlasHook.notify({}, {}, {})", topologyInfo, stormConf, stormTopology);
} }
try { try {
...@@ -60,7 +60,7 @@ public class StormAtlasHook implements ISubmitterHook { ...@@ -60,7 +60,7 @@ public class StormAtlasHook implements ISubmitterHook {
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== StormAtlasHook.notify(" + topologyInfo + ", " + stormConf + ", " + stormTopology + ")"); LOG.debug("<== StormAtlasHook.notify({}, {}, {})", topologyInfo, stormConf, stormTopology);
} }
} }
......
...@@ -62,7 +62,7 @@ public class AtlasAuthorizerFactory { ...@@ -62,7 +62,7 @@ public class AtlasAuthorizerFactory {
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Initializing Authorizer :: " + authorizerClass); LOG.debug("Initializing Authorizer :: {}", authorizerClass);
} }
try { try {
Class authorizerMetaObject = Class.forName(authorizerClass); Class authorizerMetaObject = Class.forName(authorizerClass);
...@@ -70,7 +70,7 @@ public class AtlasAuthorizerFactory { ...@@ -70,7 +70,7 @@ public class AtlasAuthorizerFactory {
INSTANCE = (AtlasAuthorizer) authorizerMetaObject.newInstance(); INSTANCE = (AtlasAuthorizer) authorizerMetaObject.newInstance();
} }
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error while creating authorizer of type '" + authorizerClass + "'", e); LOG.error("Error while creating authorizer of type '{}", authorizerClass, e);
throw new AtlasAuthorizationException("Error while creating authorizer of type '" throw new AtlasAuthorizationException("Error while creating authorizer of type '"
+ authorizerClass + "'", e); + authorizerClass + "'", e);
} }
......
...@@ -36,7 +36,7 @@ public class AtlasAuthorizationUtils { ...@@ -36,7 +36,7 @@ public class AtlasAuthorizationUtils {
public static String getApi(String contextPath) { public static String getApi(String contextPath) {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("==> getApi from " + contextPath); LOG.debug("==> getApi from {}", contextPath);
} }
if (contextPath.startsWith(BASE_URL)) { if (contextPath.startsWith(BASE_URL)) {
contextPath = contextPath.substring(BASE_URL.length()); contextPath = contextPath.substring(BASE_URL.length());
...@@ -74,14 +74,14 @@ public class AtlasAuthorizationUtils { ...@@ -74,14 +74,14 @@ public class AtlasAuthorizationUtils {
break; break;
default: default:
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("getAtlasAction(): Invalid HTTP method '" + method + "'"); LOG.debug("getAtlasAction(): Invalid HTTP method '{}", method);
} }
break; break;
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("<== AtlasAuthorizationFilter getAtlasAction HTTP Method " + method + " mapped to AtlasAction : " LOG.debug("<== AtlasAuthorizationFilter getAtlasAction HTTP Method {} mapped to AtlasAction : {}",
+ action); method, action);
} }
return action; return action;
} }
...@@ -96,15 +96,15 @@ public class AtlasAuthorizationUtils { ...@@ -96,15 +96,15 @@ public class AtlasAuthorizationUtils {
* entities,lineage and discovery apis are mapped with AtlasResourceTypes.ENTITY eg :- /api/atlas/lineage/hive/table/* * entities,lineage and discovery apis are mapped with AtlasResourceTypes.ENTITY eg :- /api/atlas/lineage/hive/table/*
* /api/atlas/entities/{guid}* /api/atlas/discovery/* * /api/atlas/entities/{guid}* /api/atlas/discovery/*
* *
* taxonomy API are also mapped to AtlasResourceTypes.TAXONOMY & AtlasResourceTypes.ENTITY and its terms APIs have * taxonomy API are also mapped to AtlasResourceTypes.TAXONOMY & AtlasResourceTypes.ENTITY and its terms APIs have
* added AtlasResourceTypes.TERM associations. * added AtlasResourceTypes.TERM associations.
* *
* unprotected types are mapped with AtlasResourceTypes.UNKNOWN, access to these are allowed. * unprotected types are mapped with AtlasResourceTypes.UNKNOWN, access to these are allowed.
*/ */
public static Set<AtlasResourceTypes> getAtlasResourceType(String contextPath) { public static Set<AtlasResourceTypes> getAtlasResourceType(String contextPath) {
Set<AtlasResourceTypes> resourceTypes = new HashSet<>(); Set<AtlasResourceTypes> resourceTypes = new HashSet<>();
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("==> getAtlasResourceType for " + contextPath); LOG.debug("==> getAtlasResourceType for {}", contextPath);
} }
String api = getApi(contextPath); String api = getApi(contextPath);
if (api.startsWith("types")) { if (api.startsWith("types")) {
...@@ -125,13 +125,13 @@ public class AtlasAuthorizationUtils { ...@@ -125,13 +125,13 @@ public class AtlasAuthorizationUtils {
resourceTypes.add(AtlasResourceTypes.TERM); resourceTypes.add(AtlasResourceTypes.TERM);
} }
} else { } else {
LOG.error("Unable to find Atlas Resource corresponding to : " + api + "\nSetting " LOG.error("Unable to find Atlas Resource corresponding to : {}\nSetting {}"
+ AtlasResourceTypes.UNKNOWN.name()); , api, AtlasResourceTypes.UNKNOWN.name());
resourceTypes.add(AtlasResourceTypes.UNKNOWN); resourceTypes.add(AtlasResourceTypes.UNKNOWN);
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("<== Returning AtlasResource/s " + resourceTypes + " for api " + api); LOG.debug("<== Returning AtlasResources {} for api {}", resourceTypes, api);
} }
return resourceTypes; return resourceTypes;
} }
......
...@@ -71,7 +71,7 @@ public class PolicyParser { ...@@ -71,7 +71,7 @@ public class PolicyParser {
default: default:
if (LOG.isErrorEnabled()) { if (LOG.isErrorEnabled()) {
LOG.error("Invalid action: '" + access + "'"); LOG.error("Invalid action: '{}'", access);
} }
break; break;
} }
...@@ -108,7 +108,7 @@ public class PolicyParser { ...@@ -108,7 +108,7 @@ public class PolicyParser {
String[] props = data.split(";;"); String[] props = data.split(";;");
if (props.length < RESOURCE_INDEX) { if (props.length < RESOURCE_INDEX) {
LOG.warn("skipping invalid policy line: " + data); LOG.warn("skipping invalid policy line: {}", data);
} else { } else {
def = new PolicyDef(); def = new PolicyDef();
def.setPolicyName(props[POLICYNAME]); def.setPolicyName(props[POLICYNAME]);
......
...@@ -36,15 +36,14 @@ public class PolicyUtil { ...@@ -36,15 +36,14 @@ public class PolicyUtil {
public Map<String, Map<AtlasResourceTypes, List<String>>> createPermissionMap(List<PolicyDef> policyDefList, public Map<String, Map<AtlasResourceTypes, List<String>>> createPermissionMap(List<PolicyDef> policyDefList,
AtlasActionTypes permissionType, SimpleAtlasAuthorizer.AtlasAccessorTypes principalType) { AtlasActionTypes permissionType, SimpleAtlasAuthorizer.AtlasAccessorTypes principalType) {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("==> PolicyUtil createPermissionMap" + "\nCreating Permission Map for :: " + permissionType LOG.debug("==> PolicyUtil createPermissionMap\nCreating Permission Map for :: {} & {}", permissionType, principalType);
+ " & " + principalType);
} }
Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap = Map<String, Map<AtlasResourceTypes, List<String>>> userReadMap =
new HashMap<>(); new HashMap<>();
// Iterate over the list of policies to create map // Iterate over the list of policies to create map
for (PolicyDef policyDef : policyDefList) { for (PolicyDef policyDef : policyDefList) {
LOG.info("Processing policy def : " + policyDef); LOG.info("Processing policy def : {}", policyDef);
Map<String, List<AtlasActionTypes>> principalMap = Map<String, List<AtlasActionTypes>> principalMap =
principalType.equals(SimpleAtlasAuthorizer.AtlasAccessorTypes.USER) ? policyDef.getUsers() : policyDef principalType.equals(SimpleAtlasAuthorizer.AtlasAccessorTypes.USER) ? policyDef.getUsers() : policyDef
.getGroups(); .getGroups();
...@@ -61,7 +60,7 @@ public class PolicyUtil { ...@@ -61,7 +60,7 @@ public class PolicyUtil {
// If its not added then create a new resource list // If its not added then create a new resource list
if (userResourceList == null) { if (userResourceList == null) {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Resource list not found for " + username + ", creating it"); LOG.debug("Resource list not found for {}, creating it", username);
} }
userResourceList = new HashMap<>(); userResourceList = new HashMap<>();
} }
...@@ -89,11 +88,11 @@ public class PolicyUtil { ...@@ -89,11 +88,11 @@ public class PolicyUtil {
userResourceList.put(type, resourceList); userResourceList.put(type, resourceList);
} }
userReadMap.put(username, userResourceList); userReadMap.put(username, userResourceList);
LOG.info("userReadMap " + userReadMap); LOG.info("userReadMap {}", userReadMap);
} }
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Returning Map for " + principalType + " :: " + userReadMap); LOG.debug("Returning Map for {} :: {}", principalType, userReadMap);
LOG.debug("<== PolicyUtil createPermissionMap"); LOG.debug("<== PolicyUtil createPermissionMap");
} }
return userReadMap; return userReadMap;
......
...@@ -79,14 +79,14 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -79,14 +79,14 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
optIgnoreCase = Boolean.valueOf(PropertiesUtil.getProperty("optIgnoreCase", "false")); optIgnoreCase = Boolean.valueOf(PropertiesUtil.getProperty("optIgnoreCase", "false"));
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Read from PropertiesUtil --> optIgnoreCase :: " + optIgnoreCase); LOG.debug("Read from PropertiesUtil --> optIgnoreCase :: {}", optIgnoreCase);
} }
Configuration configuration = ApplicationProperties.get(); Configuration configuration = ApplicationProperties.get();
String policyStorePath = configuration.getString("atlas.auth.policy.file", System.getProperty("atlas.conf")+"/policy-store.txt"); String policyStorePath = configuration.getString("atlas.auth.policy.file", System.getProperty("atlas.conf")+"/policy-store.txt");
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Loading Apache Atlas policies from : " + policyStorePath); LOG.debug("Loading Apache Atlas policies from : {}", policyStorePath);
} }
List<String> policies = FileReaderUtil.readFile(policyStorePath); List<String> policies = FileReaderUtil.readFile(policyStorePath);
...@@ -103,10 +103,10 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -103,10 +103,10 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
groupDeleteMap = util.createPermissionMap(policyDef, AtlasActionTypes.DELETE, AtlasAccessorTypes.GROUP); groupDeleteMap = util.createPermissionMap(policyDef, AtlasActionTypes.DELETE, AtlasAccessorTypes.GROUP);
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("\n\nUserReadMap :: " + userReadMap + "\nGroupReadMap :: " + groupReadMap); LOG.debug("\n\nUserReadMap :: {}\nGroupReadMap :: {}", userReadMap, groupReadMap);
LOG.debug("\n\nUserWriteMap :: " + userWriteMap + "\nGroupWriteMap :: " + groupWriteMap); LOG.debug("\n\nUserWriteMap :: {}\nGroupWriteMap :: {}", userWriteMap, groupWriteMap);
LOG.debug("\n\nUserUpdateMap :: " + userUpdateMap + "\nGroupUpdateMap :: " + groupUpdateMap); LOG.debug("\n\nUserUpdateMap :: {}\nGroupUpdateMap :: {}", userUpdateMap, groupUpdateMap);
LOG.debug("\n\nUserDeleteMap :: " + userDeleteMap + "\nGroupDeleteMap :: " + groupDeleteMap); LOG.debug("\n\nUserDeleteMap :: {}\nGroupDeleteMap :: {}", userDeleteMap, groupDeleteMap);
} }
} catch (IOException | AtlasException e) { } catch (IOException | AtlasException e) {
...@@ -121,7 +121,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -121,7 +121,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
public boolean isAccessAllowed(AtlasAccessRequest request) throws AtlasAuthorizationException { public boolean isAccessAllowed(AtlasAccessRequest request) throws AtlasAuthorizationException {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("==> SimpleAtlasAuthorizer isAccessAllowed"); LOG.debug("==> SimpleAtlasAuthorizer isAccessAllowed");
LOG.debug("isAccessAllowd(" + request + ")"); LOG.debug("isAccessAllowd({})", request);
} }
String user = request.getUser(); String user = request.getUser();
Set<String> groups = request.getUserGroups(); Set<String> groups = request.getUserGroups();
...@@ -129,8 +129,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -129,8 +129,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
String resource = request.getResource(); String resource = request.getResource();
Set<AtlasResourceTypes> resourceTypes = request.getResourceTypes(); Set<AtlasResourceTypes> resourceTypes = request.getResourceTypes();
if (isDebugEnabled) if (isDebugEnabled)
LOG.debug("Checking for :: \nUser :: " + user + "\nGroups :: " + groups + "\nAction :: " + action LOG.debug("Checking for :: \nUser :: {}\nGroups :: {}\nAction :: {}\nResource :: {}", user, groups, action, resource);
+ "\nResource :: " + resource);
boolean isAccessAllowed = false; boolean isAccessAllowed = false;
boolean isUser = user != null; boolean isUser = user != null;
...@@ -143,7 +142,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -143,7 +142,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
return isAccessAllowed; return isAccessAllowed;
} else { } else {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("checkAccess for Operation :: " + action + " on Resource " + resourceTypes + ":" + resource); LOG.debug("checkAccess for Operation :: {} on Resource {}:{}", action, resourceTypes, resource);
} }
switch (action) { switch (action) {
case READ: case READ:
...@@ -168,14 +167,14 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -168,14 +167,14 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
break; break;
default: default:
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Invalid Action " + action+"\nRaising AtlasAuthorizationException!!!"); LOG.debug("Invalid Action {}\nRaising AtlasAuthorizationException!!!", action);
} }
throw new AtlasAuthorizationException("Invalid Action :: " + action); throw new AtlasAuthorizationException("Invalid Action :: " + action);
} }
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("<== SimpleAtlasAuthorizer isAccessAllowed = " + isAccessAllowed); LOG.debug("<== SimpleAtlasAuthorizer isAccessAllowed = {}", isAccessAllowed);
} }
return isAccessAllowed; return isAccessAllowed;
...@@ -185,8 +184,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -185,8 +184,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
Map<String, Map<AtlasResourceTypes, List<String>>> map) { Map<String, Map<AtlasResourceTypes, List<String>>> map) {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("==> SimpleAtlasAuthorizer checkAccess"); LOG.debug("==> SimpleAtlasAuthorizer checkAccess");
LOG.debug("Now checking access for accessor : " + accessor + "\nResource Types : " + resourceTypes LOG.debug("Now checking access for accessor : {}\nResource Types : {}\nResource : {}\nMap : {}", accessor, resourceTypes, resource, map);
+ "\nResource : " + resource + "\nMap : " + map);
} }
boolean result = true; boolean result = true;
Map<AtlasResourceTypes, List<String>> rescMap = map.get(accessor); Map<AtlasResourceTypes, List<String>> rescMap = map.get(accessor);
...@@ -194,7 +192,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -194,7 +192,7 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
for (AtlasResourceTypes resourceType : resourceTypes) { for (AtlasResourceTypes resourceType : resourceTypes) {
List<String> accessList = rescMap.get(resourceType); List<String> accessList = rescMap.get(resourceType);
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("\nChecking for resource : " + resource + " in list : " + accessList + "\n"); LOG.debug("\nChecking for resource : {} in list : {}\n", resource, accessList);
} }
if (accessList != null) { if (accessList != null) {
result = result && isMatch(resource, accessList); result = result && isMatch(resource, accessList);
...@@ -205,11 +203,11 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -205,11 +203,11 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
} else { } else {
result = false; result = false;
if (isDebugEnabled) if (isDebugEnabled)
LOG.debug("Key " + accessor + " missing. Returning with result : " + result); LOG.debug("Key {} missing. Returning with result : {}", accessor, result);
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Check for " + accessor + " :: " + result); LOG.debug("Check for {} :: {}", accessor, result);
LOG.debug("<== SimpleAtlasAuthorizer checkAccess"); LOG.debug("<== SimpleAtlasAuthorizer checkAccess");
} }
return result; return result;
...@@ -308,14 +306,13 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer { ...@@ -308,14 +306,13 @@ public final class SimpleAtlasAuthorizer implements AtlasAuthorizer {
} }
sb.append("]"); sb.append("]");
LOG.debug("AtlasDefaultResourceMatcher.isMatch returns FALSE, (resource=" + resource LOG.debug("AtlasDefaultResourceMatcher.isMatch returns FALSE, (resource={}, policyValues={})", resource, sb.toString());
+ ", policyValues=" + sb.toString() + ")");
} }
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("<== SimpleAtlasAuthorizer isMatch(" + resource + "): " + isMatch); LOG.debug("<== SimpleAtlasAuthorizer isMatch({}): {}", resource, isMatch);
} }
return isMatch; return isMatch;
......
...@@ -95,7 +95,7 @@ public class QueryFactory { ...@@ -95,7 +95,7 @@ public class QueryFactory {
} catch (ParseException e) { } catch (ParseException e) {
throw new InvalidQueryException(e.getMessage()); throw new InvalidQueryException(e.getMessage());
} }
LOG.info("LuceneQuery: " + query); LOG.info("LuceneQuery: {}", query);
queryExpression = create(query, resourceDefinition); queryExpression = create(query, resourceDefinition);
} else { } else {
queryExpression = new AlwaysQueryExpression(); queryExpression = new AlwaysQueryExpression();
......
...@@ -261,9 +261,7 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -261,9 +261,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
String loginModuleName = properties.getProperty(keyParam); String loginModuleName = properties.getProperty(keyParam);
if (loginModuleName == null) { if (loginModuleName == null) {
LOG.error("Unable to add JAAS configuration for " LOG.error("Unable to add JAAS configuration for client [{}] as it is missing param [{}]. Skipping JAAS config for [{}]", jaasClient, keyParam, jaasClient);
+ "client [" + jaasClient + "] as it is missing param [" + keyParam + "]."
+ " Skipping JAAS config for [" + jaasClient + "]");
continue; continue;
} else { } else {
loginModuleName = loginModuleName.trim(); loginModuleName = loginModuleName.trim();
...@@ -290,15 +288,12 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -290,15 +288,12 @@ public final class InMemoryJAASConfiguration extends Configuration {
break; break;
default: default:
String validValues = "optional|requisite|sufficient|required"; String validValues = "optional|requisite|sufficient|required";
LOG.warn("Unknown JAAS configuration value for (" + keyParam LOG.warn("Unknown JAAS configuration value for ({}) = [{}], valid value are [{}] using the default value, REQUIRED", keyParam, controlFlag, validValues);
+ ") = [" + controlFlag + "], valid value are [" + validValues
+ "] using the default value, REQUIRED");
loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED; loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
break; break;
} }
} else { } else {
LOG.warn("Unable to find JAAS configuration (" LOG.warn("Unable to find JAAS configuration ({}); using the default value, REQUIRED", keyParam);
+ keyParam + "); using the default value, REQUIRED");
loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED; loginControlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
} }
...@@ -318,8 +313,7 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -318,8 +313,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
optionVal = SecurityUtil.getServerPrincipal(optionVal, (String) null); optionVal = SecurityUtil.getServerPrincipal(optionVal, (String) null);
} }
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failed to build serverPrincipal. Using provided value:[" LOG.warn("Failed to build serverPrincipal. Using provided value:[{}]", optionVal);
+ optionVal + "]");
} }
} }
options.put(optionKey, optionVal); options.put(optionKey, optionVal);
......
...@@ -74,7 +74,7 @@ public final class AtlasPerfTracer { ...@@ -74,7 +74,7 @@ public final class AtlasPerfTracer {
public void log() { public void log() {
long elapsedTime = getElapsedTime(); long elapsedTime = getElapsedTime();
if (elapsedTime > reportingThresholdMs) { if (elapsedTime > reportingThresholdMs) {
logger.debug("PERF|" + tag + "|" + elapsedTime); logger.debug("PERF|{}|{}", tag, elapsedTime);
} }
} }
} }
...@@ -17,34 +17,34 @@ ...@@ -17,34 +17,34 @@
*/ */
package org.apache.atlas.model; package org.apache.atlas.model;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.instance.AtlasClassification; import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasStruct; import org.apache.atlas.model.instance.AtlasStruct;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_PRIMITIVE_TYPES;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEnumDef; import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasClassificationType;
import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasEntityType;
import org.apache.atlas.type.AtlasStructType; import org.apache.atlas.type.AtlasStructType;
import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry; import org.apache.atlas.type.AtlasTypeRegistry.AtlasTransientTypeRegistry;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_PRIMITIVE_TYPES;
public final class ModelTestUtil { public final class ModelTestUtil {
private static final Logger LOG = LoggerFactory.getLogger(ModelTestUtil.class); private static final Logger LOG = LoggerFactory.getLogger(ModelTestUtil.class);
...@@ -309,7 +309,7 @@ public final class ModelTestUtil { ...@@ -309,7 +309,7 @@ public final class ModelTestUtil {
ret = ((AtlasEntityType) dataType).createDefaultValue(); ret = ((AtlasEntityType) dataType).createDefaultValue();
} }
} catch (AtlasBaseException excp) { } catch (AtlasBaseException excp) {
LOG.error("failed to get entity-type " + entityDef.getName(), excp); LOG.error("failed to get entity-type {}", entityDef.getName(), excp);
} }
return ret; return ret;
...@@ -329,7 +329,7 @@ public final class ModelTestUtil { ...@@ -329,7 +329,7 @@ public final class ModelTestUtil {
ret = ((AtlasStructType)dataType).createDefaultValue(); ret = ((AtlasStructType)dataType).createDefaultValue();
} }
} catch (AtlasBaseException excp) { } catch (AtlasBaseException excp) {
LOG.error("failed to get struct-type " + structDef.getName(), excp); LOG.error("failed to get struct-type {}", structDef.getName(), excp);
} }
return ret; return ret;
...@@ -350,7 +350,7 @@ public final class ModelTestUtil { ...@@ -350,7 +350,7 @@ public final class ModelTestUtil {
ret = ((AtlasClassificationType)dataType).createDefaultValue(); ret = ((AtlasClassificationType)dataType).createDefaultValue();
} }
} catch (AtlasBaseException excp) { } catch (AtlasBaseException excp) {
LOG.error("failed to get classification-type " + classificationDef.getName(), excp); LOG.error("failed to get classification-type {}", classificationDef.getName(), excp);
} }
return ret; return ret;
......
...@@ -131,7 +131,7 @@ public abstract class AtlasHook { ...@@ -131,7 +131,7 @@ public abstract class AtlasHook {
} catch (Exception e) { } catch (Exception e) {
numRetries++; numRetries++;
if (numRetries < maxRetries) { if (numRetries < maxRetries) {
LOG.error("Failed to send notification - attempt #" + numRetries + "; error=" + e.getMessage()); LOG.error("Failed to send notification - attempt #{}; error={}", numRetries, e.getMessage());
try { try {
LOG.debug("Sleeping for {} ms before retry", notificationRetryInterval); LOG.debug("Sleeping for {} ms before retry", notificationRetryInterval);
Thread.sleep(notificationRetryInterval); Thread.sleep(notificationRetryInterval);
...@@ -190,14 +190,14 @@ public abstract class AtlasHook { ...@@ -190,14 +190,14 @@ public abstract class AtlasHook {
public static String getUser(String userName, UserGroupInformation ugi) { public static String getUser(String userName, UserGroupInformation ugi) {
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Returning userName {} " + userName); LOG.debug("Returning userName {}", userName);
} }
return userName; return userName;
} }
if (ugi != null && StringUtils.isNotEmpty(ugi.getShortUserName())) { if (ugi != null && StringUtils.isNotEmpty(ugi.getShortUserName())) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Returning ugi.getShortUserName {} " + userName); LOG.debug("Returning ugi.getShortUserName {}", userName);
} }
return ugi.getShortUserName(); return ugi.getShortUserName();
} }
......
...@@ -294,7 +294,7 @@ public class KafkaNotification extends AbstractNotification implements Service { ...@@ -294,7 +294,7 @@ public class KafkaNotification extends AbstractNotification implements Service {
consumerProperties.putAll(properties); consumerProperties.putAll(properties);
consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, groupId); consumerProperties.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
LOG.info("Consumer property: auto.commit.enable: " + consumerProperties.getProperty("auto.commit.enable")); LOG.info("Consumer property: auto.commit.enable: {}", consumerProperties.getProperty("auto.commit.enable"));
return consumerProperties; return consumerProperties;
} }
......
...@@ -76,7 +76,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -76,7 +76,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
@Override @Override
public Class<?> findClass(String name) throws ClassNotFoundException { public Class<?> findClass(String name) throws ClassNotFoundException {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("==> AtlasPluginClassLoader.findClass(" + name + ")"); LOG.trace("==> AtlasPluginClassLoader.findClass({})", name);
} }
Class<?> ret = null; Class<?> ret = null;
...@@ -84,7 +84,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -84,7 +84,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
try { try {
// first try to find the class in pluginClassloader // first try to find the class in pluginClassloader
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("AtlasPluginClassLoader.findClass(" + name + "): calling pluginClassLoader.findClass()"); LOG.trace("AtlasPluginClassLoader.findClass({}): calling pluginClassLoader.findClass()", name);
} }
ret = super.findClass(name); ret = super.findClass(name);
...@@ -94,8 +94,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -94,8 +94,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
if (savedClassLoader != null) { if (savedClassLoader != null) {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace( LOG.trace("AtlasPluginClassLoader.findClass({}): calling componentClassLoader.findClass()", name);
"AtlasPluginClassLoader.findClass(" + name + "): calling componentClassLoader.findClass()");
} }
ret = savedClassLoader.findClass(name); ret = savedClassLoader.findClass(name);
...@@ -103,7 +102,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -103,7 +102,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
} }
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("<== AtlasPluginClassLoader.findClass(" + name + "): " + ret); LOG.trace("<== AtlasPluginClassLoader.findClass({}): {}", name, ret);
} }
return ret; return ret;
...@@ -112,7 +111,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -112,7 +111,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
@Override @Override
public Class<?> loadClass(String name) throws ClassNotFoundException { public Class<?> loadClass(String name) throws ClassNotFoundException {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("==> AtlasPluginClassLoader.loadClass(" + name + ")"); LOG.trace("==> AtlasPluginClassLoader.loadClass({})", name);
} }
Class<?> ret = null; Class<?> ret = null;
...@@ -120,7 +119,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -120,7 +119,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
try { try {
// first try to load the class from pluginClassloader // first try to load the class from pluginClassloader
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("AtlasPluginClassLoader.loadClass(" + name + "): calling pluginClassLoader.loadClass()"); LOG.trace("AtlasPluginClassLoader.loadClass({}): calling pluginClassLoader.loadClass()", name);
} }
ret = super.loadClass(name); ret = super.loadClass(name);
...@@ -130,8 +129,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -130,8 +129,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
if (savedClassLoader != null) { if (savedClassLoader != null) {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace( LOG.trace("AtlasPluginClassLoader.loadClass({}): calling componentClassLoader.loadClass()", name);
"AtlasPluginClassLoader.loadClass(" + name + "): calling componentClassLoader.loadClass()");
} }
ret = savedClassLoader.loadClass(name); ret = savedClassLoader.loadClass(name);
...@@ -139,7 +137,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -139,7 +137,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
} }
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace("<== AtlasPluginClassLoader.loadClass(" + name + "): " + ret); LOG.trace("<== AtlasPluginClassLoader.loadClass({}): {}", name, ret);
} }
return ret; return ret;
...@@ -148,12 +146,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -148,12 +146,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
@Override @Override
public URL findResource(String name) { public URL findResource(String name) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasPluginClassLoader.findResource(" + name + ") "); LOG.debug("==> AtlasPluginClassLoader.findResource({}) ", name);
} }
// first try to find the resource from pluginClassloader // first try to find the resource from pluginClassloader
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("AtlasPluginClassLoader.findResource(" + name + "): calling pluginClassLoader.findResource()"); LOG.debug("AtlasPluginClassLoader.findResource({}): calling pluginClassLoader.findResource()", name);
} }
URL ret = super.findResource(name); URL ret = super.findResource(name);
...@@ -163,8 +161,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -163,8 +161,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
if (savedClassLoader != null) { if (savedClassLoader != null) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("AtlasPluginClassLoader.findResource(" + name LOG.debug("AtlasPluginClassLoader.findResource({}): calling componentClassLoader.getResource()", name);
+ "): calling componentClassLoader.getResource()");
} }
ret = savedClassLoader.getResource(name); ret = savedClassLoader.getResource(name);
...@@ -172,7 +169,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -172,7 +169,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasPluginClassLoader.findResource(" + name + "): " + ret); LOG.debug("<== AtlasPluginClassLoader.findResource({}): {}", name, ret);
} }
return ret; return ret;
...@@ -181,7 +178,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -181,7 +178,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
@Override @Override
public Enumeration<URL> findResources(String name) throws IOException { public Enumeration<URL> findResources(String name) throws IOException {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasPluginClassLoader.findResources(" + name + ")"); LOG.debug("==> AtlasPluginClassLoader.findResources({})", name);
} }
Enumeration<URL> ret = null; Enumeration<URL> ret = null;
...@@ -198,7 +195,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -198,7 +195,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasPluginClassLoader.findResources(" + name + "): " + ret); LOG.debug("<== AtlasPluginClassLoader.findResources({}): {}", name, ret);
} }
return ret; return ret;
...@@ -241,7 +238,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -241,7 +238,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
private Enumeration<URL> findResourcesUsingPluginClassLoader(String name) { private Enumeration<URL> findResourcesUsingPluginClassLoader(String name) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingPluginClassLoader(" + name + ")"); LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingPluginClassLoader({})", name);
} }
Enumeration<URL> ret = null; Enumeration<URL> ret = null;
...@@ -251,13 +248,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -251,13 +248,12 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
} catch (Throwable excp) { } catch (Throwable excp) {
// Ignore exceptions // Ignore exceptions
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("AtlasPluginClassLoader.findResourcesUsingPluginClassLoader(" + name LOG.debug("AtlasPluginClassLoader.findResourcesUsingPluginClassLoader({}): resource not found in plugin", name, excp);
+ "): resource not found in plugin", excp);
} }
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingPluginClassLoader(" + name + "): " + ret); LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingPluginClassLoader({}): {}", name, ret);
} }
return ret; return ret;
...@@ -265,7 +261,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -265,7 +261,7 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
private Enumeration<URL> findResourcesUsingComponentClassLoader(String name) { private Enumeration<URL> findResourcesUsingComponentClassLoader(String name) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name + ")"); LOG.debug("==> AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({})", name);
} }
Enumeration<URL> ret = null; Enumeration<URL> ret = null;
...@@ -275,20 +271,18 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -275,20 +271,18 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
if (savedClassLoader != null) { if (savedClassLoader != null) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({}): calling componentClassLoader.getResources()", name);
+ "): calling componentClassLoader.getResources()");
} }
ret = savedClassLoader.getResources(name); ret = savedClassLoader.getResources(name);
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name + "): " + ret); LOG.debug("<== AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({}): {}", name, ret);
} }
} catch (Throwable t) { } catch (Throwable t) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader(" + name LOG.debug("AtlasPluginClassLoader.findResourcesUsingComponentClassLoader({}): class not found in componentClassLoader.", name, t);
+ "): class not found in componentClassLoader.", t);
} }
} }
......
...@@ -52,7 +52,7 @@ final class AtlasPluginClassLoaderUtil { ...@@ -52,7 +52,7 @@ final class AtlasPluginClassLoaderUtil {
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectories(): " + ret.size() + " files"); LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectories(): {} files", ret.size());
} }
return ret.toArray(new URL[]{}); return ret.toArray(new URL[]{});
...@@ -73,32 +73,31 @@ final class AtlasPluginClassLoaderUtil { ...@@ -73,32 +73,31 @@ final class AtlasPluginClassLoaderUtil {
URL jarPath = dirFile.toURI().toURL(); URL jarPath = dirFile.toURI().toURL();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug( LOG.debug("getFilesInDirectory('{}'): adding {}", dirPath, dirFile.getAbsolutePath());
"getFilesInDirectory('" + dirPath + "'): adding " + dirFile.getAbsolutePath());
} }
files.add(jarPath); files.add(jarPath);
} catch (Exception excp) { } catch (Exception excp) {
LOG.warn("getFilesInDirectory('" + dirPath + "'): failed to get URI for file " + dirFile LOG.warn("getFilesInDirectory('{}'): failed to get URI for file {}", dirPath, dirFile
.getAbsolutePath(), excp); .getAbsolutePath(), excp);
} }
} }
} }
} catch (Exception excp) { } catch (Exception excp) {
LOG.warn("getFilesInDirectory('" + dirPath + "'): error", excp); LOG.warn("getFilesInDirectory('{}'): error", dirPath, excp);
} }
} else { } else {
LOG.warn("getFilesInDirectory('" + dirPath + "'): could not find directory in path " + dirPath); LOG.warn("getFilesInDirectory('{}'): could not find directory in path {}", dirPath, dirPath);
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectory(" + dirPath + ")"); LOG.debug("<== AtlasPluginClassLoaderUtil.getFilesInDirectory({})", dirPath);
} }
} }
public static String getPluginImplLibPath(String pluginType, Class<?> pluginClass) throws Exception { public static String getPluginImplLibPath(String pluginType, Class<?> pluginClass) throws Exception {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class (" + pluginClass.getName() + ")"); LOG.debug("==> AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class ({})", pluginClass.getName());
} }
URI uri = pluginClass.getProtectionDomain().getCodeSource().getLocation().toURI(); URI uri = pluginClass.getProtectionDomain().getCodeSource().getLocation().toURI();
...@@ -106,8 +105,7 @@ final class AtlasPluginClassLoaderUtil { ...@@ -106,8 +105,7 @@ final class AtlasPluginClassLoaderUtil {
String ret = path.getParent().toString() + File.separatorChar + ATLAS_PLUGIN_LIBDIR.replaceAll("%", pluginType); String ret = path.getParent().toString() + File.separatorChar + ATLAS_PLUGIN_LIBDIR.replaceAll("%", pluginType);
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class " + pluginClass.getName() + "): " LOG.debug("<== AtlasPluginClassLoaderUtil.getPluginImplLibPath for Class {}): {})", pluginClass.getName(), ret);
+ ret + ")");
} }
return ret; return ret;
......
...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES: ALL CHANGES:
ATLAS-1407 improve LOG statement performance (apoorvnaik via mneethiraj)
ATLAS-1350 update authorization to handle v2 REST endpoints (saqeeb.s via mneethiraj) ATLAS-1350 update authorization to handle v2 REST endpoints (saqeeb.s via mneethiraj)
ATLAS-1311 Integration tests for V2 Entity APIs (apoorvnaik via mneethiraj) ATLAS-1311 Integration tests for V2 Entity APIs (apoorvnaik via mneethiraj)
ATLAS-1377 fix for Escaping comma in for LDAP properties (nixonrodrigues via mneethiraj) ATLAS-1377 fix for Escaping comma in for LDAP properties (nixonrodrigues via mneethiraj)
......
...@@ -57,7 +57,7 @@ public class GraphTransactionInterceptor implements MethodInterceptor { ...@@ -57,7 +57,7 @@ public class GraphTransactionInterceptor implements MethodInterceptor {
if (logException(t)) { if (logException(t)) {
LOG.error("graph rollback due to exception ", t); LOG.error("graph rollback due to exception ", t);
} else { } else {
LOG.error("graph rollback due to exception " + t.getClass().getSimpleName() + ":" + t.getMessage()); LOG.error("graph rollback due to exception {}:{}", t.getClass().getSimpleName(), t.getMessage());
} }
graph.rollback(); graph.rollback();
throw t; throw t;
......
...@@ -347,7 +347,7 @@ public class GraphBackedMetadataRepository implements MetadataRepository { ...@@ -347,7 +347,7 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
} catch (EntityNotFoundException e) { } catch (EntityNotFoundException e) {
// Entity does not exist - treat as non-error, since the caller // Entity does not exist - treat as non-error, since the caller
// wanted to delete the entity and it's already gone. // wanted to delete the entity and it's already gone.
LOG.info("Deletion request ignored for non-existent entity with guid " + guid); LOG.info("Deletion request ignored for non-existent entity with guid {}", guid);
} }
} }
......
...@@ -564,7 +564,7 @@ public final class GraphHelper { ...@@ -564,7 +564,7 @@ public final class GraphHelper {
result = findVertex(propertyKey, instance.get(attributeInfo.name), result = findVertex(propertyKey, instance.get(attributeInfo.name),
Constants.ENTITY_TYPE_PROPERTY_KEY, classType.getName(), Constants.ENTITY_TYPE_PROPERTY_KEY, classType.getName(),
Constants.STATE_PROPERTY_KEY, Id.EntityState.ACTIVE.name()); Constants.STATE_PROPERTY_KEY, Id.EntityState.ACTIVE.name());
LOG.debug("Found vertex by unique attribute : " + propertyKey + "=" + instance.get(attributeInfo.name)); LOG.debug("Found vertex by unique attribute : {}={}", propertyKey, instance.get(attributeInfo.name));
} catch (EntityNotFoundException e) { } catch (EntityNotFoundException e) {
//Its ok if there is no entity with the same unique value //Its ok if there is no entity with the same unique value
} }
......
...@@ -588,7 +588,7 @@ public final class TypedInstanceToGraphMapper { ...@@ -588,7 +588,7 @@ public final class TypedInstanceToGraphMapper {
String edgeLabel) throws AtlasException { String edgeLabel) throws AtlasException {
AtlasVertex newReferenceVertex = getClassVertex(newAttributeValue); AtlasVertex newReferenceVertex = getClassVertex(newAttributeValue);
if( ! GraphHelper.elementExists(newReferenceVertex) && newAttributeValue != null) { if( ! GraphHelper.elementExists(newReferenceVertex) && newAttributeValue != null) {
LOG.error("Could not find vertex for Class Reference " + newAttributeValue); LOG.error("Could not find vertex for Class Reference {}", newAttributeValue);
throw new EntityNotFoundException("Could not find vertex for Class Reference " + newAttributeValue); throw new EntityNotFoundException("Could not find vertex for Class Reference " + newAttributeValue);
} }
......
...@@ -130,7 +130,7 @@ public class AtlasTypeDefStoreInitializer { ...@@ -130,7 +130,7 @@ public class AtlasTypeDefStoreInitializer {
typeDefStore.createTypesDef(typesToCreate); typeDefStore.createTypesDef(typesToCreate);
} catch (Throwable t) { } catch (Throwable t) {
LOG.error("error while registering types in file " + typeDefFile.getAbsolutePath(), t); LOG.error("error while registering types in file {}", typeDefFile.getAbsolutePath(), t);
} }
} }
...@@ -194,12 +194,11 @@ public class AtlasTypeDefStoreInitializer { ...@@ -194,12 +194,11 @@ public class AtlasTypeDefStoreInitializer {
try { try {
patchHandler.applyPatch(patch); patchHandler.applyPatch(patch);
} catch (AtlasBaseException excp) { } catch (AtlasBaseException excp) {
LOG.error("Failed to apply " + patch.getAction() + " patch in file " + LOG.error("Failed to apply {} patch in file {}. Ignored", patch.getAction(), typePatchFile.getAbsolutePath(), excp);
typePatchFile.getAbsolutePath() + ". Ignored", excp);
} }
} }
} catch (Throwable t) { } catch (Throwable t) {
LOG.error("Failed to apply patches in file " + typePatchFile.getAbsolutePath() + ". Ignored", t); LOG.error("Failed to apply patches in file {}. Ignored", typePatchFile.getAbsolutePath(), t);
} }
} }
} }
......
...@@ -159,7 +159,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang ...@@ -159,7 +159,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang
if (typesDef != null && !typesDef.isEmpty()) { if (typesDef != null && !typesDef.isEmpty()) {
TypeSystem.TransientTypeSystem transientTypeSystem = typeSystem.createTransientTypeSystem(typesDef, true); TypeSystem.TransientTypeSystem transientTypeSystem = typeSystem.createTransientTypeSystem(typesDef, true);
Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded(); Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded();
LOG.info("Number of types got from transient type system: " + typesAdded.size()); LOG.info("Number of types got from transient type system: {}", typesAdded.size());
typeSystem.commitTypes(typesAdded); typeSystem.commitTypes(typesAdded);
} }
} }
...@@ -748,7 +748,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang ...@@ -748,7 +748,7 @@ public class DefaultMetadataService implements MetadataService, ActiveStateChang
TypeSystem.TransientTypeSystem transientTypeSystem TypeSystem.TransientTypeSystem transientTypeSystem
= typeSystem.createTransientTypeSystem(typesDef, false); = typeSystem.createTransientTypeSystem(typesDef, false);
Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded(); Map<String, IDataType> typesAdded = transientTypeSystem.getTypesAdded();
LOG.info("Number of types got from transient type system: " + typesAdded.size()); LOG.info("Number of types got from transient type system: {}", typesAdded.size());
typeSystem.commitTypes(typesAdded); typeSystem.commitTypes(typesAdded);
} catch (AtlasException e) { } catch (AtlasException e) {
LOG.error("Failed to restore type-system after TypeRegistry changes", e); LOG.error("Failed to restore type-system after TypeRegistry changes", e);
......
...@@ -27,6 +27,7 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -27,6 +27,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.List; import java.util.List;
@Aspect @Aspect
...@@ -55,11 +56,11 @@ public class AtlasAspect { ...@@ -55,11 +56,11 @@ public class AtlasAspect {
String methodName = methodSign.getDeclaringType().getSimpleName() + "." + methodSign.getName(); String methodName = methodSign.getDeclaringType().getSimpleName() + "." + methodSign.getName();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug(String.format("==> %s(%s)", methodName, joinPoint.getArgs())); LOG.debug(String.format("==> %s(%s)", methodName, Arrays.toString(joinPoint.getArgs())));
} }
Object response = joinPoint.proceed(); Object response = joinPoint.proceed();
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug(String.format("<== %s(%s): %s", methodName, joinPoint.getArgs(), LOG.debug(String.format("<== %s(%s): %s", methodName, Arrays.toString(joinPoint.getArgs()),
response instanceof List ? ((List)response).size() : response)); response instanceof List ? ((List)response).size() : response));
} }
return response; return response;
......
...@@ -56,18 +56,18 @@ public class AtlasServerIdSelector { ...@@ -56,18 +56,18 @@ public class AtlasServerIdSelector {
try { try {
socketAddress = NetUtils.createSocketAddr(hostPort); socketAddress = NetUtils.createSocketAddr(hostPort);
} catch (Exception e) { } catch (Exception e) {
LOG.warn("Exception while trying to get socket address for " + hostPort, e); LOG.warn("Exception while trying to get socket address for {}", hostPort, e);
continue; continue;
} }
if (!socketAddress.isUnresolved() if (!socketAddress.isUnresolved()
&& NetUtils.isLocalAddress(socketAddress.getAddress()) && NetUtils.isLocalAddress(socketAddress.getAddress())
&& appPort == socketAddress.getPort()) { && appPort == socketAddress.getPort()) {
LOG.info("Found matched server id " + id + " with host port: " + hostPort); LOG.info("Found matched server id {} with host port: {}", id, hostPort);
matchingServerId = id; matchingServerId = id;
break; break;
} }
} else { } else {
LOG.info("Could not find matching address entry for id: " + id); LOG.info("Could not find matching address entry for id: {}", id);
} }
} }
if (matchingServerId == null) { if (matchingServerId == null) {
......
...@@ -249,7 +249,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl ...@@ -249,7 +249,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
break; break;
} catch (Throwable e) { } catch (Throwable e) {
LOG.warn("Error handling message" + e.getMessage()); LOG.warn("Error handling message{}", e.getMessage());
try{ try{
LOG.info("Sleeping for {} ms before retry", consumerRetryInterval); LOG.info("Sleeping for {} ms before retry", consumerRetryInterval);
Thread.sleep(consumerRetryInterval); Thread.sleep(consumerRetryInterval);
...@@ -273,7 +273,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl ...@@ -273,7 +273,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
private void recordFailedMessages() { private void recordFailedMessages() {
//logging failed messages //logging failed messages
for (HookNotification.HookNotificationMessage message : failedMessages) { for (HookNotification.HookNotificationMessage message : failedMessages) {
FAILED_LOG.error("[DROPPED_NOTIFICATION] " + AbstractNotification.getMessageJson(message)); FAILED_LOG.error("[DROPPED_NOTIFICATION] {}", AbstractNotification.getMessageJson(message));
} }
failedMessages.clear(); failedMessages.clear();
} }
......
...@@ -67,12 +67,11 @@ public class UserDao { ...@@ -67,12 +67,11 @@ public class UserDao {
inStr = new FileInputStream(PROPERTY_FILE_PATH); inStr = new FileInputStream(PROPERTY_FILE_PATH);
userLogins.load(inStr); userLogins.load(inStr);
}else { }else {
LOG.error("Error while reading user.properties file, filepath=" LOG.error("Error while reading user.properties file, filepath={}", PROPERTY_FILE_PATH);
+ PROPERTY_FILE_PATH);
} }
} catch (IOException | AtlasException e) { } catch (IOException | AtlasException e) {
LOG.error("Error while reading user.properties file, filepath=" + PROPERTY_FILE_PATH, e); LOG.error("Error while reading user.properties file, filepath={}", PROPERTY_FILE_PATH, e);
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
if(inStr != null) { if(inStr != null) {
...@@ -99,7 +98,7 @@ public class UserDao { ...@@ -99,7 +98,7 @@ public class UserDao {
role = dataArr[0]; role = dataArr[0];
password = dataArr[1]; password = dataArr[1];
} else { } else {
LOG.error("User role credentials is not set properly for " + username); LOG.error("User role credentials is not set properly for {}", username);
throw new AtlasAuthenticationException("User role credentials is not set properly for " + username ); throw new AtlasAuthenticationException("User role credentials is not set properly for " + username );
} }
...@@ -107,7 +106,7 @@ public class UserDao { ...@@ -107,7 +106,7 @@ public class UserDao {
if (StringUtils.hasText(role)) { if (StringUtils.hasText(role)) {
grantedAuths.add(new SimpleGrantedAuthority(role)); grantedAuths.add(new SimpleGrantedAuthority(role));
} else { } else {
LOG.error("User role credentials is not set properly for " + username); LOG.error("User role credentials is not set properly for {}", username);
throw new AtlasAuthenticationException("User role credentials is not set properly for " + username ); throw new AtlasAuthenticationException("User role credentials is not set properly for " + username );
} }
......
...@@ -32,9 +32,9 @@ import org.apache.hadoop.security.authentication.client.AuthenticatedURL; ...@@ -32,9 +32,9 @@ import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
import org.apache.hadoop.security.authentication.client.AuthenticationException; import org.apache.hadoop.security.authentication.client.AuthenticationException;
import org.apache.hadoop.security.authentication.client.KerberosAuthenticator; import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
import org.apache.hadoop.security.authentication.server.AuthenticationFilter; import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
import org.apache.hadoop.security.authentication.server.AuthenticationHandler;
import org.apache.hadoop.security.authentication.server.AuthenticationToken; import org.apache.hadoop.security.authentication.server.AuthenticationToken;
import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler; import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
import org.apache.hadoop.security.authentication.server.AuthenticationHandler;
import org.apache.hadoop.security.authentication.util.Signer; import org.apache.hadoop.security.authentication.util.Signer;
import org.apache.hadoop.security.authentication.util.SignerException; import org.apache.hadoop.security.authentication.util.SignerException;
import org.apache.hadoop.security.authentication.util.SignerSecretProvider; import org.apache.hadoop.security.authentication.util.SignerSecretProvider;
...@@ -50,16 +50,18 @@ import org.springframework.security.core.context.SecurityContextHolder; ...@@ -50,16 +50,18 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.WebAuthenticationDetails; import org.springframework.security.web.authentication.WebAuthenticationDetails;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
...@@ -69,7 +71,6 @@ import java.text.SimpleDateFormat; ...@@ -69,7 +71,6 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.servlet.http.Cookie;
/** /**
* This enforces authentication as part of the filter before processing the request. * This enforces authentication as part of the filter before processing the request.
...@@ -91,7 +92,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { ...@@ -91,7 +92,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
LOG.info("AtlasAuthenticationFilter initialization started"); LOG.info("AtlasAuthenticationFilter initialization started");
init(null); init(null);
} catch (ServletException e) { } catch (ServletException e) {
LOG.error("Error while initializing AtlasAuthenticationFilter : " + e.getMessage()); LOG.error("Error while initializing AtlasAuthenticationFilter : {}", e.getMessage());
} }
} }
...@@ -149,7 +150,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { ...@@ -149,7 +150,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
@Override @Override
public void initializeSecretProvider(FilterConfig filterConfig) public void initializeSecretProvider(FilterConfig filterConfig)
throws ServletException { throws ServletException {
LOG.debug("AtlasAuthenticationFilter :: initializeSecretProvider " + filterConfig); LOG.debug("AtlasAuthenticationFilter :: initializeSecretProvider {}", filterConfig);
secretProvider = (SignerSecretProvider) filterConfig.getServletContext(). secretProvider = (SignerSecretProvider) filterConfig.getServletContext().
getAttribute(AuthenticationFilter.SIGNER_SECRET_PROVIDER_ATTRIBUTE); getAttribute(AuthenticationFilter.SIGNER_SECRET_PROVIDER_ATTRIBUTE);
if (secretProvider == null) { if (secretProvider == null) {
...@@ -278,7 +279,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { ...@@ -278,7 +279,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
SecurityContextHolder.getContext().setAuthentication(finalAuthentication); SecurityContextHolder.getContext().setAuthentication(finalAuthentication);
request.setAttribute("atlas.http.authentication.type", true); request.setAttribute("atlas.http.authentication.type", true);
LOG.info("Logged into Atlas as = " + userName); LOG.info("Logged into Atlas as = {}", userName);
} }
} }
// OPTIONS method is sent from quick start jersey atlas client // OPTIONS method is sent from quick start jersey atlas client
...@@ -357,7 +358,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { ...@@ -357,7 +358,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
token = getToken(httpRequest); token = getToken(httpRequest);
} }
catch (AuthenticationException ex) { catch (AuthenticationException ex) {
LOG.warn("AuthenticationToken ignored: " + ex.getMessage()); LOG.warn("AuthenticationToken ignored: {}", ex.getMessage());
// will be sent back in a 401 unless filter authenticates // will be sent back in a 401 unless filter authenticates
authenticationEx = ex; authenticationEx = ex;
token = null; token = null;
...@@ -412,7 +413,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter { ...@@ -412,7 +413,7 @@ public class AtlasAuthenticationFilter extends AuthenticationFilter {
// exception from the filter itself is fatal // exception from the filter itself is fatal
errCode = HttpServletResponse.SC_FORBIDDEN; errCode = HttpServletResponse.SC_FORBIDDEN;
authenticationEx = ex; authenticationEx = ex;
LOG.warn("Authentication exception: " + ex.getMessage(), ex); LOG.warn("Authentication exception: {}", ex.getMessage(), ex);
} }
if (unauthorizedResponse) { if (unauthorizedResponse) {
if (!httpResponse.isCommitted()) { if (!httpResponse.isCommitted()) {
......
...@@ -18,18 +18,7 @@ ...@@ -18,18 +18,7 @@
package org.apache.atlas.web.filters; package org.apache.atlas.web.filters;
import java.io.IOException; import com.google.common.base.Strings;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasClient;
import org.apache.atlas.authorize.AtlasAccessRequest; import org.apache.atlas.authorize.AtlasAccessRequest;
import org.apache.atlas.authorize.AtlasAuthorizationException; import org.apache.atlas.authorize.AtlasAuthorizationException;
...@@ -44,7 +33,16 @@ import org.springframework.security.core.GrantedAuthority; ...@@ -44,7 +33,16 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.filter.GenericFilterBean; import org.springframework.web.filter.GenericFilterBean;
import com.google.common.base.Strings; import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
public class AtlasAuthorizationFilter extends GenericFilterBean { public class AtlasAuthorizationFilter extends GenericFilterBean {
...@@ -95,7 +93,7 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { ...@@ -95,7 +93,7 @@ public class AtlasAuthorizationFilter extends GenericFilterBean {
String pathInfo = request.getServletPath(); String pathInfo = request.getServletPath();
if (!Strings.isNullOrEmpty(pathInfo) && pathInfo.startsWith(BASE_URL)) { if (!Strings.isNullOrEmpty(pathInfo) && pathInfo.startsWith(BASE_URL)) {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug(pathInfo + " is a valid REST API request!!!"); LOG.debug("{} is a valid REST API request!!!", pathInfo);
} }
String userName = null; String userName = null;
...@@ -111,16 +109,13 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { ...@@ -111,16 +109,13 @@ public class AtlasAuthorizationFilter extends GenericFilterBean {
} }
} else { } else {
if (LOG.isErrorEnabled()) { if (LOG.isErrorEnabled()) {
LOG.error("Cannot obtain Security Context : " + auth); LOG.error("Cannot obtain Security Context : {}", auth);
} }
throw new ServletException("Cannot obtain Security Context : " + auth); throw new ServletException("Cannot obtain Security Context : " + auth);
} }
AtlasAccessRequest atlasRequest = new AtlasAccessRequest(request, userName, groups); AtlasAccessRequest atlasRequest = new AtlasAccessRequest(request, userName, groups);
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("============================\n" + "UserName :: " + atlasRequest.getUser() + "\nGroups :: " LOG.debug("============================\nUserName :: {}\nGroups :: {}\nURL :: {}\nAction :: {}\nrequest.getServletPath() :: {}\n============================\n", atlasRequest.getUser(), atlasRequest.getUserGroups(), request.getRequestURL(), atlasRequest.getAction(), pathInfo);
+ atlasRequest.getUserGroups() + "\nURL :: " + request.getRequestURL() + "\nAction :: "
+ atlasRequest.getAction() + "\nrequest.getServletPath() :: " + pathInfo
+ "\n============================\n");
} }
boolean accessAllowed = false; boolean accessAllowed = false;
...@@ -129,7 +124,7 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { ...@@ -129,7 +124,7 @@ public class AtlasAuthorizationFilter extends GenericFilterBean {
if (atlasResourceTypes.size() == 1 && atlasResourceTypes.contains(AtlasResourceTypes.UNKNOWN)) { if (atlasResourceTypes.size() == 1 && atlasResourceTypes.contains(AtlasResourceTypes.UNKNOWN)) {
// Allowing access to unprotected resource types // Allowing access to unprotected resource types
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Allowing access to unprotected resource types " + atlasResourceTypes); LOG.debug("Allowing access to unprotected resource types {}", atlasResourceTypes);
} }
accessAllowed = true; accessAllowed = true;
} else { } else {
...@@ -140,11 +135,11 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { ...@@ -140,11 +135,11 @@ public class AtlasAuthorizationFilter extends GenericFilterBean {
} }
} catch (AtlasAuthorizationException e) { } catch (AtlasAuthorizationException e) {
if (LOG.isErrorEnabled()) { if (LOG.isErrorEnabled()) {
LOG.error("Access Restricted. Could not process the request :: " + e); LOG.error("Access Restricted. Could not process the request :: {}", e);
} }
} }
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Authorizer result :: " + accessAllowed); LOG.debug("Authorizer result :: {}", accessAllowed);
} }
} }
if (accessAllowed) { if (accessAllowed) {
...@@ -162,15 +157,13 @@ public class AtlasAuthorizationFilter extends GenericFilterBean { ...@@ -162,15 +157,13 @@ public class AtlasAuthorizationFilter extends GenericFilterBean {
response.sendError(HttpServletResponse.SC_FORBIDDEN, json.toString()); response.sendError(HttpServletResponse.SC_FORBIDDEN, json.toString());
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("You are not authorized for " + atlasRequest.getAction().name() + " on " LOG.debug("You are not authorized for {} on {} : {}\nReturning 403 since the access is blocked update!!!!", atlasRequest.getAction().name(), atlasResourceTypes, atlasRequest.getResource());
+ atlasResourceTypes + " : " + atlasRequest.getResource()
+ "\nReturning 403 since the access is blocked update!!!!");
} }
} }
} else { } else {
if (isDebugEnabled) { if (isDebugEnabled) {
LOG.debug("Ignoring request " + pathInfo); LOG.debug("Ignoring request {}", pathInfo);
} }
chain.doFilter(req, res); chain.doFilter(req, res);
} }
......
...@@ -237,7 +237,7 @@ public class AtlasKnoxSSOAuthenticationFilter implements Filter { ...@@ -237,7 +237,7 @@ public class AtlasKnoxSSOAuthenticationFilter implements Filter {
for (Cookie cookie : cookies) { for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) { if (cookieName.equals(cookie.getName())) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug(cookieName + " cookie has been found and is being processed"); LOG.debug("{} cookie has been found and is being processed", cookieName);
} }
serializedJWT = cookie.getValue(); serializedJWT = cookie.getValue();
break; break;
......
...@@ -102,7 +102,7 @@ public class GuiceServletConfig extends GuiceServletContextListener { ...@@ -102,7 +102,7 @@ public class GuiceServletConfig extends GuiceServletContextListener {
String initParamValue = getServletContext().getInitParameter(initParamName); String initParamValue = getServletContext().getInitParameter(initParamName);
if (GUICE_CTX_PARAM.equals(initParamName)) { if (GUICE_CTX_PARAM.equals(initParamName)) {
LOG.info("Jersey loading from packages: " + initParamValue); LOG.info("Jersey loading from packages: {}", initParamValue);
initParams.put(PackagesResourceConfig.PROPERTY_PACKAGES, initParamValue); initParams.put(PackagesResourceConfig.PROPERTY_PACKAGES, initParamValue);
} else { } else {
......
...@@ -268,10 +268,10 @@ public class EntityResource { ...@@ -268,10 +268,10 @@ public class EntityResource {
LOG.error("An entity with type={} and qualifiedName={} does not exist {} ", entityType, value, entityJson, e); LOG.error("An entity with type={} and qualifiedName={} does not exist {} ", entityType, value, entityJson, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND)); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND));
} catch (AtlasException | IllegalArgumentException e) { } catch (AtlasException | IllegalArgumentException e) {
LOG.error("Unable to partially update entity {} {} " + entityType + ":" + attribute + "." + value, entityJson, e); LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType, attribute, value, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (Throwable e) { } catch (Throwable e) {
LOG.error("Unable to partially update entity {} {} " + entityType + ":" + attribute + "." + value, entityJson, e); LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType, attribute, value, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR)); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
} }
} }
......
...@@ -40,7 +40,7 @@ public class AtlasSetup { ...@@ -40,7 +40,7 @@ public class AtlasSetup {
public AtlasSetup() { public AtlasSetup() {
injector = Guice.createInjector(new AtlasSetupModule()); injector = Guice.createInjector(new AtlasSetupModule());
LOG.info("Got injector: " + injector); LOG.info("Got injector: {}", injector);
} }
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -71,7 +71,7 @@ public class SetupSteps { ...@@ -71,7 +71,7 @@ public class SetupSteps {
LOG.info("Acquired lock for running setup."); LOG.info("Acquired lock for running setup.");
handleSetupInProgress(configuration, zookeeperProperties); handleSetupInProgress(configuration, zookeeperProperties);
for (SetupStep step : setupSteps) { for (SetupStep step : setupSteps) {
LOG.info("Running setup step: " + step); LOG.info("Running setup step: {}", step);
step.run(); step.run();
} }
clearSetupInProgress(zookeeperProperties); clearSetupInProgress(zookeeperProperties);
......
...@@ -134,7 +134,7 @@ public class EntityNotificationIT extends BaseResourceIT { ...@@ -134,7 +134,7 @@ public class EntityNotificationIT extends BaseResourceIT {
Struct traitInstance = new Struct(traitName); Struct traitInstance = new Struct(traitName);
String traitInstanceJSON = InstanceSerialization.toJson(traitInstance, true); String traitInstanceJSON = InstanceSerialization.toJson(traitInstance, true);
LOG.debug("Trait instance = " + traitInstanceJSON); LOG.debug("Trait instance = {}", traitInstanceJSON);
final String guid = tableId._getId(); final String guid = tableId._getId();
...@@ -161,7 +161,7 @@ public class EntityNotificationIT extends BaseResourceIT { ...@@ -161,7 +161,7 @@ public class EntityNotificationIT extends BaseResourceIT {
traitInstance = new Struct(anotherTraitName); traitInstance = new Struct(anotherTraitName);
traitInstanceJSON = InstanceSerialization.toJson(traitInstance, true); traitInstanceJSON = InstanceSerialization.toJson(traitInstance, true);
LOG.debug("Trait instance = " + traitInstanceJSON); LOG.debug("Trait instance = {}", traitInstanceJSON);
atlasClientV1.addTrait(guid, traitInstance); atlasClientV1.addTrait(guid, traitInstance);
...@@ -200,7 +200,7 @@ public class EntityNotificationIT extends BaseResourceIT { ...@@ -200,7 +200,7 @@ public class EntityNotificationIT extends BaseResourceIT {
TypesUtil.createTraitTypeDef(traitName, ImmutableSet.copyOf(superTraitNames)); TypesUtil.createTraitTypeDef(traitName, ImmutableSet.copyOf(superTraitNames));
String traitDefinitionJSON = TypesSerialization$.MODULE$.toJson(trait, true); String traitDefinitionJSON = TypesSerialization$.MODULE$.toJson(trait, true);
LOG.debug("Trait definition = " + traitDefinitionJSON); LOG.debug("Trait definition = {}", traitDefinitionJSON);
createType(traitDefinitionJSON); createType(traitDefinitionJSON);
} }
......
...@@ -398,7 +398,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -398,7 +398,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
final String definition = response.getString(AtlasClient.DEFINITION); final String definition = response.getString(AtlasClient.DEFINITION);
Assert.assertNotNull(definition); Assert.assertNotNull(definition);
LOG.debug("tableInstanceAfterGet = " + definition); LOG.debug("tableInstanceAfterGet = {}", definition);
InstanceSerialization.fromJsonReferenceable(definition, true); InstanceSerialization.fromJsonReferenceable(definition, true);
} }
...@@ -483,12 +483,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -483,12 +483,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
HierarchicalTypeDefinition<TraitType> piiTrait = HierarchicalTypeDefinition<TraitType> piiTrait =
TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true); String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON); LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
createType(traitDefinitionAsJSON); createType(traitDefinitionAsJSON);
Struct traitInstance = new Struct(traitName); Struct traitInstance = new Struct(traitName);
String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true); String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON); LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
final String guid = tableId._getId(); final String guid = tableId._getId();
JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS); JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
...@@ -504,12 +504,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -504,12 +504,12 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
HierarchicalTypeDefinition<TraitType> piiTrait = HierarchicalTypeDefinition<TraitType> piiTrait =
TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true); String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON); LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
createType(traitDefinitionAsJSON); createType(traitDefinitionAsJSON);
Struct traitInstance = new Struct(traitName); Struct traitInstance = new Struct(traitName);
String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true); String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON); LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
final String guid = tableId._getId(); final String guid = tableId._getId();
JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS); JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
...@@ -531,7 +531,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -531,7 +531,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
Struct traitInstance = new Struct(traitName); Struct traitInstance = new Struct(traitName);
String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true); String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON); LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
final String guid = tableId._getId(); final String guid = tableId._getId();
JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS); JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
...@@ -545,13 +545,13 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -545,13 +545,13 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
.createTraitTypeDef(traitName, ImmutableSet.<String>of(), .createTraitTypeDef(traitName, ImmutableSet.<String>of(),
TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE)); TypesUtil.createRequiredAttrDef("type", DataTypes.STRING_TYPE));
String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true); String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON); LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
createType(traitDefinitionAsJSON); createType(traitDefinitionAsJSON);
Struct traitInstance = new Struct(traitName); Struct traitInstance = new Struct(traitName);
traitInstance.set("type", "SSN"); traitInstance.set("type", "SSN");
String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true); String traitInstanceAsJSON = InstanceSerialization.toJson(traitInstance, true);
LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON); LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
final String guid = tableId._getId(); final String guid = tableId._getId();
JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS); JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.ADD_TRAITS, traitInstanceAsJSON, guid, TRAITS);
...@@ -576,11 +576,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -576,11 +576,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
HierarchicalTypeDefinition<TraitType> piiTrait = HierarchicalTypeDefinition<TraitType> piiTrait =
TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of()); TypesUtil.createTraitTypeDef(traitName, ImmutableSet.<String>of());
String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true); String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON); LOG.debug("traitDefinitionAsJSON = {}", traitDefinitionAsJSON);
Struct traitInstance = new Struct(traitName); Struct traitInstance = new Struct(traitName);
String traitInstanceAsJSON = InstanceSerialization$.MODULE$.toJson(traitInstance, true); String traitInstanceAsJSON = InstanceSerialization$.MODULE$.toJson(traitInstance, true);
LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON); LOG.debug("traitInstanceAsJSON = {}", traitInstanceAsJSON);
JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, traitInstanceAsJSON, "random", TRAITS); JSONObject response = atlasClientV1.callAPIWithBodyAndParams(AtlasClient.API.CREATE_ENTITY, traitInstanceAsJSON, "random", TRAITS);
} }
...@@ -675,7 +675,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -675,7 +675,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
put("columns", columns); put("columns", columns);
}}); }});
LOG.debug("Updating entity= " + tableUpdated); LOG.debug("Updating entity= {}", tableUpdated);
AtlasClient.EntityResult entityResult = atlasClientV1.updateEntity(tableId._getId(), tableUpdated); AtlasClient.EntityResult entityResult = atlasClientV1.updateEntity(tableId._getId(), tableUpdated);
assertEquals(entityResult.getUpdateEntities().size(), 1); assertEquals(entityResult.getUpdateEntities().size(), 1);
assertEquals(entityResult.getUpdateEntities().get(0), tableId._getId()); assertEquals(entityResult.getUpdateEntities().get(0), tableId._getId());
...@@ -694,7 +694,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -694,7 +694,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
put("columns", columns); put("columns", columns);
}}); }});
LOG.debug("Updating entity= " + tableUpdated); LOG.debug("Updating entity= {}", tableUpdated);
entityResult = atlasClientV1.updateEntity(BaseResourceIT.HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, entityResult = atlasClientV1.updateEntity(BaseResourceIT.HIVE_TABLE_TYPE, AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME,
(String) tableInstance.get(QUALIFIED_NAME), tableUpdated); (String) tableInstance.get(QUALIFIED_NAME), tableUpdated);
assertEquals(entityResult.getUpdateEntities().size(), 2); assertEquals(entityResult.getUpdateEntities().size(), 2);
...@@ -740,7 +740,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -740,7 +740,7 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
String entityJson = InstanceSerialization.toJson(tableInstance, true); String entityJson = InstanceSerialization.toJson(tableInstance, true);
JSONArray entityArray = new JSONArray(1); JSONArray entityArray = new JSONArray(1);
entityArray.put(entityJson); entityArray.put(entityJson);
LOG.debug("Replacing entity= " + tableInstance); LOG.debug("Replacing entity= {}", tableInstance);
JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API.UPDATE_ENTITY, entityArray); JSONObject response = atlasClientV1.callAPIWithBody(AtlasClient.API.UPDATE_ENTITY, entityArray);
......
...@@ -114,7 +114,7 @@ public class FileAuthenticationTest { ...@@ -114,7 +114,7 @@ public class FileAuthenticationTest {
when(authentication.getCredentials()).thenReturn("admin"); when(authentication.getCredentials()).thenReturn("admin");
Authentication auth = authProvider.authenticate(authentication); Authentication auth = authProvider.authenticate(authentication);
LOG.debug(" " + auth); LOG.debug(" {}", auth);
Assert.assertTrue(auth.isAuthenticated()); Assert.assertTrue(auth.isAuthenticated());
} }
...@@ -127,7 +127,7 @@ public class FileAuthenticationTest { ...@@ -127,7 +127,7 @@ public class FileAuthenticationTest {
try { try {
Authentication auth = authProvider.authenticate(authentication); Authentication auth = authProvider.authenticate(authentication);
LOG.debug(" " + auth); LOG.debug(" {}", auth);
} catch (BadCredentialsException bcExp) { } catch (BadCredentialsException bcExp) {
Assert.assertEquals("Wrong password", bcExp.getMessage()); Assert.assertEquals("Wrong password", bcExp.getMessage());
} }
...@@ -140,7 +140,7 @@ public class FileAuthenticationTest { ...@@ -140,7 +140,7 @@ public class FileAuthenticationTest {
when(authentication.getCredentials()).thenReturn("wrongpassword"); when(authentication.getCredentials()).thenReturn("wrongpassword");
try { try {
Authentication auth = authProvider.authenticate(authentication); Authentication auth = authProvider.authenticate(authentication);
LOG.debug(" " + auth); LOG.debug(" {}", auth);
} catch (UsernameNotFoundException uExp) { } catch (UsernameNotFoundException uExp) {
Assert.assertTrue(uExp.getMessage().contains("Username not found.")); Assert.assertTrue(uExp.getMessage().contains("Username not found."));
} }
...@@ -153,7 +153,7 @@ public class FileAuthenticationTest { ...@@ -153,7 +153,7 @@ public class FileAuthenticationTest {
when(authentication.getCredentials()).thenReturn("user12"); when(authentication.getCredentials()).thenReturn("user12");
try { try {
Authentication auth = authProvider.authenticate(authentication); Authentication auth = authProvider.authenticate(authentication);
LOG.debug(" " + auth); LOG.debug(" {}", auth);
} catch (AtlasAuthenticationException uExp) { } catch (AtlasAuthenticationException uExp) {
Assert.assertTrue(uExp.getMessage().startsWith("User role credentials is not set properly for")); Assert.assertTrue(uExp.getMessage().startsWith("User role credentials is not set properly for"));
} }
...@@ -167,7 +167,7 @@ public class FileAuthenticationTest { ...@@ -167,7 +167,7 @@ public class FileAuthenticationTest {
when(authentication.getCredentials()).thenReturn("P@ssword"); when(authentication.getCredentials()).thenReturn("P@ssword");
try { try {
Authentication auth = authProvider.authenticate(authentication); Authentication auth = authProvider.authenticate(authentication);
LOG.debug(" " + auth); LOG.debug(" {}", auth);
} catch (UsernameNotFoundException uExp) { } catch (UsernameNotFoundException uExp) {
Assert.assertTrue(uExp.getMessage().startsWith("Username not found")); Assert.assertTrue(uExp.getMessage().startsWith("Username not found"));
} }
...@@ -180,7 +180,7 @@ public class FileAuthenticationTest { ...@@ -180,7 +180,7 @@ public class FileAuthenticationTest {
when(authentication.getCredentials()).thenReturn("admin"); when(authentication.getCredentials()).thenReturn("admin");
Authentication auth = authProvider.authenticate(authentication); Authentication auth = authProvider.authenticate(authentication);
LOG.debug(" " + auth); LOG.debug(" {}", auth);
Assert.assertTrue(auth.isAuthenticated()); Assert.assertTrue(auth.isAuthenticated());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment