Skip to content
Snippets Groups Projects
Commit 77494e6a authored by buczekp's avatar buczekp
Browse files

[LMS-1264] TODO

SVN: 13508
parent 4ca35f92
No related branches found
No related tags found
No related merge requests found
......@@ -16,8 +16,14 @@
package ch.ethz.bsse.cisd.dsu.tracking.main;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import org.apache.commons.io.IOUtils;
import ch.ethz.bsse.cisd.dsu.tracking.email.EntityTrackingEmailGenerator;
import ch.ethz.bsse.cisd.dsu.tracking.email.IEntityTrackingEmailGenerator;
import ch.ethz.bsse.cisd.dsu.tracking.utils.LogUtils;
......@@ -38,6 +44,8 @@ public class TrackingClient
private static final String LOCAL_STORAGE_FILE = "etc/tracking-local-database";
private static final String EMAIL_TEMPLATE_FILE = "etc/tracking-email.template";
public static void main(String[] args)
{
try
......@@ -59,9 +67,8 @@ public class TrackingClient
Parameters params = new Parameters(props);
ITrackingServer trackingServer = createOpenBISTrackingServer(params);
// TODO 2009--, Tomasz Pylak: load template from file
IEntityTrackingEmailGenerator emailGenerator =
new EntityTrackingEmailGenerator(props, "BEGINNING \n{generated-content}\n END!");
new EntityTrackingEmailGenerator(props, retrieveEmailTemplate());
IMailClient mailClient = params.getMailClient();
TrackingBO trackingBO = new TrackingBO(trackingServer, emailGenerator, mailClient);
......@@ -97,6 +104,23 @@ public class TrackingClient
}
}
private static String retrieveEmailTemplate()
{
try
{
return IOUtils.toString(new FileReader(new File(EMAIL_TEMPLATE_FILE)));
} catch (FileNotFoundException ex)
{
throw LogUtils.environmentError("Couldn't find email template file '%s'.",
EMAIL_TEMPLATE_FILE);
} catch (IOException ex)
{
throw LogUtils.environmentError(
"Exception has occured while trying to read template file '%s':%s",
EMAIL_TEMPLATE_FILE, ex.getMessage());
}
}
private static EnvironmentFailureException createAuthentificationException(Parameters params,
Exception exOrNull)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment