Skip to content

Commit

Permalink
Merge pull request AdamBien#14 from exabrial/master
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamBien committed Oct 16, 2015
2 parents 6ffd86a + f66c263 commit e0e4f84
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@
*/
package org.connectorz.files.store;

import java.io.*;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.FileTime;
import java.util.Date;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.resource.ResourceException;

import org.connectorz.files.Bucket;

public class FileBucket implements Bucket {
Expand Down Expand Up @@ -149,6 +152,7 @@ public byte[] fetch(String file) {
}
}

@Override
public FileTime lastModified(String file) {
try {
return Files.getLastModifiedTime(Paths.get(getAbsoluteName(file)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@
package org.connectorz.files.store;

import java.io.PrintWriter;

import javax.naming.Reference;
import javax.resource.ResourceException;
import javax.resource.spi.ConnectionManager;
import javax.resource.spi.ConnectionRequestInfo;
import javax.resource.spi.ManagedConnectionFactory;

import org.connectorz.files.Bucket;
import org.connectorz.files.BucketStore;

public class FileBucketStore
implements BucketStore {

private ManagedConnectionFactory mcf;
private static final long serialVersionUID = 1L;
private ManagedConnectionFactory mcf;
private Reference reference;
private ConnectionManager cm;
private PrintWriter out;
Expand All @@ -38,15 +41,16 @@ public FileBucketStore(PrintWriter out,ManagedConnectionFactory mcf, ConnectionM
this.out = out;
}

@Override
public FileBucket getBucket(){
out.println("#FileBucketStore.getConnection " + this.cm + " MCF: " + this.mcf);
try {
return (FileBucket) cm.allocateConnection(mcf, getConnectionRequestInfo());
} catch (ResourceException ex) {
throw new RuntimeException(ex.getMessage());
}
}
@Override
public Bucket getBucket() {
out.println("#FileBucketStore.getConnection " + this.cm + " MCF: " + this.mcf);
try {
return (Bucket) cm.allocateConnection(mcf, getConnectionRequestInfo());
} catch (ResourceException ex) {
throw new RuntimeException(ex.getMessage());
}
}


@Override
public void setReference(Reference reference) {
Expand Down

0 comments on commit e0e4f84

Please sign in to comment.