commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ozeigerm...@apache.org
Subject svn commit: r558033 - in /jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource: ./ ResourceEvent.java ResourceInterceptor.java ResourceManager.java StreamableResource.java
Date Fri, 20 Jul 2007 16:14:55 GMT
Author: ozeigermann
Date: Fri Jul 20 09:14:53 2007
New Revision: 558033

URL: http://svn.apache.org/viewvc?view=rev&rev=558033
Log:
New package for streamable resources. Will be implemented by transactional file resource manager.
Could also offer access to content from a CMS. 

Added:
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceEvent.java
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceInterceptor.java
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceManager.java
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/StreamableResource.java

Added: jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceEvent.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceEvent.java?view=auto&rev=558033
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceEvent.java
(added)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceEvent.java
Fri Jul 20 09:14:53 2007
@@ -0,0 +1,13 @@
+package org.apache.commons.transaction.resource;
+
+public interface ResourceEvent {
+    enum EventType {
+        ACCESS, READ, CREATE, DELETE, WRITE, MOVE, COPY, COMMIT, ROLLBACK, PROPERTYSET
+    };
+
+    String getPath();
+    String getDestinationPath();
+    String propertyName();
+    
+    EventType getEventType();
+}

Added: jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceInterceptor.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceInterceptor.java?view=auto&rev=558033
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceInterceptor.java
(added)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceInterceptor.java
Fri Jul 20 09:14:53 2007
@@ -0,0 +1,7 @@
+package org.apache.commons.transaction.resource;
+
+
+public interface ResourceInterceptor {
+    boolean beforeCompletion(ResourceEvent event);
+    void afterCompletion(ResourceEvent event);
+}
\ No newline at end of file

Added: jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceManager.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceManager.java?view=auto&rev=558033
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceManager.java
(added)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/ResourceManager.java
Fri Jul 20 09:14:53 2007
@@ -0,0 +1,15 @@
+package org.apache.commons.transaction.resource;
+
+import java.io.IOException;
+
+import org.apache.commons.transaction.locking.LockException;
+
+public interface ResourceManager<R> {
+    R getResource(String path) throws IOException, LockException;
+
+    String getRootPath() throws IOException, LockException;
+
+    void addInterceptor(ResourceInterceptor interceptor);
+
+    void removeInterceptor(ResourceInterceptor interceptor);
+}
\ No newline at end of file

Added: jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/StreamableResource.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/StreamableResource.java?view=auto&rev=558033
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/StreamableResource.java
(added)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/transaction/resource/StreamableResource.java
Fri Jul 20 09:14:53 2007
@@ -0,0 +1,51 @@
+package org.apache.commons.transaction.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Collection;
+
+import org.apache.commons.transaction.locking.LockException;
+
+public interface StreamableResource {
+    String getPath();
+
+    boolean isDirectory();
+
+    boolean isFile();
+
+    Collection<StreamableResource> getChildren() throws IOException, LockException;
+
+    StreamableResource getParent() throws IOException, LockException;
+
+    InputStream readStream() throws IOException, LockException;
+
+    OutputStream writeStream(boolean append) throws IOException, LockException;
+
+    boolean delete() throws IOException, LockException;
+
+    boolean move(String destinationpath) throws IOException, LockException;
+
+    boolean copy(String destinationpath) throws IOException, LockException;
+
+    boolean exists();
+
+    void createAsDirectory() throws IOException, LockException;
+
+    void createAsFile() throws IOException, LockException;
+
+    // plus more general properties
+    // among them could be length, lastmodfied, etc.
+    Object getProperty(String name);
+
+    Object setProperty(String name, Object newValue);
+
+    // plus locking methods
+    void readLock();
+
+    void writeLock();
+
+    boolean tryReadLock();
+
+    boolean tryWriteLock();
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message