[jboss-cvs] JBossAS SVN: r88009 - in projects/fresh/trunk: fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 29 11:28:02 EDT 2009


Author: ctomc
Date: 2009-04-29 11:28:02 -0400 (Wed, 29 Apr 2009)
New Revision: 88009

Added:
   projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/
   projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/Cp2AuthenticationProvider.java
   projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/util/
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileInfo.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileName.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileOpInfo.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileReadInfo.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileRetInfo.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileWriteInfo.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/InfiniteLinkException.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/NoSuchFileException.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/RootVFS.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/TagFactory.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/UserCtx.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFS.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSAuth.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSConfig.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSException.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSFileHandlerFactory.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSIOException.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMeta.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaCacheUpdater.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaException.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaFactory.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStore.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreCacheUpdater.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreFactory.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/
Removed:
   projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/Cp2AuthenticationProvider.java
   projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/ssh/
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/
Log:
repackage

Copied: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2 (from rev 88004, projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/ssh/cp2)

Deleted: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/Cp2AuthenticationProvider.java
===================================================================
--- projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/ssh/cp2/Cp2AuthenticationProvider.java	2009-04-29 15:13:38 UTC (rev 88004)
+++ projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/Cp2AuthenticationProvider.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -1,88 +0,0 @@
-package org.jboss.fresh.ssh.ssh.cp2;
-
-import com.sshtools.daemon.platform.NativeAuthenticationProvider;
-
-import org.apache.log4j.Logger;
-
-import java.util.Map;
-import java.util.Properties;
-import java.io.File;
-import java.io.FileInputStream;
-
-
-
-/**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
- */
-
-public class Cp2AuthenticationProvider extends NativeAuthenticationProvider {
-
-  private static Logger log = Logger.getLogger(Cp2AuthenticationProvider.class);
-  private static Cp2AuthenticationProvider instance;
-  private Properties p = new Properties();
-
-
-  public Cp2AuthenticationProvider() {
-    super();
-    
-    File users = null;
-    try {
-    	users = new File(System.getProperty("sshtools.home") + File.separator + "conf" + File.separator + "users.conf");
-    	p.load(new FileInputStream(users));
-    } catch(Exception ex) {
-    	log.warn("Could not open users file: " + users);
-    }
-  }
-
-  public String getHomeDirectory(String username){
-	return "/";
-  }
-
-  //for now a hard coded path is returned
-  public String getHomeDirectory(String username, Map tokens){
-    return System.getProperty("sshtools.home");
-  }
-
-  public boolean logonUser(String username, String password, Map tokens){
-
-//    if (username.equals("root") && password.equals("root")){
-//      log.info(username + " has passed authentication");
-//      return true;
-    String reguserpass = p.getProperty(username);
-    if(reguserpass!=null && reguserpass.equals(password)) {
-	return true;
-    }
-    else {
-      log.info(username + " has failed authentication");
-      return false;
-    }
-  }
-
-  public boolean logonUser(String username, Map tokens){
-    return true;
-  }
-  
-
-  public boolean changePassword(String username, String oldpass, String newpass) {
-  	return false;
-  }
-  
-  public void logoffUser() {
-
-  }
-
-  public boolean logonUser(String user) {
-	return true;
-  }
-
-  public boolean logonUser(String user, String pass) {
-  	return true;
-  }
-
-
-}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/Cp2AuthenticationProvider.java (from rev 88008, projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/ssh/cp2/Cp2AuthenticationProvider.java)
===================================================================
--- projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/Cp2AuthenticationProvider.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/cp2/Cp2AuthenticationProvider.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,83 @@
+package org.jboss.fresh.ssh.ssh.cp2;
+
+import com.sshtools.daemon.platform.NativeAuthenticationProvider;
+
+import org.apache.log4j.Logger;
+
+import java.util.Map;
+import java.util.Properties;
+import java.io.File;
+import java.io.FileInputStream;
+
+
+
+/**
+ * @version 1.0
+ */
+
+public class Cp2AuthenticationProvider extends NativeAuthenticationProvider {
+
+  private static Logger log = Logger.getLogger(Cp2AuthenticationProvider.class);
+  private static Cp2AuthenticationProvider instance;
+  private Properties p = new Properties();
+
+
+  public Cp2AuthenticationProvider() {
+    super();
+    
+    File users = null;
+    try {
+    	users = new File(System.getProperty("sshtools.home") + File.separator + "conf" + File.separator + "users.conf");
+    	p.load(new FileInputStream(users));
+    } catch(Exception ex) {
+    	log.warn("Could not open users file: " + users);
+    }
+  }
+
+  public String getHomeDirectory(String username){
+	return "/";
+  }
+
+  //for now a hard coded path is returned
+  public String getHomeDirectory(String username, Map tokens){
+    return System.getProperty("sshtools.home");
+  }
+
+  public boolean logonUser(String username, String password, Map tokens){
+
+//    if (username.equals("root") && password.equals("root")){
+//      log.info(username + " has passed authentication");
+//      return true;
+    String reguserpass = p.getProperty(username);
+    if(reguserpass!=null && reguserpass.equals(password)) {
+	return true;
+    }
+    else {
+      log.info(username + " has failed authentication");
+      return false;
+    }
+  }
+
+  public boolean logonUser(String username, Map tokens){
+    return true;
+  }
+  
+
+  public boolean changePassword(String username, String oldpass, String newpass) {
+  	return false;
+  }
+  
+  public void logoffUser() {
+
+  }
+
+  public boolean logonUser(String user) {
+	return true;
+  }
+
+  public boolean logonUser(String user, String pass) {
+  	return true;
+  }
+
+
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/util (from rev 88004, projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/ssh/util)

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileInfo.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/FileInfo.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileInfo.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileInfo.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,298 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.io.Serializable;
+import java.util.*;
+
+
+public class FileInfo implements Serializable {
+
+    public final static int TYPE_FILE = 1;
+    public final static int TYPE_DIR = 2;
+    public final static int TYPE_LINK = 3;
+    public final static char NAME_SEPARATOR = '/';
+
+    private FileName name;
+    private int type;
+    private Date createDate;
+    private Date lastModified;
+    private long length;
+    private boolean complete = true;
+    private String tag;
+    private String mime;
+    private FileName target;
+    private FileInfo extra;
+    private float orderIndex;
+    private HashMap attrs = new HashMap();
+    private HashMap roles = new HashMap();
+
+
+    /*
+     public FileInfo() {
+     }
+    */
+
+    public FileInfo(FileInfo fi) throws VFSException {
+        this(fi.getFileName(), fi.getFileType(), fi.getLength(),
+                fi.getCreateDate(), fi.getLastModified(), fi.isComplete(),
+                fi.getTag());
+        target = fi.getTarget();
+        mime = fi.getMime();
+        orderIndex = fi.getOrderIndex();
+        attrs = new HashMap(fi.getAttributes());
+        HashMap importRoles = fi.getRoles();
+        if (importRoles != null) {
+            Iterator it = importRoles.keySet().iterator();
+
+            while (it.hasNext()) {
+                String importAction = (String) it.next();
+                HashSet rolesForImportAction = (HashSet) importRoles.get(
+                        importAction);
+
+                setRolesForAction(importAction,
+                        new HashSet(rolesForImportAction));
+            }
+        }
+    }
+
+
+    public FileInfo(String fname) throws VFSException {
+        name = new FileName(fname);
+    }
+
+
+    public FileInfo(String fname, int type) throws VFSException {
+        name = new FileName(fname);
+        this.type = type;
+    }
+
+
+    public FileInfo(FileName fname) throws VFSException {
+        name = fname;
+    }
+
+
+    public FileInfo(FileName fname, int type) throws VFSException {
+        this.name = fname;
+        this.type = type;
+    }
+
+
+    public FileInfo(FileName fname, String n) throws VFSException {
+        name = fname.absolutize(n);
+    }
+
+
+    public FileInfo(FileName fname, String n, int type) throws VFSException {
+        name = fname.absolutize(n);
+        this.type = type;
+    }
+
+
+    public FileInfo(FileName fullname, int type, long size, Date create,
+                    Date lastModified, boolean complete) {
+        this(fullname, type, size, create, lastModified, complete, null);
+    }
+
+
+    public FileInfo(FileName fullname, int type, long size, Date create,
+                    Date lastModified, boolean complete, String tag) {
+        name = fullname;
+        this.type = type;
+        this.length = size;
+        createDate = create;
+        this.lastModified = lastModified;
+        this.complete = complete;
+        this.tag = tag;
+    }
+
+
+    public void setFileName(FileName name) {
+        this.name = name;
+    }
+
+
+    public void setAttributes(HashMap attrs) {
+        this.attrs = attrs;
+    }
+
+
+    public void setCreateDate(Date date) {
+        this.createDate = date;
+    }
+
+
+    public void setLastModified(Date date) {
+        lastModified = date;
+    }
+
+
+    public void setLength(long length) {
+        this.length = length;
+    }
+
+
+    public void setMime(String mime) {
+        this.mime = mime;
+    }
+
+
+    public void setTag(String tag) {
+        this.tag = tag;
+    }
+
+
+    public void setFileType(int val) {
+        type = val;
+    }
+
+
+    public void setComplete(boolean complete) {
+        this.complete = complete;
+    }
+
+
+    public void setRolesForAction(String action, HashSet set) {
+        roles.put(action, set);
+    }
+
+
+    public void setTarget(FileName target) {
+        this.target = target;
+    }
+
+
+    public void setOrderIndex(float newIndex) {
+        orderIndex = newIndex;
+    }
+
+
+    public FileName getFileName() {
+        return name;
+    }
+
+
+    public HashMap getAttributes() {
+        return attrs;
+    }
+
+    // �e FS security nima nobene owner specific logike, potem tega ne rabimo.
+    // public String getOwner() {
+    // return owner;
+    // }
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+
+    public Date getLastModified() {
+        return lastModified;
+    }
+
+
+    public Collection getActions() {
+        return roles.keySet();
+    }
+
+
+    public long getLength() {
+        return length;
+    }
+
+
+    public String getMime() {
+        return mime;
+    }
+
+
+    public String getTag() {
+        return tag;
+    }
+
+
+    public int getFileType() {
+        return type;
+    }
+
+
+    public HashMap getRoles() {
+        return roles;
+    }
+
+
+    public HashSet getRolesForAction(String action) {
+        return (HashSet) roles.get(action);
+    }
+
+    // To je dobro vedeti.
+    public boolean isComplete() {
+        return complete;
+    }
+
+
+    public boolean isFile() {
+        return type == TYPE_FILE;
+    }
+
+
+    public boolean isDirectory() {
+        return type == TYPE_DIR;
+    }
+
+
+    /*
+     public boolean isPackage() {
+     return type==TYPE_PACKAGE;
+     }
+    */
+    public boolean isLink() {
+        return type == TYPE_LINK;
+    }
+
+
+    public FileName getTarget() {
+        // return (String)attrs.get(VFSMeta.LINKSTO);
+        return target;
+    }
+
+
+    public float getOrderIndex() {
+        return orderIndex;
+    }
+
+
+    public void putExtra(FileInfo val) {
+        extra = val;
+    }
+
+    public FileInfo getExtra() {
+        return extra;
+    }
+
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer(200);
+        buf.append("filename=");
+        buf.append(name);
+        buf.append(";type=");
+        buf.append(type);
+        buf.append(";createDate=");
+        buf.append(createDate);
+        buf.append(";lastModified=");
+        buf.append(lastModified);
+        buf.append(";length=");
+        buf.append(length);
+        buf.append(";complete=");
+        buf.append(complete);
+        buf.append(";mime=");
+        buf.append(mime);
+        buf.append(";target=");
+        buf.append(target);
+        buf.append(";attrs=");
+        buf.append(attrs);
+        buf.append(";roles=");
+        buf.append(roles);
+
+        return buf.toString();
+    }
+}
+

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileName.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/FileName.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileName.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileName.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,384 @@
+package org.jboss.fresh.vfs.vfs;
+
+import org.jboss.fresh.naming.PathExpression;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Collections;
+
+
+public class FileName implements PathExpression, Serializable {
+
+	private final static char DELIM = '/';
+	private final static String ROOT = Character.toString(DELIM);
+
+	private String name;
+	private boolean absolute;
+	private final LinkedList parsed;
+	private final List unmodifiable;
+	private int hash;
+
+
+	public FileName(String name) {
+
+		if ((name == null) || "".equals(name))
+			throw new IllegalArgumentException("File path can't be empty.");
+
+		this.name = name;
+		absolute = name.charAt(0) == DELIM;
+
+		LinkedList l = new LinkedList();
+		StringTokenizer st = new StringTokenizer(name, Character.toString(DELIM));
+		for (int i = 0; st.hasMoreTokens(); i++) {
+			String token = st.nextToken();
+			if (token.length() == 0) continue;
+			checkPathToken(token);
+			l.add(token.intern());
+		}
+		parsed = l;
+		unmodifiable = Collections.unmodifiableList(parsed);
+	}
+
+
+	public FileName(List l, boolean absolute) {
+		Iterator it = l.iterator();
+		parsed = new LinkedList();
+		unmodifiable = Collections.unmodifiableList(parsed);
+		while (it.hasNext()) {
+			String token = it.next().toString();
+			if (token.length() == 0) continue;
+			parsed.add(token.intern());
+		}
+
+		this.absolute = absolute;
+	}
+
+
+	public void checkPathToken(String name) {
+		if (name.indexOf(DELIM) >= 0 || name.indexOf("*") >= 0 || name.indexOf("?") >= 0)
+			throw new IllegalArgumentException("Illegal character in file name (" + name + ")");
+	}
+
+	public FileName absolutize(String name) {
+		// this is need for absolutize( root.getPath() ) to work properly
+		return absolutize(new FileName((name == null) ? ROOT : name));
+	}
+
+
+	public FileName absolutize(FileName relName) {
+		LinkedList resultParsed = new LinkedList(parsed);
+		// here we resolve each token
+		LinkedList relParsed = new LinkedList(relName.parsed);
+		int len = relParsed.size();
+
+		for (int i = 0; i < len; i++) {
+			String next = (String) relParsed.get(i);
+			if ("..".equals(next)) {
+				// going up from root is not allowed
+				if (resultParsed.isEmpty())
+					throw new IllegalArgumentException("Attempt to go up from root.");
+				resultParsed.removeLast();
+
+			} else if (".".equals(next)) {
+				// do nothing
+
+			} else {
+				resultParsed.add(next);
+			}
+		}
+
+		return new FileName(resultParsed, absolute);
+	}
+
+
+	public FileName getPath() {
+
+		FileName result = null;
+		int len = parsed.size();
+
+		if (len == 0) {
+			// we're returning parent of root
+			result = null;
+
+		} else if (len == 1) {
+			if (absolute)
+				result = new FileName(ROOT);
+			else
+				result = null;
+
+		} else {
+			LinkedList path = new LinkedList(parsed);
+			path.removeLast();
+			result = new FileName(path, absolute);
+		}
+
+		return result;
+	}
+
+
+	public String getName() {
+		String name = null;
+
+		if (parsed.size() == 0)
+			name = null;
+		else
+			name = (String) parsed.getLast();
+
+		return name;
+	}
+
+
+	public boolean isRoot() {
+		return parsed.isEmpty();
+	}
+
+
+	/**
+	 * Please note that this method returns an <strong>UNMODIFIABLE</strong> list!
+	 * @return
+	 */
+	public List getParsed() {
+		return unmodifiable;
+	}
+
+	public boolean isParsedEmpty() {
+		return parsed.isEmpty();
+	}
+
+
+	public boolean equals(Object obj) {
+		boolean result = false;
+
+		if (obj instanceof FileName) {
+			FileName compareTo = (FileName) obj;
+
+			if ((compareTo.isAbsolute() != absolute) || (!compareTo.parsed.equals(parsed)))
+				result = false;
+			else
+				result = true;
+		}
+
+		return result;
+	}
+
+
+	public FileName getBase(int i) {
+		// returns path resulting from first i tokens
+		List base = parsed.subList(0, i);
+		return new FileName(base, absolute);
+	}
+
+	public FileName getSuffix(int i) {
+		// returns path resulting from first i tokens
+		List base = parsed.subList(i, parsed.size());
+		return new FileName(base, absolute);
+	}
+
+	public int size() {
+		return parsed.size();
+	}
+
+	public FileName relativeTo(String name) {
+		return relativeTo(new FileName(name));
+	}
+
+
+	// what you need to pass to name.absolutize to come from name to this
+	// The presumption is that all strings are automatically cononicalized
+	// no /./ or /../ components in the name
+	// Also we presumed all strings inside parsed are interned ... we make sure of that
+	// in other methods
+	// Kanonizirati relativno ime je precej bedno...
+	public FileName relativeTo(FileName name) {
+		// you find common root
+		// it can be "/"
+		// if name is higher above than we are then it's ok, cause we need
+		// to add to name to get here
+		// if name is further down from us or we even have to go up and down again
+		// to get there then the name will be either all /../ or it will also go down
+
+		FileName result = null;
+
+		// compare them from root down
+		if (name.isRoot()) {
+			LinkedList l = new LinkedList(parsed);
+			if (l.isEmpty())
+				l.add(".");
+			result = new FileName(l, false);
+
+		} else if (isRoot()) {
+			// give it as many .. as there is parsed length
+			LinkedList l = new LinkedList();
+			Iterator it = name.iterateTokens();
+			while (it.hasNext()) {
+				l.add("..");
+				it.next();
+			}
+			result = new FileName(l, false);
+
+		} else {
+			// zdaj pa...
+			int i;
+			LinkedList startPath = name.parsed;
+			LinkedList endPath = parsed;
+			LinkedList l = new LinkedList();
+
+			for (i = 0; true; i++) {
+				// najdi tocko razhajanja
+				// preveri ce sploh je znotraj vectorja, ce ni, potem smo ce pri razhajanju
+				String startPathToken = null;
+				String endPathToken = null;
+
+				if (i < parsed.size())
+					startPathToken = (String) startPath.get(i);
+
+				if (i < name.parsed.size())
+					endPathToken = (String) endPath.get(i);
+
+				if (startPathToken == null || endPathToken == null)
+					break; // the point where they don't match any more
+
+				if (endPathToken != startPathToken) // they don't match
+					break;
+			}
+
+			for (int j = i; j < endPath.size(); j++) {
+				l.add("..");
+			}
+
+			for (int j = i; j < startPath.size(); j++) {
+				l.add(startPath.get(j));
+			}
+
+			if (l.isEmpty())
+				l.add(".");
+
+			result = new FileName(l, false);
+		}
+
+		return result;
+	}
+
+
+	/**
+	 * our object is immutable so caching the hashcode is easy
+	 */
+	public int hashCode() {
+
+		if (hash == 0) {
+			hash = 17;
+			hash = 37 * hash + (absolute ? 1 : 0);
+			int tmp = 0;
+			if (parsed != null)
+				tmp = parsed.hashCode();
+
+			hash = 37 * hash + tmp;
+/*
+			tmp = 0;
+			if( vfs != null )
+				tmp = vfs.hashCode();
+			hash = 37 * hash + tmp;
+*/
+//System.out.println("CALCULATED HASH");
+//Thread.currentThread().dumpStack();
+
+		} else {
+			int tmp0 = 17;
+			tmp0 = 37 * tmp0 + (absolute ? 1 : 0);
+			int tmp = 0;
+			if (parsed != null)
+				tmp = parsed.hashCode();
+
+			tmp0 = 37 * tmp0 + tmp;
+
+/*			tmp = 0;
+			if ( vfs != null )
+				tmp = vfs.hashCode();
+
+			tmp0 = 37 * tmp0 + tmp;
+*/
+			if (tmp0 != hash)
+				throw new RuntimeException(" * * * * * * * *   BUMMER  * * * * * * * * *");
+		}
+
+
+//System.out.println("hashCode: " + hash + "(" + this + ")" + super.hashCode());
+
+		return hash;
+	}
+
+	public boolean isAbsolute() {
+		return absolute;
+	}
+
+	public boolean isRelative() {
+		return !absolute;
+	}
+
+
+	public boolean isParent(FileName parent) {
+		boolean result = true;
+
+		Iterator itParent = parent.iterateTokens();
+		Iterator itChild = parsed.iterator();
+
+		while (itParent.hasNext()) {
+			if (!itChild.hasNext() || !itParent.next().equals(itChild.next())) {
+				result = false;
+				break;
+			}
+		}
+
+		return result;
+	}
+
+
+	public String toString() {
+		StringBuffer buf = new StringBuffer();
+
+		if (absolute)
+			buf.append(DELIM);
+		Iterator it = parsed.iterator();
+		while (it.hasNext()) {
+			String pathToken = (String) it.next();
+			buf.append(pathToken);
+			if (it.hasNext())
+				buf.append(DELIM);
+		}
+
+		return buf.toString();
+	}
+
+
+	/**
+	 * Please note that this method returns an <strong>UNMODIFIABLE</strong> iterator!
+	 * @return
+	 */
+	public Iterator iterateTokens() {
+		return unmodifiable.iterator();
+	}
+
+	public Object getFinalToken() {
+		return getName();
+	}
+
+	public PathExpression getParentExpression() {
+		return getPath();
+	}
+
+	/**
+	 * Please note that this method returns an <strong>UNMODIFIABLE</strong> list!
+	 * @return
+	 */
+	public List getTokens() {
+		return unmodifiable;
+	}
+
+	public PathExpression absolutize(Object obj) {
+		return absolutize((String) obj);
+	}
+
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileOpInfo.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/FileOpInfo.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileOpInfo.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileOpInfo.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,63 @@
+package org.jboss.fresh.vfs.vfs;
+
+/**
+ 1) autocreate (ki vklju�uje mkdirs) / must-exist / must-not-exist (vklju�uje autocreate)
+
+ must-exist pomeni error �e ne obstaja
+ must-not-exist pomeni error �e obstaja, �e ne obstaja se izvede autocreate rutina
+ autocreate pomeni, da �e obstaja, potem je �e ok, in povozimo obstoje�e atribute z novimi, �e ne obstaja ga kreiramo z dir strukturo vred
+
+
+ 2) overwrite / append
+
+ Ta re� pride v po�tev, ko podatke pi�e� gor. �e je �e kak�na dol�ina, potem je od tega odvisno ali truncate-amo najprej ali pa appendamo na konec
+
+
+ Pri put() imamo autocreate/overwrite combinacijo.
+
+ */
+
+public class FileOpInfo implements java.io.Serializable {
+
+/*
+	public static final int		NO_LOCK		= 0;		// everyone can anything
+	public static final int		LOCK_WRITE	= 1;	// others can read, only you can write or delete
+	public static final int		LOCK_READWRITE	= 2;	// noone else can read or write - you can do everything
+*/
+
+/*	// samo dve vrsti pisanja bi morali biti:
+	//	- morebitna ze obstojeca vsebina se zbrise in se nato pisejo byti od zacetka
+	//	- vsebini se appendajo byti
+	public static final int		AUTOCREATE	= 0;
+	public static final int		MUST_EXIST	= 1;
+	public static final int		MUST_NOT_EXIST	= 2;
+*/
+
+
+    public String tag;
+//	public String lockid;
+    public FileName filename;
+    public long offset = 0L;		// -1L pomeni append
+    public byte[] buf;
+
+/*
+	public int lock			=	NO_LOCK;
+	public int lockTimeoutMillis;
+*/
+
+    public boolean append;	// !append == rewrite
+    public boolean complete;
+
+//	public int createmode;		// create file if doesn't exist
+//	public boolean createdirs;	// create directories if they don't exist? Only if true
+//	public boolean errOnGaps;	// ali potreba po filanju z 000 povzro�i exception
+//	public boolean overwrite;	// truncates the file to filepos before writing
+
+
+// read only
+//	public int len;			// how much to read
+
+    public String toString() {
+        return super.toString() + " : tag=" + tag + " , filename=" + filename + " , offset=" + offset + " , buf=" + (buf == null ? null : new String(buf)) + " , append=" + append + " , complete=" + complete;
+    }
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileReadInfo.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/FileReadInfo.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileReadInfo.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileReadInfo.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,15 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.io.Serializable;
+
+
+public class FileReadInfo implements Serializable {
+
+    public String tag;
+    public byte[] buf;
+    public boolean more;
+
+    public String toString() {
+        return tag + "\n" + more + "\n" + buf;
+    }
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileRetInfo.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/FileRetInfo.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileRetInfo.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileRetInfo.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,12 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.io.Serializable;
+
+
+public class FileRetInfo implements Serializable {
+
+    public String tag;
+//	public String lockid;
+//	public long size;
+    public byte[] buf;
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileWriteInfo.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/FileWriteInfo.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileWriteInfo.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/FileWriteInfo.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,9 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.io.Serializable;
+
+
+public class FileWriteInfo implements Serializable {
+
+    public String tag;
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/InfiniteLinkException.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/InfiniteLinkException.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/InfiniteLinkException.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/InfiniteLinkException.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,22 @@
+package org.jboss.fresh.vfs.vfs;
+
+public class InfiniteLinkException extends VFSException {
+
+	public InfiniteLinkException() {
+		 super();
+	}
+
+	public InfiniteLinkException(String msg) {
+		 super(msg);
+	}
+
+	public InfiniteLinkException(Throwable t) {
+		 super(t);
+	}
+
+	public InfiniteLinkException(String msg, Throwable t) {
+		 super(msg, t);
+	}
+
+
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/NoSuchFileException.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/NoSuchFileException.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/NoSuchFileException.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/NoSuchFileException.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,12 @@
+package org.jboss.fresh.vfs.vfs;
+
+
+public class NoSuchFileException extends VFSException {
+    public NoSuchFileException() {
+        super();
+    }
+
+    public NoSuchFileException(String msg) {
+        super(msg);
+    }
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/RootVFS.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/RootVFS.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/RootVFS.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/RootVFS.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,24 @@
+/*
+ * Created on 5.12.2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.jboss.fresh.vfs.vfs;
+
+import java.util.Map;
+
+import javax.naming.NamingException;
+
+/**
+ * @author gospodar
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface RootVFS extends VFS {
+
+	public void mount(String path, VFS vfs) throws VFSException, NamingException;
+	public void unmount(String path) throws VFSException;
+	public Map listMounts();
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/TagFactory.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/TagFactory.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/TagFactory.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/TagFactory.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,9 @@
+package org.jboss.fresh.vfs.vfs;
+
+
+public interface TagFactory {
+
+    public void init();
+
+    public String newTag();
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/UserCtx.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/UserCtx.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/UserCtx.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/UserCtx.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,13 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.security.Principal;
+
+
+public interface UserCtx {
+
+    Principal getPrincipal();
+
+    boolean isUserInRole(String rolename);
+
+    String getLogin();
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFS.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFS.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFS.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFS.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,197 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ *  VFS provides file meta and content persistence and also transactions
+ *  functionality over all methods. All VFS implementations should check at the
+ *  beginning of every transaction-regarding method, if transaction is active.
+ *  If not, it should throw an appropriate VFSException. All exceptions thrown
+ *  in VFS are thrown only to prevent data integrity corruption and to ensure
+ *  fail safety or to apply security restrictions. If parameters are invalid,
+ *  unexpected exception will be thrown; one lever higher must be ensured that
+ *  in that case rollback is called and data integrity remains untouched. All
+ *  validition in VFS is only for data safety. Any other validation should be
+ *  implemented at higher level.
+ */
+public interface VFS {
+
+    /*  We haven't discussed this one yet; we can forget about it for now.
+    public void setVFSContext(VFSContext ctx);
+    public VFSContext getVFSContext();
+    */
+
+    /**
+     *  Name must not be null. If exception is thrown, it means something is wrong
+     *  in the meta persistence layer or access is not allowed. This is all a
+     *  thrown exception is allowed to indicate.
+     *
+     * @param  ctx               User's context.
+     * @param  name              File's filename.
+     * @param  direct            If false, any final links will be resolved.
+     * @return                   Whether file exists or not.
+     * @exception  VFSException  Description of the Exception
+     */
+    public boolean exists(UserCtx ctx, FileName name, boolean direct) throws VFSException;
+
+    /*
+    /**
+     *  Name must not be null. If exception is occured, it indicates meta
+     *  persistence problem or security restrictions. If name represent link, then
+     *  target FileInfo object is also returned, in extra field. Returns valid
+     *  Collection object with path resolution thread paths. It is empty only when
+     *  name was root. If name does not exist (only parent or grand-parent does),
+     *  it returns partial resolution (as much as it gets).
+     *
+     *@param  ctx               User context.
+     *@param  name              Name of file.
+     *@return                   List of path resolution steps.
+     /
+    public List resolvePath( UserCtx uctx, FileName name ) throws VFSException;
+    */
+
+    /**
+     *  Name must not be null. If exception is occured, it indicates meta
+     *  persistence problem or security restrictions. Returns valid fully loaded
+     *  FileInfo object. If object doesn't exist, returns null.
+     *
+     * @param  ctx               User's context.
+     * @param  name              File's filename.
+     * @param  direct            If false, a final link in the filename will be
+     *      resolved.
+     * @return                   The fileInfo value
+     * @exception  VFSException  Description of the Exception
+     */
+    public FileInfo getFileInfo(UserCtx ctx, FileName name, boolean direct) throws VFSException;
+
+    /**
+     *  Name must not be null and the file must exist. If exception is occured, it
+     *  indicates meta persistence problem or security restrictions. Returns valid
+     *  Collection object filled with child FileInfo objects.
+     *
+     * @param  ctx     User's context.
+     * @param  name    Parent's filename.
+     * @param  direct  If false, a final link in the parent file will be resolved.
+     * @return         List of child FileInfo objects.
+     */
+    public List list(UserCtx ctx, FileName name, boolean direct) throws VFSException;
+
+    /**
+     *  File must not be null and must not exist. Only name, type and mime must be
+     *  specified. Optional can be specified also linkto, attributes and roles.
+     *  CreateDate, lastModified, length, complete, tag and orderIndex are set by
+     *  vfs. If exception is occured, it indicates meta persistence problem or
+     *  security restrictions. Returns tag string for this file.
+     *
+     * @param  ctx   User's context.
+     * @param  file  Description of the Parameter
+     * @return       Tag indication current state of file.
+     */
+    public String createFile(UserCtx ctx, FileInfo file) throws VFSException;
+
+    /**
+     *  File must not be null and must exist. Everything except name (&parent&path)
+     *  will not be updated. If exception is occured, it indicates meta persistence
+     *  problem or security restrictions.
+     *
+     * @param  ctx   User's context.
+     * @param  file  Description of the Parameter
+     * @return       Tag indication state of file after update.
+     */
+    public String updateFile(UserCtx ctx, FileInfo file) throws VFSException;
+
+    /**
+     *  File must not be null and must exist. File meta infos and file's content
+     *  will be permanently removed. Removal is recursive. All children meta infos
+     *  and content's will be removed. If exception is occured, it indicates
+     *  persistence problem or security restrictions or that file doesn't exist.
+     *
+     * @param  ctx     User's context.
+     * @param  name    Filename of the existing, to-be-removed file.
+     * @param  direct  If false, a final link in the file will be resolved.
+     */
+    public void remove(UserCtx ctx, FileName name, boolean direct) throws VFSException;
+
+    /**
+     *  FileOpInfo must be filled with tag, filename (file must exist), buf and
+     *  complete. If exception is occured, it indicates persistence problem or
+     *  security restrictions. Returns FileWriteInfo filled with new tag.
+     *
+     * @param  ctx               Description of the Parameter
+     * @param  info              Description of the Parameter
+     * @return                   Description of the Return Value
+     * @exception  VFSException  Description of the Exception
+     */
+    public FileWriteInfo write(UserCtx ctx, FileOpInfo info) throws VFSException;
+
+    /**
+     *  FileOpInfo must be filled with tag (not mandatory if offset is 0), filename
+     *  (file must exist) and offset. If exception is occured, it indicates
+     *  persistence problem or security restrictions. Returns FileReadInfo filled
+     *  with buffer, length and information if there are any more records available
+     *  for this file.
+     *
+     * @param  uctx              Description of the Parameter
+     * @param  info              Description of the Parameter
+     * @return                   Description of the Return Value
+     * @exception  VFSException  Description of the Exception
+     */
+    public FileReadInfo read(UserCtx uctx, FileOpInfo info) throws VFSException;
+
+    /**
+     *  Resolves the filename up to the final target.
+     *
+     * @param  ctx       User's context.
+     * @param  filename  Filename to be resolved.
+     * @param  partial   If true, then last token in path is not resolved. Useful
+     *      when there's a need to resolve to-be-created file, etc.
+     * @return           Resolved filename.
+     */
+    public FileName resolve(UserCtx ctx, FileName filename, boolean partial) throws VFSException;
+
+    /**
+     *  Returns all the links that have the given target.
+     *
+     * @param  ctx      User's context.
+     * @param  target   Links to this target is to be looked up.
+     * @param  partial  If true, then last token in the target is not resolved.
+     * @return          Collection of FileInfos of type link and target as given.
+     */
+    public Collection getLinks(UserCtx ctx, FileName target, boolean partial) throws VFSException;
+
+    /**
+     *  Tells if a file has content or not..
+     *
+     * @param  ctx     User's context.
+     * @param  file    File to be checked for content.
+     * @param  direct  If false, then the filename is resolved all the way up to
+     *      the final target.
+     * @return         True if file has any content.
+     */
+    public boolean hasContent(UserCtx ctx, FileName file, boolean direct) throws VFSException;
+
+    /**
+     *  Moves or renames file from oldPath to newPath. Moving/Renaming occurs
+     *  recursively. Meaning all children file's will be affected.
+     *
+     * @param  ctx      User's context.
+     * @param  oldName  The filename of the file to be renamed or moved.
+     * @param  newName  The target filename.
+     * @param  direct   If false, then the filename is resolved all the way up to
+     *      the final target.
+     */
+    public void move(UserCtx ctx, FileName oldName, FileName newName, boolean direct) throws VFSException;
+
+    /**
+     *  Positions file right before given file in the same directory.
+     *
+     * @param  ctx   User's context.
+     * @param  file  File to be reordered.
+     * @param  next  File to be used as relative destination.
+     * @return       The orderIndex of reordered file in parent directory.
+     */
+    public float moveBefore(UserCtx ctx, FileName file, FileName next) throws VFSException;
+}
+

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSAuth.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSAuth.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSAuth.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSAuth.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,7 @@
+package org.jboss.fresh.vfs.vfs;
+
+
+public interface VFSAuth {
+
+    public boolean isAuthorized(UserCtx uctx, String action, FileInfo fileinfo);
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSConfig.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSConfig.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSConfig.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSConfig.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,10 @@
+package org.jboss.fresh.vfs.vfs;
+
+public interface VFSConfig {
+
+    public void setMeta(VFSMeta meta);
+
+    public void setStore(VFSStore store);
+
+    public void setTagFactory(TagFactory tag);
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSException.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSException.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSException.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSException.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,42 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.io.IOException;
+
+
+public class VFSException extends IOException {
+
+    public VFSException() {
+        super();
+    }
+
+    public VFSException(String msg) {
+        super(msg);
+    }
+
+    public VFSException(Throwable t) {
+        super(t.getMessage());
+		  initCause(t);
+    }
+
+	public VFSException(String msg, Throwable t) {
+		 super(msg);
+		 initCause(t);
+	}
+
+    public void setUnderlyingThrowable(Throwable t) {
+		 initCause(t);
+    }
+
+    public Throwable getUnderlyingThrowable() {
+       return getCause();
+    }
+
+    public String getMessage() {
+        String retstr = super.getMessage();
+        if (getCause() == null)
+            return retstr;
+        else
+            return retstr + " Root exception is: " + getCause().toString();
+    }
+
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSFileHandlerFactory.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSFileHandlerFactory.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSFileHandlerFactory.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSFileHandlerFactory.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,12 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public interface VFSFileHandlerFactory {
+
+	public InputStream getInputStream(FileInfo finf) throws VFSException;
+	public OutputStream getOutputStream(FileInfo finf) throws VFSException;
+
+	// ce se pokaze potreba 
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSIOException.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSIOException.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSIOException.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSIOException.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,14 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.io.IOException;
+
+public class VFSIOException extends IOException {
+
+    public VFSIOException(Throwable ex) {
+        this.initCause(ex);
+    }
+
+    public Throwable getRootThrowable() {
+        return getCause();
+    }
+}
\ No newline at end of file

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMeta.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSMeta.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMeta.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMeta.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,93 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ *  Part of VFS that takes care of meta information pieces' persistence.
+ */
+public interface VFSMeta {
+
+    /**
+     *  Set the cache updater - listener that keeps the cache fresh.
+     *
+     * @param  updater  The cache updater.
+     */
+    public void setCacheUpdater(VFSMetaCacheUpdater updater);
+
+    /**
+     *  Get the cache updater;.
+     *
+     * @return          Wanted cache updater.
+     */
+    public VFSMetaCacheUpdater getCacheUpdater();
+
+    /**
+     *  Name must be valid FileName object.
+     *
+     * @param  name  Filename of the file to be tested for existance.
+     * @return       True if file exists, false otherwise.
+     */
+    public boolean exists(FileName name) throws Exception;
+
+    /**
+     *  Path must be valid FileName object.
+     */
+    public int countChildren(FileName path) throws Exception;
+
+
+    /**
+     *  Path must point to existing file or dir and must not be null.
+     */
+    public List resolvePath(FileName path) throws Exception;
+
+
+    /**
+     *  Path must point to existing file or dir and must not be null.
+     *
+     * @param  name  Description of the Parameter
+     * @return       The fileInfo value
+     */
+    //public FileName resolve(FileName path, int maxDepth) throws Exception;
+
+    /**
+     *  Name must point to existing file or dir and must not be null.
+     *
+     * @return       The fileInfo value
+     */
+    public FileInfo getFileInfo(FileName name) throws Exception;
+
+    /**
+     *  Name must point to existing file or dir and must not be null. Return
+     *  FileInfos of all links whoose target is pointing to name.
+     *
+     * @return       The links value
+     */
+    public Collection getLinks(FileName name) throws Exception;
+
+    /**
+     *  Name must point to existing file or dir and must not be null.
+     */
+    public List list(FileName name) throws Exception;
+
+
+    /**
+     *  File must not exist and must not be null.
+     */
+    public void create(FileInfo file) throws Exception;
+
+    /**
+     *  File must exist and must not be null.
+     */
+    public void update(FileInfo file) throws Exception;
+
+    /**
+     *  Name must point to existing file or dir and must not be null.
+     */
+    public void remove(FileName name) throws Exception;
+
+    public void rename(FileName oldName, FileName newName) throws Exception;
+
+    public float moveBefore(FileName file, FileName next) throws Exception;
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaCacheUpdater.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSMetaCacheUpdater.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaCacheUpdater.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaCacheUpdater.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,25 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.util.List;
+
+
+public interface VFSMetaCacheUpdater {
+
+    public void onExists(FileName fn, boolean result);
+
+    public void onCountChildren(FileName fn, int count);
+
+    public void onGetFileInfo(FileName fn, FileInfo fi);
+
+    public void onList(FileName fn, List list);
+
+    public void onCreate(FileInfo fi);
+
+    public void onUpdate(FileInfo fi);
+
+    public void onRemove(FileName fn, boolean recursive);
+
+    public void onRename(FileName fn, FileName newFn);
+
+    public void onMoveBefore(FileName fn, float idx);
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaException.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSMetaException.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaException.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaException.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,8 @@
+package org.jboss.fresh.vfs.vfs;
+
+public class VFSMetaException extends VFSException {
+    public VFSMetaException() {
+        super();
+    }
+}
+

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaFactory.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSMetaFactory.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaFactory.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSMetaFactory.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,9 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.util.Properties;
+
+
+public interface VFSMetaFactory {
+
+    public VFSMeta create(Properties props) throws Exception;
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStore.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSStore.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStore.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStore.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,47 @@
+package org.jboss.fresh.vfs.vfs;
+
+
+public interface VFSStore {
+
+    /**
+     *  Set the cache updater - listener that keeps the cache fresh.
+     *
+     * @param  updater  The cache updater.
+     */
+    public void setCacheUpdater(VFSStoreCacheUpdater updater);
+
+    /**
+     *  Get the cache updater;.
+     *
+     * @return          Wanted cache updater.
+     */
+    public VFSStoreCacheUpdater getCacheUpdater();
+
+    /**
+     *  FileName must not be null, it can point to inexisting file.
+     */
+    public boolean hasContent(FileName filename) throws Exception;
+
+    /**
+     *  Reads a chunk of content data and returns it as FileRetInfo object.
+     *  FileOpInfo must be filled filename (file must exist), filepos and buf.
+     */
+    public FileReadInfo readContent(FileOpInfo opinfo) throws Exception;
+
+    /**
+     *  Writes a chunk of content data. FileOpInfo must be filled filename (file
+     *  doesn't need to exist), filepos, and len.
+     */
+    public void writeContent(FileOpInfo opinfo) throws Exception;
+
+    /**
+     *  Removes content data for specified file from persistence.
+     */
+    public void removeContent(FileName name) throws Exception;
+
+    /**
+     *  Renames contents filename
+     */
+    public void rename(FileName oldPath, FileName newPath) throws Exception;
+
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreCacheUpdater.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSStoreCacheUpdater.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreCacheUpdater.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreCacheUpdater.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,13 @@
+package org.jboss.fresh.vfs.vfs;
+
+
+public interface VFSStoreCacheUpdater {
+
+    public void onHasContent(FileName fn, boolean result);
+
+    public void onWriteContent(FileName fn);
+
+    public void onRemoveContent(FileName fn);
+
+    public void onRenameContent(FileName fn);
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreFactory.java (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/VFSStoreFactory.java)
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreFactory.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/VFSStoreFactory.java	2009-04-29 15:28:02 UTC (rev 88009)
@@ -0,0 +1,9 @@
+package org.jboss.fresh.vfs.vfs;
+
+import java.util.Properties;
+
+
+public interface VFSStoreFactory {
+
+    public VFSStore create(VFSMeta meta, Properties props) throws Exception;
+}

Copied: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl (from rev 88004, projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/vfs/impl)




More information about the jboss-cvs-commits mailing list