Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public BasicAlarmService(MessageBus messageBus, Settings settings, AlarmStore st

@Override
public void addHandler(AlarmHandler handler) {
log.info("Adding handler '" + handler.getClass().getName() + "' for alarms.");
log.info("Adding handler '{}' for alarms.", handler.getClass().getName());
alarmMediator.addHandler(handler);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ public class AlarmLogger implements AlarmHandler {
* Constructor. Nothing to initialize.
*/
public AlarmLogger() {
log.debug("Instantiating the AlarmHandler '" + this.getClass().getCanonicalName() + "'");
log.debug("Instantiating the AlarmHandler '{}'", this.getClass().getCanonicalName());
}

@Override
public void handleAlarm(AlarmMessage msg) {
log.info("ALARM: " + msg.toString());
log.info("ALARM: {}", msg.toString());
}

@Override
public void close() {
log.debug("Closing the AlarmHandler '" + this.getClass().getCanonicalName() + "'");
log.debug("Closing the AlarmHandler '{}'", this.getClass().getCanonicalName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public AlarmMailer(AlarmServiceSettings settings) {
this.messageReceiver = config.getMailReceiver();
this.messageSender = config.getMailSender();
this.mailServer = config.getMailServer();
log.debug("Instantiating the AlarmHandler '" + this.getClass().getCanonicalName() + "'");
log.debug("Instantiating the AlarmHandler '{}'", this.getClass().getCanonicalName());
}

@Override
Expand Down Expand Up @@ -208,6 +208,6 @@ private void sendMessage(Message msg) {

@Override
public void close() {
log.debug("Closing the AlarmHandler '" + this.getClass().getCanonicalName() + "'");
log.debug("Closing the AlarmHandler '{}'", this.getClass().getCanonicalName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void handleAlarm(AlarmMessage message) {

@Override
public void close() {
log.debug("Closing the AlarmHandler '" + this.getClass().getCanonicalName() + "'");
log.debug("Closing the AlarmHandler '{}'", this.getClass().getCanonicalName());
store.shutdown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public List<Alarm> extractAlarms() {
List<Alarm> res = new ArrayList<>();
ps.setFetchSize(100);
try (ResultSet result = ps.executeQuery()) {
log.debug("Extracting sql '" + sql + "' with arguments '" + Arrays.asList(extractArgumentsFromModel()) + "'");
log.debug("Extracting sql '{}' with arguments '{}'", sql, Arrays.asList(extractArgumentsFromModel()));
while (result.next()) {
res.add(extractAlarm(result));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private synchronized long retrieveComponentGuid(String componentId) {
Long guid = DatabaseUtils.selectLongValue(dbConnector, sqlRetrieve, componentId);

if (guid == null) {
log.debug("Inserting component '" + componentId + "' into the component table.");
log.debug("Inserting component '{}' into the component table", componentId);
String sqlInsert = "INSERT INTO " + COMPONENT_TABLE + " ( " + COMPONENT_ID + " ) VALUES ( ? )";
DatabaseUtils.executeStatement(dbConnector, sqlInsert, componentId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ public AuditTrailCollector(Settings settings, AuditTrailClient client, AuditTrai
alarmDispatcher);
AuditTrailCollectionTimerTask collectorTask = new AuditTrailCollectionTimerTask(
collector, collectionIntervalMillis, Math.toIntExact(getGracePeriod().toMillis()));
log.info("Will start collection of audit trail every " +
TimeUtils.durationToHuman(collectionInterval) + " " +
"after a grace period of " + TimeUtils.durationToHuman(getGracePeriod()));
log.info("Will start collection of audit trails every {} after a grace period of {}",
TimeUtils.durationToHuman(collectionInterval), TimeUtils.durationToHuman(getGracePeriod()));
timer.scheduleAtFixedRate(collectorTask, getGracePeriod().toMillis(), collectionIntervalMillis / 10);
collectorTasks.put(c.getID(), collectorTask);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public AuditEventIterator extractAuditEventsByIterator() {
+ joinWithContributorTable() + createRestriction()
+ " ORDER BY " + AUDIT_TRAIL_TABLE + "." + AUDIT_TRAIL_OPERATION_DATE;
try {
log.debug("Creating prepared statement with sql '" + sql + "' and arguments '"
+ Arrays.asList(extractArgumentsFromModel()) + " for AuditEventIterator");
log.debug("Creating prepared statement with sql '{}' and arguments '{}' for AuditEventIterator",
sql, Arrays.asList(extractArgumentsFromModel()));
PreparedStatement ps = DatabaseUtils.createPreparedStatement(dbConnector.getConnection(),
sql, extractArgumentsFromModel());
return new AuditEventIterator(ps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public void getFileFromFastestPillar(String collectionID, String fileID, FilePar
ArgumentValidator.checkNotNull(eventHandler, "eventHandler");
validateFileID(fileID);

log.info("Requesting the file '" + fileID + " from the fastest pillar");
getFile(collectionID, messageBus, settings, fileID, filePart, SettingsUtils.getPillarIDsForCollection(collectionID), uploadUrl,
eventHandler, auditTrailInformation);
log.info("Requesting the file '{}' from the fastest pillar", fileID);
getFile(collectionID, messageBus, settings, fileID, filePart,
SettingsUtils.getPillarIDsForCollection(collectionID), uploadUrl, eventHandler, auditTrailInformation);
}

/**
Expand All @@ -109,8 +109,9 @@ public void getFileFromSpecificPillar(String collectionID, String fileID, FilePa
ArgumentValidator.checkNotNull(eventHandler, "eventHandler");
validateFileID(fileID);

log.info("Requesting the file '" + fileID + "' from pillar '" + pillarID + "'.");
getFile(collectionID, messageBus, settings, fileID, filePart, List.of(pillarID), uploadUrl, eventHandler, auditTrailInformation);
log.info("Requesting the file '{}' from pillar '{}'", fileID, pillarID);
getFile(collectionID, messageBus, settings, fileID, filePart, List.of(pillarID), uploadUrl, eventHandler,
auditTrailInformation);
}

/**
Expand All @@ -128,8 +129,8 @@ public void getFileFromSpecificPillar(String collectionID, String fileID, FilePa
*/
private void getFile(String collectionID, MessageBus messageBus, Settings settings, String fileID, FilePart filePart,
Collection<String> contributors, URL uploadUrl, EventHandler eventHandler, String auditTrailInformation) {
GetFileConversationContext context = new GetFileConversationContext(collectionID, fileID, uploadUrl, filePart, contributors,
settings, messageBus, clientID, eventHandler, auditTrailInformation);
GetFileConversationContext context = new GetFileConversationContext(collectionID, fileID, uploadUrl, filePart,
contributors, settings, messageBus, clientID, eventHandler, auditTrailInformation);
startConversation(context, new IdentifyingPillarsForGetFile(context));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* The reference implementation of the client side of the GetFileIDs identification and operation.
* The default <code>GetFileIDsClient</code>
* <p>
* This class is just a thin wrapper which creates a conversion each time a operation is started.
* This class is just a thin wrapper which creates a conversion each time an operation is started.
*/
public class ConversationBasedGetFileIDsClient extends AbstractClient implements GetFileIDsClient {
private final Logger log = LoggerFactory.getLogger(getClass());
Expand All @@ -57,25 +57,27 @@ public class ConversationBasedGetFileIDsClient extends AbstractClient implements
* @param clientID The ID of the client
* @see AbstractClient
*/
public ConversationBasedGetFileIDsClient(MessageBus messageBus, ConversationMediator conversationMediator, Settings settings,
String clientID) {
public ConversationBasedGetFileIDsClient(MessageBus messageBus, ConversationMediator conversationMediator,
Settings settings, String clientID) {
super(settings, conversationMediator, messageBus, clientID);
}

@Override
public void getFileIDs(String collectionID, ContributorQuery[] contributorQueries, String fileID, URL addressForResult,
EventHandler eventHandler) {
public void getFileIDs(String collectionID, ContributorQuery[] contributorQueries, String fileID,
URL addressForResult, EventHandler eventHandler) {
ArgumentValidator.checkNotNullOrEmpty(collectionID, "collectionID");
validateFileID(fileID);
if (contributorQueries == null) {
contributorQueries = ContributorQueryUtils.createFullContributorQuery(SettingsUtils.getPillarIDsForCollection(collectionID));
contributorQueries = ContributorQueryUtils.createFullContributorQuery(
SettingsUtils.getPillarIDsForCollection(collectionID));
}

log.info("Requesting the fileIDs for file '" + fileID + "' with query " + Arrays.asList(contributorQueries) + ". " +
log.info("Requesting the fileIDs for file '{}' with query {}. {}", fileID, Arrays.asList(contributorQueries),
(addressForResult != null ? "The result should be uploaded to '" + addressForResult + "'." : ""));

GetFileIDsConversationContext context = new GetFileIDsConversationContext(collectionID, contributorQueries, fileID,
addressForResult, settings, messageBus, clientID, ContributorQueryUtils.getContributors(contributorQueries), eventHandler);
GetFileIDsConversationContext context = new GetFileIDsConversationContext(
collectionID, contributorQueries, fileID, addressForResult, settings, messageBus, clientID,
ContributorQueryUtils.getContributors(contributorQueries), eventHandler);

startConversation(context, new IdentifyPillarsForGetFileIDs(context));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class ConversationEventMonitor {
/**
* The general logger.
*/
private final ConversationLogger log;
private final ConversationLogger logger;
/**
* The event logger. Adds context information to the log entry.
*/
Expand Down Expand Up @@ -94,7 +94,7 @@ public class ConversationEventMonitor {
*/
public ConversationEventMonitor(String collectionID, String conversationID, OperationType operationType, String fileID,
EventHandler eventHandler) {
log = new ConversationLogger();
logger = new ConversationLogger();
this.collectionID = collectionID;
this.conversationID = getShortConversationID(conversationID);
this.operationType = operationType;
Expand Down Expand Up @@ -260,7 +260,8 @@ public void operationFailed(OperationFailedEvent event) {
* @param e Description of the context
*/
public void invalidMessage(Message message, Exception e) {
log.warn("Received invalid " + message.getClass().getSimpleName() + " from " + message.getFrom() + "\nMessage: " + message, e);
logger.warn("Received invalid " + message.getClass().getSimpleName() + " from " + message.getFrom() +
"\nMessage: " + message, e);
notifyEventListeners((createContributorEvent(WARNING, e.getMessage(), message.getFrom())));
}

Expand All @@ -270,7 +271,7 @@ public void invalidMessage(Message message, Exception e) {
* @param message the message
*/
public void outOfSequenceMessage(Message message) {
log.warn("Can not handle messages of type " + message.getClass().getSimpleName());
logger.warn("Can not handle messages of type " + message.getClass().getSimpleName());
}

/**
Expand Down Expand Up @@ -302,7 +303,7 @@ public void warning(String info, Exception e) {
* @param info The debug info to log.
*/
public void debug(String info) {
log.debug(info);
logger.debug(info);
}

/**
Expand All @@ -312,7 +313,7 @@ public void debug(String info) {
* @param e the Exception to log
*/
public void debug(String info, Exception e) {
log.debug(info, e);
logger.debug(info, e);
}

/**
Expand Down Expand Up @@ -457,7 +458,7 @@ private void notifyEventListeners(OperationEvent event) {
try {
eventHandler.handleEvent(event);
} catch (Throwable thr) {
log.warn("The eventHandler (" + eventHandler + ") failed when called with event " + event, thr);
logger.warn("The eventHandler (" + eventHandler + ") failed when called with event " + event, thr);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public void deleteFile(String collectionID, String fileID, String pillarID,
ArgumentValidator.checkNotNull(checksumForPillar, "ChecksumForPillar");
}

log.info("Requesting the deletion of the file '" + fileID + "' from the pillar '" + pillarID
+ "' with checksum '" + checksumForPillar + "', while requested checksum '" + checksumRequested
+ "'. And the audit trail information '" + auditTrailInformation + "'.");
log.info("Requesting the deletion of the file '{}' from the pillar '{}' with checksum '{}'," +
" and requested checksum type '{}'. Audit trail info: '{}'",
fileID, pillarID, checksumForPillar, checksumRequested, auditTrailInformation);

DeleteFileConversationContext context = new DeleteFileConversationContext(collectionID, fileID,
checksumForPillar, checksumRequested, settings, messageBus, clientID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public void putFile(String collectionID, URL url, String fileID, long sizeOfFile
MessageDataTypeValidator.validate(checksumForValidationAtPillar, "checksumForValidationAtPillar");
MessageDataTypeValidator.validate(checksumRequestsForValidation, "checksumRequestsForValidation");

log.info("Starting putFile of " + fileID + " for client " + clientID + ". " + auditTrailInformation);
log.info("Starting putFile of file '{}' for client '{}'. Audit trail info: {}",
fileID, clientID, auditTrailInformation);
if (settings.getRepositorySettings().getProtocolSettings().isRequireChecksumForNewFileRequests()) {
ArgumentValidator.checkNotNull(checksumForValidationAtPillar, "ChecksumDataForFileTYPE checksumForValidationAtPillar");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.bitrepository.client.eventhandler.EventHandler;
import org.bitrepository.common.ArgumentValidator;
import org.bitrepository.common.settings.Settings;
import org.bitrepository.common.utils.FileSizeUtils;
import org.bitrepository.modify.replacefile.conversation.IdentifyPillarsForReplaceFile;
import org.bitrepository.modify.replacefile.conversation.ReplaceFileConversationContext;
import org.bitrepository.protocol.messagebus.MessageBus;
Expand Down Expand Up @@ -67,27 +68,28 @@ public void replaceFile(String collectionID, String fileID, String pillarID, Che
EventHandler eventHandler, String auditTrailInformation) {
ArgumentValidator.checkNotNullOrEmpty(collectionID, "collectionID");
ArgumentValidator.checkNotNullOrEmpty(fileID, "fileID");
validateFileID(fileID);
ArgumentValidator.checkNotNullOrEmpty(fileID, "String fileID");
ArgumentValidator.checkNotNullOrEmpty(pillarID, "String pillarID");
validateFileID(fileID);
if (settings.getRepositorySettings().getProtocolSettings().isRequireChecksumForDestructiveRequests()) {
ArgumentValidator.checkNotNull(checksumForDeleteAtPillar, "ChecksumDataForFileTYPE checksumForDeleteAtPillar");
ArgumentValidator.checkNotNull(checksumForDeleteAtPillar,
"ChecksumDataForFileTYPE checksumForDeleteAtPillar");
MessageDataTypeValidator.validate(checksumForDeleteAtPillar, "checksumForDeleteAtPillar");
}
if (settings.getRepositorySettings().getProtocolSettings().isRequireChecksumForNewFileRequests()) {
ArgumentValidator.checkNotNull(checksumForNewFileValidationAtPillar,
"ChecksumDataForFileTYPE checksumForNewFileValidationAtPillar");
MessageDataTypeValidator.validate(checksumForNewFileValidationAtPillar, "checksumForNewFileValidationAtPillar");
MessageDataTypeValidator.validate(checksumForNewFileValidationAtPillar,
"checksumForNewFileValidationAtPillar");
}
MessageDataTypeValidator.validate(checksumRequestedForDeletedFile, "checksumRequestedForDeletedFile");
MessageDataTypeValidator.validate(checksumRequestsForNewFile, "checksumRequestsForNewFile");

log.info("Requesting the replacement of the file '" + fileID + "' at the pillar '" + pillarID + "' from the "
+ "URL '" + url + "' and with the size '" + sizeOfNewFile + "', where the old file has the checksum '"
+ checksumForDeleteAtPillar + "' and is requested the checksum '" + checksumRequestedForDeletedFile
+ "', and the new file has the checksum '" + checksumForNewFileValidationAtPillar + "' and requesting "
+ "the checksum '" + checksumRequestsForNewFile + "'. With the auditTrail '" + auditTrailInformation
+ "'");
log.info("Requesting replacement of file '{}' at pillar '{}' from URL '{}' with size {}," +
" where old file has checksum '{}' and requested checksum spec '{}'." +
" New file has checksum '{}' and requested checksum spec '{}'. Audit trail info: '{}'",
fileID, pillarID, url, FileSizeUtils.toHumanShort(sizeOfNewFile), checksumForDeleteAtPillar,
checksumRequestedForDeletedFile, checksumForNewFileValidationAtPillar, checksumRequestsForNewFile,
auditTrailInformation);
ReplaceFileConversationContext context = new ReplaceFileConversationContext(collectionID, fileID,
sizeOfNewFile, url, checksumForDeleteAtPillar, checksumRequestedForDeletedFile,
checksumForNewFileValidationAtPillar, checksumRequestsForNewFile, settings, messageBus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public <T> T loadSettings(Class<T> settingsClass) {
throw new RuntimeException("Unable to load settings from " + fileLocation, e);
}
}
log.debug("Loading the settings file '" + fileLocation + "'.");
log.debug("Loading the settings file '{}'", fileLocation);
try {
jaxbHelper.validate(configStreamValidate);
return jaxbHelper.loadXml(settingsClass, configStreamLoad);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void setTimeZone(TimeZone timezone) {
*/
public static XMLGregorianCalendar getXmlGregorianCalendar(Date date) {
if (date == null) {
log.debug("Cannot convert the date '" + date + "'. Returning epoch instead.");
log.debug("Date is null. Returning epoch instead.");
date = new Date(0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static void deleteDirIfExists(File dir) {
}
}
if (!dir.delete()) {
log.warn("Could not delete '" + dir.getAbsolutePath() + "'");
log.warn("Could not delete '{}'", dir.getAbsolutePath());
}
}

Expand Down
Loading