Example usage for org.apache.commons.transaction.util PrintWriterLogger PrintWriterLogger

List of usage examples for org.apache.commons.transaction.util PrintWriterLogger PrintWriterLogger

Introduction

In this page you can find the example usage for org.apache.commons.transaction.util PrintWriterLogger PrintWriterLogger.

Prototype

public PrintWriterLogger(PrintWriter printWriter, String name, boolean debug) 

Source Link

Usage

From source file:com.anrisoftware.globalpom.fileresourcemanager.FileResourceManagerProvider.java

@Override
public FileResourceManager get() {
    String workDir = createTmpDir();
    boolean urlEncodePath = false;
    final ByteArrayOutputStream stream = new ByteArrayOutputStream(1024);
    PrintWriter printWriter = new PrintWriter(stream) {
        @Override/*  ww  w . j  a  va 2 s.  com*/
        public void flush() {
            super.flush();
            log.logFileResourceMessage(stream.toString());
        }
    };
    LoggerFacade logger = new PrintWriterLogger(printWriter, "", debug);
    return new FileResourceManager(storeDir, workDir, urlEncodePath, logger);
}

From source file:org.apache.webdav.connector.WebDAVXAResource.java

public WebDAVXAResource(WebdavResource webdavResource, String owner) {
    this.webdavResource = webdavResource;
    this.owner = owner;
    // log important stuff to standard out as long as nothing else is configured
    this.loggerFacade = new PrintWriterLogger(new PrintWriter(System.out), "WebDAVXAResource", false);
}

From source file:org.apache.webdav.connector.WebDAVXAResource.java

protected void setLoggerFacade(PrintWriter out) {
    loggerFacade = new PrintWriterLogger(out, "WebDAVXAResource", true);
}

From source file:org.jboss.jbossts.fileio.xalib.txdirs.dir.XADir.java

/**
 * Constructor to create objects that represent a transactional directory.
 * <p>/*from www.j a v a 2  s.  com*/
 * The constructor checks if the <code>storeDir</code> is a directory or not.
 * If it is not then {@link org.jboss.jbossts.fileio.xalib.txdirs.exceptions.NotDirectoryException}
 * exception is thrown. Otherwise, a new <code>FileResourceManager</code> object
 * is created to allow access to transactional methods (e.g. start, commit, rollback
 * a transaction)
 *
 * @param storeDir directory where main data should go after commit
 * @exception org.jboss.jbossts.fileio.xalib.txdirs.exceptions.NotDirectoryException
 *            if the <code>storeDir</code> is not a directory
 * @exception org.apache.commons.transaction.file.ResourceManagerException
 *            if an error in the <code>FileResourceManager</code> occurs
 */
public XADir(File storeDir) throws IOException, ResourceManagerException {
    if (!storeDir.exists()) {
        storeDir.mkdir();
    } else {
        if (!storeDir.isDirectory())
            throw new NotDirectoryException("The file given is not a directory.");
    }

    length = storeDir.list().length;
    String workDir = storeDir.getCanonicalPath() + "/" + Globals.WORK_DIR_NAME;
    freMngr = new FileResourceManager(storeDir.getCanonicalPath(), workDir, false,
            new PrintWriterLogger(new PrintWriter(System.out), XADirFile.class.getName(), false));
    freMngr.start(); // start the FileResourceManager service, must be started
}