use of com.openmeap.util.SLF4JLoggerFacade in project OpenMEAP by OpenMEAP.
the class FileOperationManagerImpl method _setup.
private void _setup() throws FileOperationException {
if (fileResourceManager != null) {
return;
}
GlobalSettings settings = (GlobalSettings) modelService.findByPrimaryKey(GlobalSettings.class, 1L);
if (settings.getTemporaryStoragePath() == null || !new File(settings.getTemporaryStoragePath()).exists()) {
String msg = "The storage path has not been set in GlobalSettings. Use the settings page to fix this.";
logger.error(msg);
throw new FileOperationException(msg);
}
FileResourceManager resMgr = new FileResourceManager(settings.getTemporaryStoragePath(), settings.getTemporaryStoragePath() + "/tmp", false, new SLF4JLoggerFacade(LoggerFactory.getLogger(FileResourceManager.class)));
fileResourceManager = resMgr;
}
use of com.openmeap.util.SLF4JLoggerFacade in project OpenMEAP by OpenMEAP.
the class FileOperationManagerImplTest method setUp.
/**
* Creates the working/store directories, sets up the logger, and creates the FileOperationManager.
* @throws IOException
*/
@BeforeClass
public static void setUp() throws IOException {
org.apache.log4j.BasicConfigurator.configure();
org.apache.log4j.Logger.getLogger("org.apache.commons").setLevel(Level.OFF);
org.apache.log4j.Logger.getLogger("Locking").setLevel(Level.OFF);
org.apache.log4j.Logger.getLogger("com.openmeap").setLevel(Level.TRACE);
new File(STOREDIR).mkdir();
new File(WORKDIR).mkdir();
File f = new File(STOREDIR + File.separator + TEST_FILE);
OutputStream stream = new BufferedOutputStream(new FileOutputStream(f));
InputStream inputStream = new ByteArrayInputStream(TEST_TEXT.getBytes());
try {
Utils.pipeInputStreamIntoOutputStream(inputStream, stream);
} finally {
if (stream != null) {
stream.close();
}
}
mgr = new FileOperationManagerImpl();
FileResourceManager resMgr = new FileResourceManager(STOREDIR, WORKDIR, false, new SLF4JLoggerFacade(LoggerFactory.getLogger("org.apache.commons.transaction.file")));
mgr.setFileResourceManager(resMgr);
}
Aggregations