From f66c263db9393d081dc1669798f49d9a27a6a492 Mon Sep 17 00:00:00 2001 From: "Jonathan S. Fisher" Date: Thu, 15 Oct 2015 18:08:06 -0500 Subject: [PATCH] Fix https://github.com/AdamBien/connectorz/issues/13 --- .../connectorz/files/store/FileBucket.java | 12 ++++++--- .../files/store/FileBucketStore.java | 26 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/files/store/src/main/java/org/connectorz/files/store/FileBucket.java b/files/store/src/main/java/org/connectorz/files/store/FileBucket.java index fccfc11..c5f8b53 100644 --- a/files/store/src/main/java/org/connectorz/files/store/FileBucket.java +++ b/files/store/src/main/java/org/connectorz/files/store/FileBucket.java @@ -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 { @@ -149,6 +152,7 @@ public byte[] fetch(String file) { } } + @Override public FileTime lastModified(String file) { try { return Files.getLastModifiedTime(Paths.get(getAbsoluteName(file))); diff --git a/files/store/src/main/java/org/connectorz/files/store/FileBucketStore.java b/files/store/src/main/java/org/connectorz/files/store/FileBucketStore.java index f512b2a..49e50a8 100644 --- a/files/store/src/main/java/org/connectorz/files/store/FileBucketStore.java +++ b/files/store/src/main/java/org/connectorz/files/store/FileBucketStore.java @@ -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; @@ -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) {