[jboss-cvs] JBossAS SVN: r95052 - in projects/fresh/trunk: fresh-scripting/src/main/java/org/jboss/fresh/deployer and 14 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 16 16:38:24 EDT 2009


Author: ctomc
Date: 2009-10-16 16:38:23 -0400 (Fri, 16 Oct 2009)
New Revision: 95052

Added:
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/Executable.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/ExecutablePrecedense.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/ExecutableRegistrator.java
Removed:
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderService.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderServiceMBean.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolService.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolServiceMBean.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/RegistryExe.java
   projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/JNDI2RegistryResolverFactory.java
   projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/RegistryContext.java
   projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryContext.java
   projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryStore.java
Modified:
   projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-jboss-beans.xml
   projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingService.java
   projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingServiceMBean.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/ctx/JNDICtx.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinder.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinder.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSService.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorService.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileService.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/remoteshell/ejb/impl/RemoteShellImpl.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/EventCentralQueryExe.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/JNDIExe.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/MountExe.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/cms/CtxDelegateExe.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/SystemShellImpl.java
   projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/Cp2VFSProvider.java
   projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/SSHShell.java
   projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/persist/JDBCIncrementalPKGenerator.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/VFSInputStream.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSMeta.java
   projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSStore.java
Log:
no more registry context, first draft for annotation based executable registry, *not tested*, should work on latest jbas 5.2 build

Modified: projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-jboss-beans.xml
===================================================================
--- projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-jboss-beans.xml	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-jboss-beans.xml	2009-10-16 20:38:23 UTC (rev 95052)
@@ -24,7 +24,7 @@
   </bean>
 
   <bean name="FreshSystemShell" class="org.jboss.fresh.shell.impl.LazySystemShellImpl" >
-      <!--annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name = "java:/FRESH/SystemShell")</annotation-->
+      <annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name = "java:/FRESH/SystemShell")</annotation>
       <constructor>
         <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
         <parameter>
@@ -60,19 +60,7 @@
     </constructor>
   </bean>
 
-  <!-- On Demand -->
 
-    <!--bean name="FreshPoolService" class="org.jboss.fresh.deployer.PoolService" mode="On Demand">
-        <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="FRESH:service=ThreadPool",exposedInterface=org.jboss.fresh.deployer.PoolServiceMBean.class)</annotation>
-        <property name="JNDIName">java:/FRESH/ThreadPool</property>
-        <property name="factoryName">org.jboss.fresh.cpii.services.PoolRunnerFactory</property>
-        <property name="poolName">ThreadPool</property>
-        <property name="minSize">0</property>
-        <property name="maxSize">1000</property>
-        <property name="blocking">true</property>
-        <property name="blockingTimeout">10000</property>
-    </bean-->
-
     <bean name="FreshVFSService" class="org.jboss.fresh.deployer.VFSService" mode="On Demand">
         <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="FRESH:service=VFS.Mem",exposedInterface=org.jboss.fresh.deployer.VFSServiceMBean.class)</annotation>
         <property name="JNDIName">java:/FRESH/VFSMem</property>
@@ -250,7 +238,12 @@
         <depends>FreshVFSInit</depends>
 	  </bean>
 
-  <bean name="FreshContextBinder" class="org.jboss.fresh.deployer.ContextBinder" mode="On Demand">
+
+  <bean name="FreshGlobalContext" class="org.jboss.fresh.ctx.FlatContext" mode="On Demand">
+      <annotation>@org.jboss.aop.microcontainer.aspects.jndi.JndiBinding(name = "java:/FRESH/GlobalContext")</annotation>
+  </bean>
+
+    <bean name="FreshContextBinder" class="org.jboss.fresh.deployer.ContextBinder" mode="On Demand">
       <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="FRESH:service=GlobalContext",exposedInterface=org.jboss.fresh.deployer.ContextBinderMBean.class)</annotation>
       <property name="JNDIName">java:/FRESH/GlobalContext</property>
   </bean>

Modified: projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingService.java
===================================================================
--- projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingService.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingService.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -24,7 +24,7 @@
 import java.util.LinkedList;
 
 
-public class ScriptingService extends RegistryNamingBinder implements ScriptingServiceMBean {
+public class ScriptingService extends NamingBinder implements ScriptingServiceMBean {
 
 	private String cfgPath;
 	private List langs = new LinkedList();
@@ -42,9 +42,12 @@
 	public String getConfigPath() {
 		return cfgPath;
 	}
-	
-	
-	// The format of the config file
+
+
+
+
+
+    // The format of the config file
 	/*
 	
 	<scripting>
@@ -308,4 +311,5 @@
 
     }
 
+
 }
\ No newline at end of file

Modified: projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingServiceMBean.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingServiceMBean.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -3,6 +3,6 @@
 import org.jboss.fresh.deployer.ScriptingCentral;
 import org.jboss.fresh.deployer.RegistryNamingBinderMBean;
 
-public interface ScriptingServiceMBean extends ScriptingCentral, RegistryNamingBinderMBean {
+public interface ScriptingServiceMBean extends ScriptingCentral, NamingBinderMBean {
 
 }
\ No newline at end of file

Added: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/Executable.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/Executable.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/Executable.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -0,0 +1,20 @@
+package org.jboss.fresh.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author Tomaz Cerar
+ * @version $Revision$
+ * @created 2009-05-20 00:28
+ * @modifiedBy $Author$
+ */
+
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE})
+public @interface Executable {
+    String name();
+    int precedense() default ExecutablePrecedense.RUNTIME;
+}

Added: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/ExecutablePrecedense.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/ExecutablePrecedense.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/annotations/ExecutablePrecedense.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -0,0 +1,14 @@
+package org.jboss.fresh.annotations;
+
+/**
+ * @author Tomaz Cerar
+ * @version $Revision$
+ * @created 2009-05-20 00:31
+ * @modifiedBy $Author$
+ */
+public class ExecutablePrecedense implements java.io.Serializable {
+    public static final int BUILD_IN = 10;
+    public static final int APP_SERVER = 30;
+    public static final int RUNTIME = 40;
+
+}

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/ctx/JNDICtx.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/ctx/JNDICtx.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/ctx/JNDICtx.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,6 +1,6 @@
 package org.jboss.fresh.ctx;
 
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -30,7 +30,7 @@
             Object o = map.get(key);
             if (o == null) return null;
 
-            RegistryContext ctx = new RegistryContext();
+            InitialContext ctx = new InitialContext();
             return ctx.lookup((String) o);
 
         } catch (Exception ex) {

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderService.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderService.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,54 +0,0 @@
-package org.jboss.fresh.deployer;
-
-/**
- * @author strukelj
- * @version $Revision$
- * @created 11.11.2005, 12:16:59
- * @date $Date$
- * @source $Source$
- * @modified $Author$
- */
-public class JavaBeanBinderService extends RegistryNamingBinder implements JavaBeanBinderServiceMBean {
-    public static final String VERSION = "$Header$";
-    private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(JavaBeanBinderService.class);
-
-    private String cname;
-    private String cnameImpl;
-    
-    protected String getBindClass() {
-        return cname;
-    }
-
-    protected Object classToInstance(Class c) {
-        try {
-        	if(cnameImpl != null) {
-        		ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        		Class clazz = cl.loadClass(cnameImpl);
-        		return clazz.newInstance();
-        	} else {
-        		return c.newInstance();
-        	}
-        } catch(RuntimeException ex) {
-            throw ex;
-        } catch(Exception ex) {
-            throw new RuntimeException(ex);
-        }
-    }
-
-    public void setClassName(String cname) {
-        this.cname = cname;
-    }
-
-    public String getClassName() {
-        return cname;
-    }
-
-    public void setImplClassName(String cname) {
-        this.cnameImpl = cname;
-    }
-
-    public String getImplClassName() {
-        return cnameImpl;
-    }
-
-}

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderServiceMBean.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JavaBeanBinderServiceMBean.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,17 +0,0 @@
-package org.jboss.fresh.deployer;
-
-/**
- * @author strukelj
- * @version $Revision$
- * @created 11.11.2005, 12:23:42
- * @date $Date$
- * @source $Source$
- * @modified $Author$
- */
-public interface JavaBeanBinderServiceMBean extends RegistryNamingBinderMBean {
-    public static final String VERSION = "$Header$";
-
-    public void setClassName(String cname);
-    public String getClassName();
-    
-}

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinder.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinder.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinder.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -100,7 +100,7 @@
 					ctx = cx.createSubcontext(ctxName);
 				}
 			} catch (NameNotFoundException e) {
-				log.warn("Could not lookup for ctx ",e);
+				log.warn("Could not lookup for ctx "+ctxName);
 				ctx = cx.createSubcontext(ctxName);
 				log.debug("ctx after create subcontext: "+ctx);
 			}

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolService.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolService.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,141 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import org.jboss.fresh.pool.pool.Pool;
-import org.jboss.fresh.pool.pool.PoolFactory;
-import org.jboss.fresh.pool.pool.impl.PoolImpl;
-
-
-/**
- * This is a simple service that sustains a file on the disk. It it it simply puts an integer specifying the number of invocations made from beginning of its running.
- */
- at Deprecated
-public class PoolService extends RegistryNamingBinder implements PoolServiceMBean {
-
-	private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(PoolService.class);
-	private String poolname;
-	private String factoryName;
-	//private String factoryName="com.parsek.cpii.services.PoolRunnerFactory";
-
-
-	private int minsize = 0;			// default: 0
-	private int maxsize = 100;			// default: 100
-	private boolean isBlocking = true;		// default: true
-	private long blockingTimeout = 30000;	// default: 30 secs - even this is unacceptible - who will wait this long !!!
-
-
-	public void setFactoryName(String name) {
-		factoryName = name;
-	}
-
-	public String getFactoryName() {
-		return factoryName;
-	}
-
-	public void setPoolName(String name) {
-		poolname = name;
-	}
-
-	public String getPoolName() {
-		return poolname;
-	}
-
-	public void setMinSize(int val) {
-		minsize = val;
-	}
-
-	public int getMinSize() {
-		return minsize;
-	}
-
-	public void setMaxSize(int i) {
-		maxsize = i;
-	}
-
-	public int getMaxSize() {
-		return maxsize;
-	}
-
-	public void setBlocking(boolean val) {
-		isBlocking = val;
-	}
-
-	public boolean getBlocking() {
-		return isBlocking;
-	}
-
-	public void setBlockingTimeout(long val) {
-		blockingTimeout = val;
-	}
-
-	public long getBlockingTimeout() {
-		return blockingTimeout;
-	}
-
-	// pretty generic code comes here
-
-	public String getName() {
-		return "Generic Pool MBean";
-	}
-
-
-	protected String getBindClass() {
-		return Pool.class.getName();
-	}
-
-
-	protected Object classToInstance(Class c) {
-
-		// instaliraj se kot NotificationListener
-
-		// create pool instance.
-		// set factory
-
-		try {
-
-			PoolImpl pool = (PoolImpl) getServiceObject();
-
-			if (pool != null) pool.stop();
-
-			String fname = getFactoryName();
-			ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
-			Class fc = cl.loadClass(fname);
-			PoolFactory f = (PoolFactory) fc.newInstance();
-
-			pool = new PoolImpl(poolname, f);
-			pool.setMinSize(minsize);
-			pool.setMaxSize(maxsize);
-			pool.setNonBlocking(!isBlocking);
-			pool.setTimeout(blockingTimeout); // why is it int ???
-
-			pool.start();
-
-			setServiceObject(pool);
-
-			return pool;
-
-		} catch (Exception ex) {
-			throw new RuntimeException(ex.toString());
-		}
-	}
-
-	protected boolean bindByReference() {
-		return true;
-	}
-
-	public void doStop() {
-		try {
-			log.debug("doStop() called");
-			super.doStop();
-		} finally {
-			try {
-				PoolImpl pool = (PoolImpl) getServiceObject();
-				log.info("pool: " + pool);
-				if (pool != null) pool.stop();
-			} catch (Exception ex) {
-				log.error("Exception while stopping the pool: ", ex);
-				throw new RuntimeException(ex.toString());
-			}
-		}
-	}
-}

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolServiceMBean.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/PoolServiceMBean.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,32 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
- at Deprecated
-public interface PoolServiceMBean extends RegistryNamingBinderMBean {
-
-    public void setFactoryName(String name);
-
-    public String getFactoryName();
-
-    public void setPoolName(String name);
-
-    public String getPoolName();
-
-    public void setMinSize(int val);
-
-    public int getMinSize();
-
-    public void setMaxSize(int i);
-
-    public int getMaxSize();
-
-    public void setBlocking(boolean val);
-
-    public boolean getBlocking();
-
-    public void setBlockingTimeout(long val);
-
-    public long getBlockingTimeout();
-
-
-}
\ No newline at end of file

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinder.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinder.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinder.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,7 +1,7 @@
 package org.jboss.fresh.deployer;
 
 import javax.naming.*;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.naming.StaticObjectStore;
 
 public abstract class RegistryNamingBinder extends ServiceModule implements RegistryNamingBinderMBean {
@@ -82,7 +82,7 @@
     }
 
     private void bind() throws NamingException {
-        Context ctx = new RegistryContext();
+        Context ctx = new InitialContext();
         String name = getJNDIName();
         if (name == null)
             return;
@@ -164,7 +164,7 @@
 
 	private void unbind() throws NamingException {
         if (m_bindName != null) {
-            new RegistryContext().unbind(m_bindName);
+            new InitialContext().unbind(m_bindName);
             log.info(getName() + ": '" + getJNDIName() + "' removed from registry");
         
         }

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSService.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSService.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -2,7 +2,7 @@
 
 
 import org.apache.log4j.Logger;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.vfs.RootVFS;
 import org.jboss.fresh.vfs.VFS;
 import org.jboss.fresh.vfs.impl.DefaultRootVFS;
@@ -50,7 +50,7 @@
     public void doStart() throws Exception {
         super.doStart();
         if (props != null) {
-            RegistryContext ctx = new RegistryContext();
+            InitialContext ctx = new InitialContext();
             Set set = props.entrySet();
             Iterator it = set.iterator();
             while (it.hasNext()) {

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorService.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorService.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -16,7 +16,7 @@
 
 import javax.naming.InitialContext;
 
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.*;
 import org.jboss.fresh.shell.ejb.RemoteShellHome;
 import org.jboss.fresh.shell.ejb.RemoteShell;
@@ -139,7 +139,7 @@
         	try {
 
                 if (eUseLocal) {
-                    RegistryContext ctx = new RegistryContext();
+                    InitialContext ctx = new InitialContext();
                     SystemShell sysshell = (SystemShell) ctx.lookup(eSvcname);
                     Shell shell = sysshell.startSession(null, false);
 

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileService.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileService.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,7 +1,7 @@
 package org.jboss.fresh.deployer;
 
 import org.jboss.fresh.io.IOUtils;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.ProcessInfo;
 import org.jboss.fresh.shell.Shell;
 import org.jboss.fresh.shell.ShellOutputStream;
@@ -90,7 +90,7 @@
         ShellOutputStream sos = null;
         OutputStreamWriter osw = null;
         try {
-            ctx = new RegistryContext();
+            ctx = new InitialContext();
 
             try {
                 SystemShell sysshell = (SystemShell) ctx.lookup("java:/FRESH/SystemShell");

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/remoteshell/ejb/impl/RemoteShellImpl.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/remoteshell/ejb/impl/RemoteShellImpl.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/remoteshell/ejb/impl/RemoteShellImpl.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -16,7 +16,7 @@
 import javax.transaction.UserTransaction;
 
 import org.jboss.fresh.vfs.UserCtx;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.ProcessInfo;
 import org.jboss.fresh.shell.Shell;
 import org.jboss.fresh.shell.ShellException;
@@ -184,7 +184,7 @@
 				}
 			}
 			try {
-				sysshell = (SystemShell) new RegistryContext().lookup(sslookup);
+				sysshell = (SystemShell) new InitialContext().lookup(sslookup);
 //			} catch(NameNotFoundException ex) {
 //				ex.printStackTrace();
 //				throw new RuntimeException(ex.getMessage());

Added: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/ExecutableRegistrator.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/ExecutableRegistrator.java	                        (rev 0)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/ExecutableRegistrator.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -0,0 +1,52 @@
+package org.jboss.fresh.shell;
+
+import org.jboss.fresh.annotations.Executable;
+import org.jboss.logging.Logger;
+
+
+/**
+ * @author Tomaz Cerar
+ * @version $Revision$
+ * @created 2009-05-20 00:34
+ * @modifiedBy $Author$
+ */
+public class ExecutableRegistrator implements java.io.Serializable {
+    private static final Logger log = Logger.getLogger(ExecutableRegistrator.class);
+
+    private SystemShell systemShell;
+
+    /**
+     * inistatiated by MC
+     *
+     * @param shell primariy systemshell
+     */
+    public ExecutableRegistrator(SystemShell shell) {
+        this.systemShell = shell;
+    }
+
+    public void registerExecutable(Class executable) {
+
+        org.jboss.fresh.annotations.Executable exeInfo = (Executable) executable.getAnnotation(org.jboss.fresh.annotations.Executable.class);
+        if (exeInfo==null)throw new RuntimeException("Class should be annotated with @Executable");
+        registerExacutable(exeInfo.name(),executable);
+
+    }
+
+    public void registerExacutable(String name, Class executable){
+        /*  to register we no just register executable in vfs, for now this should be sufficiant
+            touch /bin/ps
+            setffld /bin/ps mime cp2-shell/executable
+            setattr /bin/ps Class org.jboss.fresh.shell.commands.PsExe
+         */
+        try {
+            Shell shell = systemShell.startSession(null, false);
+            log.info("we are registering executable '" + name + "' with class: '" + executable.getName() + "'");
+            shell.execute("touch /bin/" + name);
+            shell.execute("setffld /bin/" + name + " mime cp2-shell/executable");
+            shell.execute("setattr /bin/" + name + " Class " + executable.getName() + "");
+            log.info("registration of executable '" + name + "' successful!");
+        } catch (ShellException e) {
+            log.error("could not register executable...", e);
+        }
+    }
+}

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/EventCentralQueryExe.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/EventCentralQueryExe.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/EventCentralQueryExe.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -4,7 +4,7 @@
 import org.jboss.fresh.io.PrintWriter2;
 import org.jboss.fresh.shell.AbstractExecutable;
 import org.jboss.fresh.events.EventCentral;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.ctx.Context;
 
 import java.util.Map;
@@ -74,7 +74,7 @@
 		EventCentral ec = null;
 
 		if (name != null) {
-			RegistryContext ctx = new RegistryContext();
+			InitialContext ctx = new InitialContext();
 			try {
 			 	ec = (EventCentral) ctx.lookup(name);
 			} catch(ClassCastException ex) {

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/JNDIExe.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/JNDIExe.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/JNDIExe.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -5,7 +5,7 @@
 import org.jboss.fresh.io.PrintWriter2;
 import org.jboss.fresh.io.BufferObjectReader;
 import org.jboss.fresh.shell.AbstractExecutable;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 
 import javax.naming.*;
 import java.util.Hashtable;
@@ -180,9 +180,6 @@
                 if(!oin.isFinished()) {
                     o = oin.readObject();
                 }
-            } else if("JNDI2Registry".equals(spiObjectFactory)) {
-                o = new RegistryContext().lookup((String) spiParams.get(1));
-                factoryCName = org.jboss.fresh.registry.JNDI2RegistryResolverFactory.class.getName();
             } else if("StaticStore".equals(spiObjectFactory)) {
                 factoryCName = org.jboss.fresh.naming.StaticObjectStore.class.getName();
             }

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/MountExe.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/MountExe.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/MountExe.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -4,7 +4,7 @@
 import org.jboss.fresh.vfs.VFS;
 import org.jboss.fresh.io.BufferWriter;
 import org.jboss.fresh.io.PrintWriter2;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.AbstractExecutable;
 
 import java.util.Iterator;
@@ -41,7 +41,7 @@
 
 		RootVFS rootfs = null;
 
-		RegistryContext ctx = new RegistryContext();
+		InitialContext ctx = new InitialContext();
 		try {
 			rootfs = (RootVFS) ctx.lookup("java:/CP2/VFS");
 		} catch(ClassCastException ex) {

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/RegistryExe.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/RegistryExe.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/RegistryExe.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,134 +0,0 @@
-package org.jboss.fresh.shell.commands;
-
-import org.jboss.fresh.io.BufferObjectWriter;
-import org.jboss.fresh.io.BufferWriter;
-import org.jboss.fresh.io.PrintWriter2;
-import org.jboss.fresh.shell.AbstractExecutable;
-import org.jboss.fresh.registry.RegistryContext;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import java.util.Hashtable;
-
-public class RegistryExe extends AbstractExecutable {
-	private static transient org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(RegistryExe.class);
-
-	/**
-	 We set the current active project projekt.
-	 */
-
-
-	public void process(String exepath, String[] params) throws Exception {
-		log.debug("entered");
-
-
-		PrintWriter2 out = new PrintWriter2(new BufferWriter(getStdOut()));
-
-		boolean g = false;
-		boolean l = false;
-		boolean b = false;
-		boolean help = false;
-		boolean tex = false;
-
-		String name = null;
-		String factory = null;
-		String host = null;
-		Hashtable env = null;
-
-		// see what to do:
-		for (int i = 0; i < params.length; i++) {
-			String val = params[i];
-
-			if (val.equals("-g") || val.equals("--get")) {
-				g = true;
-			} else if (val.equals("-l") || val.equals("--list")) {
-				l = true;
-			} else if (val.equals("-b") || val.equals("--bind")) {
-				b = true;
-			} else if (val.equals("-h") || val.equals("--help")) {
-				help = true;
-			} else if (val.equals("--ex")) {
-				tex = true;
-			} else if (val.equals("--factory")) {
-				try {
-					factory = params[++i];
-				} catch (Exception ex) {
-				}
-			} else if (val.equals("--host")) {
-				try {
-					host = params[++i];
-				} catch (Exception ex) {
-				}
-			} else {
-				name = val;
-			}
-		}
-
-		if (params.length == 0 || help) {
-
-			out.println("Usage: jndi [-glbh] <lookup name>");
-			out.println("		lookup name : lookup name i.e. java:UserTransaction");
-			out.println("		-g, --get : get the object for the specified name");
-			out.println("		-l, --list : list the contents of the context");
-			out.println("		-b, --bind : bind an object passed on stdin under the specified name");
-			out.println("		-h, --help : this help");
-			out.close();
-			log.debug("done");
-			return;
-		}
-
-		RegistryContext ctx = new RegistryContext();
-
-
-		if (g) {
-			BufferObjectWriter oout = new BufferObjectWriter(getStdOut());
-			Object o = null;
-
-			try {
-				o = ctx.lookup(name);
-			} catch (NamingException ex) {
-				if (tex)
-					throw new RuntimeException(ex);
-				else
-					out.print("Name not bound: " + name);
-				return;
-			}
-
-			oout.writeObject(o);
-			oout.close();
-			return;
-		}
-
-		if (l) {
-			BufferObjectWriter oout = new BufferObjectWriter(getStdOut());
-			Object o = ctx.lookup(name);
-			if (!(o instanceof Context)) {
-				if (tex)
-					throw new RuntimeException("Object is not instance of Context. Can't list it. : " + name);
-				else
-					out.print("Object is not instance of Context. Can't list it. : " + name);
-				return;
-			}
-
-			NamingEnumeration it = ctx.listBindings(name);
-			while (it.hasMore()) {
-				Binding bing = (Binding) it.next();
-				out.println(bing.toString());
-			}
-			out.close();
-			return;
-		}
-
-
-		if (b) {
-			out.println("Not implemented yet.");
-			out.close();
-			return;
-		}
-
-
-		log.debug("done");
-	}
-}
\ No newline at end of file

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/cms/CtxDelegateExe.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/cms/CtxDelegateExe.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/cms/CtxDelegateExe.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -4,7 +4,7 @@
 import org.jboss.fresh.io.BufferWriter;
 import org.jboss.fresh.shell.AbstractExecutable;
 import org.jboss.fresh.shell.Shell;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 
 import java.io.PrintWriter;
 
@@ -47,7 +47,7 @@
 
 			// take parameter 1
 			// look up the name through InitialContext
-			RegistryContext ctx = new RegistryContext();
+			InitialContext ctx = new InitialContext();
 			Object obj = null;
 			try {
 				obj = (Context) ctx.lookup(tmp);

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -37,7 +37,7 @@
 import org.jboss.fresh.io.NullBuffer;
 import org.jboss.fresh.io.OutBuffer;
 import org.jboss.fresh.io.OutputStreamBuffer;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.EnvProperties;
 import org.jboss.fresh.shell.Executable;
 import org.jboss.fresh.shell.NoSuchProcessException;
@@ -647,7 +647,7 @@
 
         // would be nice to have a wrapper that returns null and throws no exceptions
         try {
-            actx = (Context) new RegistryContext().lookup("java:/FRESH/GlobalContext");
+            actx = (Context) new InitialContext().lookup("java:/FRESH/GlobalContext");
         } catch(Exception ex) {
         }
 
@@ -704,14 +704,14 @@
 					c = (Context) ctx.get("AppContext");
 					if(c == null) {
 						try {
-							c = (Context) new RegistryContext().lookup("java:/FRESH/GlobalContext");
+							c = (Context) new InitialContext().lookup("java:/FRESH/GlobalContext");
 						} catch(Exception ex) {}
 						i++;
 					}
 				} else if(i==1) {
 
 					try {
-						c = (Context) new RegistryContext().lookup("java:/FRESH/GlobalContext");
+						c = (Context) new InitialContext().lookup("java:/FRESH/GlobalContext");
 					} catch(Exception ex) {}
 					if (c == null) {
 						i++;

Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/SystemShellImpl.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/SystemShellImpl.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/SystemShellImpl.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -2,11 +2,13 @@
 
 import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.fresh.deployer.RegistryNamingBinder;
-import org.jboss.fresh.registry.RegistryContext;
+import org.jboss.fresh.deployer.NamingBinder;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.*;
 import org.jboss.fresh.vfs.UserCtx;
 import org.jboss.fresh.vfs.VFS;
 import org.jboss.util.threadpool.ThreadPool;
+import org.jboss.aop.microcontainer.aspects.jndi.JndiBinding;
 
 import javax.naming.NamingException;
 import java.util.*;
@@ -22,8 +24,8 @@
  */
 
 //@Bean(name = "SystemShell")
-//@JndiBinding(name = "java:/FRESH/SystemShell")
-public class SystemShellImpl extends RegistryNamingBinder implements SystemShell {
+ at JndiBinding(name = "java:/FRESH/SystemShell")
+public class SystemShellImpl extends NamingBinder implements SystemShell {
     protected static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(SystemShellImpl.class);
 
     HashMap shellmap = new HashMap();
@@ -48,11 +50,17 @@
         this.vfsName = vfsname;
         log.info("calling do start!");
         startTime = new Date();
+
         doStart();
         reinitGC();
 
     }
 
+    @Override
+    protected boolean bindByReference() {
+        return true;
+    }
+
     public void setThreadPool(ThreadPool threadPool) {
         this.threadPool = threadPool;
     }
@@ -118,7 +126,7 @@
     public VFS getVFS() {
         VFS vfs = null;
         try {
-            RegistryContext ctx = new RegistryContext();
+            InitialContext ctx = new InitialContext();
             vfs = (VFS) ctx.lookup(vfsName);
         } catch (NamingException ex) {
             log.error(ex.getMessage(), ex);

Modified: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/Cp2VFSProvider.java
===================================================================
--- projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/Cp2VFSProvider.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/Cp2VFSProvider.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -9,7 +9,7 @@
 import com.sshtools.j2ssh.sftp.FileAttributes;
 import com.sshtools.j2ssh.sftp.SftpFile;
 import org.apache.log4j.Logger;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.SystemShell;
 import org.jboss.fresh.vfs.*;
 
@@ -44,7 +44,7 @@
         try {
             fmt = new DecimalFormat("00000000");
 
-            RegistryContext ctx = new RegistryContext();
+            InitialContext ctx = new InitialContext();
             SystemShell ssh = (SystemShell) ctx.lookup("java:/CP2/SystemShell");
             vfs = ssh.getVFS();
             log.info("Successfully initialized vfs: " + vfs);

Modified: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/SSHShell.java
===================================================================
--- projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/SSHShell.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/ssh/SSHShell.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -8,7 +8,7 @@
 import org.jboss.fresh.io.BufferInputStream;
 import org.jboss.fresh.io.EOLFixInputStream;
 import org.jboss.fresh.io.PrintWriter2;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 import org.jboss.fresh.shell.ProcessInfo;
 import org.jboss.fresh.shell.ShellException;
 import org.jboss.fresh.shell.ShellOutputStream;
@@ -85,7 +85,7 @@
         StringBuffer errMessage = new StringBuffer();
 
         try {
-            RegistryContext ctx = new RegistryContext();
+            InitialContext ctx = new InitialContext();
             SystemShell ssh = (SystemShell) ctx.lookup(ssjndi);
             shell = (ShellImpl) ssh.startSession(null, false);
 

Modified: projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/persist/JDBCIncrementalPKGenerator.java
===================================================================
--- projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/persist/JDBCIncrementalPKGenerator.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/persist/JDBCIncrementalPKGenerator.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -3,7 +3,7 @@
 import org.apache.log4j.Logger;
 
 import org.jboss.fresh.io.IOUtils;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 
 import javax.sql.DataSource;
 import java.io.FileInputStream;
@@ -193,7 +193,7 @@
 			}
 		} else {
 			if (dts == null) {
-				RegistryContext ctx = new RegistryContext();
+				InitialContext ctx = new InitialContext();
 				dts = (DataSource) ctx.lookup(ds);
 			}
 

Deleted: projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/JNDI2RegistryResolverFactory.java
===================================================================
--- projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/JNDI2RegistryResolverFactory.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/JNDI2RegistryResolverFactory.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,44 +0,0 @@
-package org.jboss.fresh.registry;
-
-import javax.naming.Name;
-import javax.naming.Context;
-import javax.naming.Reference;
-import java.util.Hashtable;
-
-/**
- * @author strukelj
- * @version $Revision$
- * @created 20.10.2005, 13:33:16
- * @date $Date$
- * @source $Source$
- * @modified $Author$
- */
-public class JNDI2RegistryResolverFactory implements javax.naming.spi.ObjectFactory {
-    public static final String VERSION = "$Header$";
-    //private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(JNDI2RegistryResolverFactory.class);
-
-
-    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
-        Object key = ((Reference) obj).get("nns").getContent();
-        return new RegistryContext().lookup((String) key);
-    }
-
-/*
-	public static void put(Object key, Object val) {
-		//map.put(key, val);
-	}
-
-	public static Object get(Object key) {
-		//return map.get(key);
-	}
-
-	public static Object remove(Object key) {
-		//return map.remove(key);
-	}
-
-	public static Map getMap() {
-		//return map;
-	}
-*/
-
-}

Deleted: projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/RegistryContext.java
===================================================================
--- projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/RegistryContext.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/RegistryContext.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,348 +0,0 @@
-package org.jboss.fresh.registry;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import java.util.Hashtable;
-
-
-/**
- *  The whole point of this class is to have a usage similar to jndi InitialContext where you just create a new instance
- *  possibly passing it info on where and how to connect and then use it. So it's pluggable and allows different implementations
- *  underneath.
- *
- *  At the same time you can go directly using it and bypass InitialContext initialization routine
- */
-public class RegistryContext implements Context {
-
-
-	private StaticRegistryContext reg;
-	
-	
-	public RegistryContext() throws NamingException {
-		this("<default>");
-	}
-	
-	public RegistryContext(String store) throws NamingException {
-		reg = new StaticRegistryContext(store);
-	}
-
-	// Default implementation for now is to use StaticRegistry
-	private StaticRegistryContext getImpl() {
-		return reg;
-	}
-
-
-	/**
-	 * Adds a new environment property to the environment of this context.
-	 */
- 	public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- 		Context ctx = getImpl();
- 		return ctx.addToEnvironment(propName, propVal);
- 	}
-
-	/** 	
-	 * Binds a name to an object.        
-	 */
-	public void bind(Name name, Object obj) throws NamingException {
-		Context ctx = getImpl();
-		ctx.bind(name, obj);
-	}
-
-	/** 	
-	 * Binds a name to an object.        
-	 */
-	public void bind(String name, Object obj) throws NamingException {
-		Context ctx = getImpl();
-		ctx.bind(name, obj);
-	}
-
-
-	public void bindWithParents(String name, Object obj) throws NamingException {
-		Context ctx = getImpl();
-		Name n = ctx.getNameParser("").parse(name);
-		while (n.size() > 1) {
-			String ctxName = n.get(0);
-			try {
-				ctx = (Context) ctx.lookup(ctxName);
-			} catch (NameNotFoundException e) {
-				ctx = ctx.createSubcontext(ctxName);
-			}
-			n = n.getSuffix(1);
-		}
-
-		ctx.bind(n.get(0), obj);
-	}
-	
-
-	public void bindWithParents(Name name, Object obj) throws NamingException {
-		Context ctx = getImpl();
-		Name n = name;
-		while (n.size() > 1) {
-			String ctxName = n.get(0);
-			try {
-				ctx = (Context) ctx.lookup(ctxName);
-			} catch (NameNotFoundException e) {
-				ctx = ctx.createSubcontext(ctxName);
-			}
-			n = n.getSuffix(1);
-		}
-
-		ctx.bind(n.get(0), obj);
-	}
-
-	/** 	
-	 * Closes this context.
-	 */
-	public void close() throws NamingException {
-		Context ctx = getImpl();
-		ctx.close();
-	}
-
-	/** 	
-	 * Composes the name of this context with a name relative to this context.
-	 */
- 	public Name composeName(Name name, Name prefix) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.composeName(name, prefix);
- 	}
-
-
-	/** 	
-	 * Composes the name of this context with a name relative to this context.
-	 */
-	public String composeName(String name, String prefix) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.composeName(name, prefix);
-	}
-
-	/** 	
-         * Creates and binds a new context.
-         */ 	
-	public Context createSubcontext(Name name) throws NamingException {
-		return createSubcontext(name, false);
-	}
-
-	/** 	
-    * Creates and binds a new context.
-    */ 	
-	public Context createSubcontext(Name name, boolean mkparents) throws NamingException {
-		StaticRegistryContext ctx = getImpl();
-		return ctx.createSubcontext(name, mkparents);
-	}
-
-	/** 	
-         * Creates and binds a new context.
-         */ 	
-	public Context createSubcontext(String name) throws NamingException {
-		return createSubcontext(name, false);
-	}
-
-	/** 	
-    * Creates and binds a new context.
-    */ 	
-	public Context createSubcontext(String name, boolean mkparents) throws NamingException {
-		StaticRegistryContext ctx = getImpl();
-		return ctx.createSubcontext(name, mkparents);
-	}
-
-	/** 	
-         * Destroys the named context and removes it from the namespace.
-         */ 	
-	public void destroySubcontext(Name name) throws NamingException {
-		Context ctx = getImpl();
-		ctx.destroySubcontext(name);
-	}
-          
- 
-	/** 	
-         * Destroys the named context and removes it from the namespace.
-         */ 	
- 	public void destroySubcontext(String name) throws NamingException {
-		Context ctx = getImpl();
-		ctx.destroySubcontext(name);
-	}
-          
- 
-	/** 	
-         * Retrieves the environment in effect for this context.
-         */ 	
- 	public Hashtable getEnvironment() throws NamingException {
-		Context ctx = getImpl();
-		return ctx.getEnvironment();
-	}
-          
- 
-	/** 	
-         * Retrieves the full name of this context within its own namespace.
-         */ 	
- 	public String getNameInNamespace() throws NamingException {
-		Context ctx = getImpl();
-		return ctx.getNameInNamespace();
-	}
-          
-
-	/** 	
-         * Retrieves the parser associated with the named context.
-         */ 	
-	public NameParser getNameParser(Name name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.getNameParser(name);
-	}
-
-
-	/** 	
-         * Retrieves the parser associated with the named context.
-         */ 	
-	public NameParser getNameParser(String name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.getNameParser(name);
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the class names of objects bound to them.
-         */ 	
-	public NamingEnumeration list(Name name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.list(name);
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the class names of objects bound to them.
-         */ 	
-	public NamingEnumeration list(String name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.list(name);
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the objects bound to them.
-         */ 	
-	public NamingEnumeration listBindings(Name name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.listBindings(name);
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the objects bound to them.
-         */ 	
-	public NamingEnumeration listBindings(String name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.listBindings(name);
-	}
-
-
-	/** 	
-         * Retrieves the named object.
-         */ 	
-	public Object lookup(Name name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.lookup(name);
-	}
-
-
-	/** 	
-         * Retrieves the named object.
-         */ 	
-	public Object lookup(String name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.lookup(name);
-	}
-
-          
-
-	/** 	
-         * Retrieves the named object, following links except for the terminal atomic component of the name.
-         */ 	
-	public Object lookupLink(Name name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.lookupLink(name);
-	}
-	
-          
-
-	/** 	
-         * Retrieves the named object, following links except for the terminal atomic component of the name.
-         */ 	
-	public Object lookupLink(String name) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.lookupLink(name);	}
-          
- 
-	/** 	
-         * Binds a name to an object, overwriting any existing binding.
-         */ 	
-	public void rebind(Name name, Object obj) throws NamingException {
-		Context ctx = getImpl();
-		ctx.rebind(name, obj);
-	}
-          
-
-	/** 	
-         * Binds a name to an object, overwriting any existing binding.
-         */ 	
-	public void rebind(String name, Object obj) throws NamingException {
-		Context ctx = getImpl();
-		ctx.rebind(name, obj);
-	}
-          
-
-	/** 	
-         * Removes an environment property from the environment of this context.
-         */ 	
-	public Object removeFromEnvironment(String propName) throws NamingException {
-		Context ctx = getImpl();
-		return ctx.removeFromEnvironment(propName);
-	}
-          
-
-	/** 	
-         * Binds a new name to the object bound to an old name, and unbinds the old name.
-         */ 	
-	public void rename(Name oldName, Name newName) throws NamingException {
-		Context ctx = getImpl();
-		ctx.rename(oldName, newName);
-	}
-          
-
-	/** 	
-         * Binds a new name to the object bound to an old name, and unbinds the old name.
-         */ 	
-	public void rename(String oldName, String newName) throws NamingException {
-		Context ctx = getImpl();
-		ctx.rename(oldName, newName);
-	}
-          
-
-	/** 	
-         * Unbinds the named object.
-         */ 	
-	public void unbind(Name name) throws NamingException {
-		Context ctx = getImpl();
-		ctx.unbind(name);
-	}
-          
-
-	/** 	
-         * Unbinds the named object.
-         */ 	
-	public void unbind(String name) throws NamingException {
-		Context ctx = getImpl();
-		ctx.unbind(name);
-	}
-
-    /**
-     *  You can use the returned object to synchronize on the specific context tree
-     *  @return
-     */
-    public Object getMutex() {
-        return reg.getMutex();
-    }
-}
\ No newline at end of file

Deleted: projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryContext.java
===================================================================
--- projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryContext.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryContext.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,394 +0,0 @@
-package org.jboss.fresh.registry;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.CompositeName;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NameNotFoundException;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.LinkedList;
-
-
-public class StaticRegistryContext implements Context {
-	private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(StaticRegistryContext.class);
-	private StaticRegistryStore regStore;
-	private Hashtable env = new Hashtable();
-	private CompositeName name;
-	private String root;
-
-	public StaticRegistryContext(String root) throws NamingException {
-		this.root = root;
-		regStore = StaticRegistryStore.getStore(root);
-		name = new CompositeName("");
-	}
-
-	public StaticRegistryContext(String root, CompositeName nm) {
-		this.root = root;
-		regStore = StaticRegistryStore.getStore(root);
-		name = nm;
-	}
-
-	public StaticRegistryContext(String root, Name nm) throws NamingException {
-		this.root = root;
-		regStore = StaticRegistryStore.getStore(root);
-		name = new CompositeName();
-
-		Enumeration enom = nm.getAll();
-		while(enom.hasMoreElements()) {
-			name.add((String)enom.nextElement());
-		}
-	}
-
-	private void getRegistryStore() {
-		if(regStore!=null) return;
-		regStore = StaticRegistryStore.getStore(root);
-	}
-
-	private synchronized void ensureStore() {
-		if(regStore!=null) return;
-		regStore = StaticRegistryStore.createStore(root);
-	}
-	
-	/**
-	 * Adds a new environment property to the environment of this context.
-	 */
- 	public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- 		
- 		return env.put(propName, propVal);
- 	}
-
-	/** 	
-	 * Binds a name to an object.        
-	 */
-	public void bind(Name name, Object obj) throws NamingException {
-		final String oldName = name==null ? "<null>" : name.toString();
-
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-		log.debug("bind(): Name revamped: " + oldName + " -> " + name);
-		ensureStore();
-		regStore.bind(name, obj);
-	}
-
-	/** 	
-	 * Binds a name to an object.        
-	 */
-	public void bind(String name, Object obj) throws NamingException {
-		bind(new CompositeName(name), obj);
-	}
-
-
-	/** 	
-	 * Closes this context.
-	 */
-	public void close() throws NamingException {
-		
-	}
-
-
-	private Name normalize(Name name) {
-		if(name.size() > 0) {
-			Name nm = name.getPrefix(1);
-			if(nm.size() == 0)
-				name = name.getSuffix(1);
-		}
-	
-		return name;
-	}
-	
-	
-	/** 	
-	 * Composes the name of this context with a name relative to this context.
-	 */
- 	public Name composeName(Name name, Name prefix) throws NamingException {
-		CompositeName retName = new CompositeName();
-		retName.addAll(prefix);
-		retName.addAll(name);
-		return retName;
-		
- 	}
-
-
-	/** 	
-	 * Composes the name of this context with a name relative to this context.
-	 */
-	public String composeName(String name, String prefix) throws NamingException {
-		
-		if(name.startsWith("/")) name = name.substring(1);
-		if(prefix.endsWith("/")) prefix = prefix.substring(0, prefix.length()-1);
-		
-		CompositeName retName = new CompositeName(prefix + "/" + name);
-		return retName.toString();
-	}
-
-
-	/** 	
-    * Creates and binds a new context.
-    */ 	
-	public Context createSubcontext(Name name) throws NamingException {
-		return createSubcontext(name, false);
-	}
-
-	/** 	
-         * Creates and binds a new context.
-         */ 	
-	public Context createSubcontext(Name name, boolean mkparents) throws NamingException {
-		final String oldName = name == null ? "<null>" : name.toString();	
-	
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-		log.debug("createSubcontext(): Name recomposed: " + oldName + " -> " + name);
-		
-		ensureStore();
-		return regStore.createSubcontext(name, mkparents);
-	}
-
-	/** 	
-         * Creates and binds a new context.
-         */ 	
-	public Context createSubcontext(String name) throws NamingException {		
-		return createSubcontext(new CompositeName(name), false);
-	}
-
-	/** 	
-    * Creates and binds a new context.
-    */ 	
-	public Context createSubcontext(String name, boolean mkparents) throws NamingException {		
-		return createSubcontext(new CompositeName(name), mkparents);
-	}
-
-
-	/** 	
-         * Destroys the named context and removes it from the namespace.
-         */ 	
-	public void destroySubcontext(Name name) throws NamingException {
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-
-		getRegistryStore();
-		if(regStore!=null) regStore.destroySubcontext(name);
-	}
-          
- 
-	/** 	
-         * Destroys the named context and removes it from the namespace.
-         */ 	
- 	public void destroySubcontext(String name) throws NamingException {
-		destroySubcontext(new CompositeName(name));
-	}
-          
- 
-	/** 	
-         * Retrieves the environment in effect for this context.
-         */ 	
- 	public Hashtable getEnvironment() throws NamingException {
-		
-		return env;
-	}
-          
- 
-	/** 	
-         * Retrieves the full name of this context within its own namespace.
-         */ 	
- 	public String getNameInNamespace() throws NamingException {
-		
-		return String.valueOf(name);
-	}
-          
-
-	/** 	
-         * Retrieves the parser associated with the named context.
-         */ 	
-	public NameParser getNameParser(Name name) throws NamingException {
-		
-		return StaticRegistryStore.getNameParser();
-	}
-
-
-	/** 	
-         * Retrieves the parser associated with the named context.
-         */ 	
-	public NameParser getNameParser(String name) throws NamingException {
-		
-		return StaticRegistryStore.getNameParser();
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the class names of objects bound to them.
-         */ 	
-	public NamingEnumeration list(Name name) throws NamingException {
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-		getRegistryStore();
-		if(regStore!=null)
-			return regStore.list(name);
-		else
-			return new StaticRegistryStore.ListNameEnum(new LinkedList());
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the class names of objects bound to them.
-         */ 	
-	public NamingEnumeration list(String name) throws NamingException {
-		
-		return list(new CompositeName(name));
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the objects bound to them.
-         */ 	
-	public NamingEnumeration listBindings(Name name) throws NamingException {
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-		getRegistryStore();
-		if(regStore!=null)
-			return regStore.listBindings(name);
-		else
-			return new StaticRegistryStore.ListNameEnum(new LinkedList());
-	}
-
-
-	/** 	
-         * Enumerates the names bound in the named context, along with the objects bound to them.
-         */ 	
-	public NamingEnumeration listBindings(String name) throws NamingException {		
-		return listBindings(new CompositeName(name));
-	}
-
-
-	/** 	
-         * Retrieves the named object.
-         */ 	
-	public Object lookup(Name name) throws NamingException {
-
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-		getRegistryStore();
-		if(regStore == null) {
-			String strn = String.valueOf(name);
-			if("".equals(strn) || "/".equals(strn)) {
-				return this;
-			}
-			throw new NameNotFoundException("Name not found: " + name + " (Store does not exist: " + root + ")");
-		}
-		return regStore.lookup(name);
-	}
-
-
-	/** 	
-         * Retrieves the named object.
-         */ 	
-	public Object lookup(String name) throws NamingException {
-
-		return lookup(new CompositeName(name));
-	}
-
-
-
-	/** 	
-         * Retrieves the named object, following links except for the terminal atomic component of the name.
-         */ 	
-	public Object lookupLink(Name name) throws NamingException {
-		
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-		getRegistryStore();
-		if(regStore == null) throw new NameNotFoundException("Name not found: " + name + " (Store does not exist: " + root + ")");
-		return regStore.lookupLink(name);
-	}
-	
-          
-
-	/** 	
-         * Retrieves the named object, following links except for the terminal atomic component of the name.
-         */ 	
-	public Object lookupLink(String name) throws NamingException {
-		
-		return lookupLink(new CompositeName(name));
-	}
-          
- 
-	/** 	
-         * Binds a name to an object, overwriting any existing binding.
-         */ 	
-	public void rebind(Name name, Object obj) throws NamingException {
-		// Always prefix it - you don't want a user to escape the cage
-		name = composeName(name, this.name);
-		ensureStore();
-		regStore.rebind(name, obj);
-	}
-          
-
-	/** 	
-         * Binds a name to an object, overwriting any existing binding.
-         */ 	
-	public void rebind(String name, Object obj) throws NamingException {
-		rebind(new CompositeName(name), obj);
-	}
-          
-
-	/** 	
-         * Removes an environment property from the environment of this context.
-         */ 	
-	public Object removeFromEnvironment(String propName) throws NamingException {
-		
-		return env.remove(propName);
-	}
-          
-
-	/** 	
-         * Binds a new name to the object bound to an old name, and unbinds the old name.
-         */ 	
-	public void rename(Name oldName, Name newName) throws NamingException {
-		// Always prefix it - you don't want a user to escape the cage
-		oldName = composeName(oldName, this.name);
-		newName = composeName(newName, this.name);
-
-		ensureStore();
-		regStore.rename(oldName, newName);
-	}
-          
-
-	/** 	
-         * Binds a new name to the object bound to an old name, and unbinds the old name.
-         */ 	
-	public void rename(String oldName, String newName) throws NamingException {
-		rename(new CompositeName(oldName), new CompositeName(newName));
-	}
-
-
-	/** 	
-         * Unbinds the named object.
-         */ 	
-	public void unbind(Name name) throws NamingException {
-		// Always prefix it - you don't want a user to escape the cage
-		getRegistryStore();
-		if(regStore == null) return;
-		name = composeName(name, this.name);
-		regStore.unbind(name);
-	}
-
-
-	/** 	
-         * Unbinds the named object.
-         */ 	
-	public void unbind(String name) throws NamingException {
-		unbind(new CompositeName(name));
-	}
-
-
-	public String toString() {
-		return super.toString() + ": " + String.valueOf(name);
-	}
-
-    public Object getMutex() {
-        ensureStore();
-        return regStore.getMutex();
-    }
-}
\ No newline at end of file

Deleted: projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryStore.java
===================================================================
--- projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryStore.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/registry/StaticRegistryStore.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,505 +0,0 @@
-package org.jboss.fresh.registry;
-
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.CompositeName;
-import javax.naming.NameClassPair;
-import javax.naming.Binding;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameAlreadyBoundException;
-import javax.naming.NotContextException;
-import javax.naming.ContextNotEmptyException;
-
-import java.util.HashMap;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.LinkedHashMap;
-
-public class StaticRegistryStore {
-
-	static HashMap stores = new HashMap();
-	static NameParser parser = new RegistryNameParser();
-	SubCtx root;
-	String sname;
-    Object mutex = new Object();
-
-	static private final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(StaticRegistryStore.class);
-
-	public static StaticRegistryStore getStore(String root) {
-		return (StaticRegistryStore) stores.get(root);
-	}
-
-	private static Name normalize(Name name) {
-		if(name.size() > 0) {
-			Name nm = name.getPrefix(1);
-			if(nm.get(0).length() == 0)
-				name = name.getSuffix(1);
-		}
-	
-		return name;
-	}
-	
-	public static synchronized StaticRegistryStore createStore(String root) {
-
-		StaticRegistryStore stor = (StaticRegistryStore) stores.get(root); 
-		if(stor != null) return stor;
-
-		stor = new StaticRegistryStore(root); 
-		stores.put(root, stor);
-		return stor;
-	}
-
-	public StaticRegistryStore(String name) {
-		this.sname = name;
-		root = new SubCtx(sname);
-	}
-	
-	private BindData getRootData() {
-		return new BindData(new CompositeName(), root.getClass().getName(), root);
-	}
-
-	private BindData getBindData(Name name) throws NameNotFoundException {
-log.debug("getBind name: " + name);
-		name = normalize(name);
-		int size = name.size();
-
-		if(size == 0) return getRootData();
-
-		SubCtx ctx = root;
-		BindData dat = null;
-
-		Enumeration enom = name.getAll();
-		for(int i = 0; enom.hasMoreElements(); i++) {
-			String str = (String) enom.nextElement();
-log.debug("  getBind co_ " + str);
-			dat = (BindData) ctx.get(str);
-log.debug("  getBind ctx: " + ctx);
-			if(i<size-1) {
-				if(dat == null) throw new NameNotFoundException(String.valueOf(name) + " : " + String.valueOf(name.getPrefix(i+1)) + " is not a context.");
-				Object o = dat.getObject();
-				if(!(o instanceof SubCtx)) throw new NameNotFoundException(String.valueOf(name) + " : " + String.valueOf(name.getPrefix(i+1)) + " is not a context.");
-				ctx = (SubCtx) o;
-			}
-		}
-
-		return dat;
-
-	}
-
-	private void bindData(BindData dat) {
-		Name name = dat.getName();
-
-log.debug("bindData name: " + name);
-log.debug("  bindData dat: " + dat);
-
-		int size = name.size();
-
-		SubCtx ctx = root;
-
-		Enumeration enom = name.getAll();
-		for(int i=0; i<size-1; i++) {
-			String str = (String) enom.nextElement();
-			ctx = (SubCtx) ((BindData)ctx.get(str)).getObject();
-		}
-
-		ctx.put(name.get(size-1), dat);
-	}
-
-
-	private void removeData(Name name) {
-		name = normalize(name);
-		int size = name.size();
-
-		SubCtx ctx = root;
-
-		Enumeration enom = name.getAll();
-		for(int i=0; i<size-1; i++) {
-			String str = (String) enom.nextElement();
-			ctx = (SubCtx) ((BindData)ctx.get(str)).getObject();
-		}
-
-		ctx.remove(name.get(size-1));
-	}
-	
-
-	/** 	
-	 * Binds a name to an object.        
-	 */
-	public synchronized void bind(Name name, Object obj) throws NamingException {
-		log.debug("bind :  " + name + " -> " + obj);
-
-		name = normalize(name);
-		// get data for name
-		BindData dat = getBindData(name);
-
-		if(dat != null) throw new NameAlreadyBoundException(String.valueOf(name));
-
-		Name name2 = name.getPrefix(name.size()-1);
-		log.debug("  bind check parent: " + name2);
-		//System.out.println("Checking if parent exists: " + name2);
-		dat = getBindData(name2);
-
-		if(dat == null) throw new NameNotFoundException("Parent context does not exist: " + String.valueOf(name2));
-
-		if(!(dat.getObject() instanceof SubCtx)) throw new NotContextException("Parent name is taken by object that is not context: " + String.valueOf(name2));
-
-		dat = new BindData(name, obj.getClass(), obj);
-		bindData(dat);
-	}
-
-
-
-	/** 	
-	 * Creates and binds a new context.
-	 */
-	public synchronized Context createSubcontext(Name name, boolean mkparents) throws NamingException {
-
-		if(mkparents) {
-       	int size = name.size()-1;
-			Enumeration enom = name.getAll();
-       	Context ct = new StaticRegistryContext(sname);
-       	for(int i=0; i<size && enom.hasMoreElements(); i++) {
-       		String nmpart = (String) enom.nextElement();
-       		try {
-       			ct = (Context) ct.lookup(nmpart);
-       		} catch(NameNotFoundException ex) {
-       			ct = ct.createSubcontext(nmpart);
-       		}
-       	}
-		}
-
-		// get data for name
-		log.debug("createSubcontext: " + name);
-		name = normalize(name);
-		BindData dat = getBindData(name);
-
-		if(dat != null) throw new NameAlreadyBoundException(String.valueOf(name));
-
-		Name name2 = name.getPrefix(name.size()-1);
-		//System.out.println("Checking if parent exists: " + name2);
-		dat = getBindData(name2);
-
-		if(dat == null) throw new NameNotFoundException("Parent context does not exist: " + String.valueOf(name2));
-
-		SubCtx sub = new SubCtx(sname);
-		dat = new BindData(name, sub.getClass(), sub);
-		bindData(dat);
-
-		return new StaticRegistryContext(sname, name);
-	}
-
-
-
-	/** 	
-	 * Destroys the named context and removes it from the namespace.
-	 */ 	
-	public synchronized void destroySubcontext(Name name) throws NamingException {
-		// get data for name
-		name = normalize(name);
-		BindData dat = getBindData(name);
-
-		if(dat == null) throw new NameNotFoundException(String.valueOf(name));
-
-		if(!(dat.getObject() instanceof SubCtx)) throw new NotContextException("Object is bound that is not context: " + String.valueOf(name));
-
-		SubCtx sub = (SubCtx) dat.getObject();
-
-		if(sub.size() != 0) throw new ContextNotEmptyException("Context is not empty: " + String.valueOf(name));
-
-		removeData(name);
-	}
-
-
-
-	/** 	
-	 * Retrieves the parser associated with the named context.
-	 */ 	
-	public static synchronized NameParser getNameParser() throws NamingException {
-		return parser;
-	}
-
-
-
-	/** 	
-	 * Enumerates the names bound in the named context, along with the class names of objects bound to them.
-	 */ 	
-	public synchronized NamingEnumeration list(Name name) throws NamingException {
-		// get data for name
-		name = normalize(name);
-		BindData dat = getBindData(name);
-
-		if(dat==null) throw new NameNotFoundException(String.valueOf(name));
-
-		if(dat.getObject() instanceof SubCtx) {
-			SubCtx ctx = (SubCtx) dat.getObject();
-
-			return new ListNameEnum(ctx.list());
-		} else {
-			throw new NotContextException(String.valueOf(name));
-		}
-
-	}
-
-
-
-	/** 	
-	 * Enumerates the names bound in the named context, along with the objects bound to them.
-	 */ 	
-	public synchronized NamingEnumeration listBindings(Name name) throws NamingException {
-		// get data for name
-		name = normalize(name);
-		BindData dat = getBindData(name);
-
-		if(dat==null) throw new NameNotFoundException(String.valueOf(name));
-
-		if(dat.getObject() instanceof SubCtx) {
-			SubCtx ctx = (SubCtx) dat.getObject();
-
-			return new ListNameEnum(ctx.listBindings());
-		} else {
-			throw new NotContextException(String.valueOf(name));
-		}
-
-	}
-
-
-	/** 	
-	 * Retrieves the named object.
-	 */ 	
-	public synchronized Object lookup(Name name) throws NamingException {
-		name = normalize(name);
-		BindData dat = getBindData(name);
-
-		if(dat==null) throw new NameNotFoundException(String.valueOf(name));
-
-		if(dat.getObject() instanceof SubCtx) {
-			return new StaticRegistryContext(sname, name);
-		} else {
-			return dat.getObject();
-		}
-	}
-
-
-
-	/**
-	 * Retrieves the named object, following links except for the terminal atomic component of the name.
-	 */ 	
-	public synchronized Object lookupLink(Name name) throws NamingException {
-		// we don't have links - I think
-		name = normalize(name);
-		return lookup(name);
-	}
-
-
-
-	/** 	
-	 * Binds a name to an object, overwriting any existing binding.
-	 */ 	
-	public synchronized void rebind(Name name, Object obj) throws NamingException {
-		name = normalize(name);
-		unbind(name);
-		bind(name, obj);
-	}
-
-
-
-	/** 	
-	 * Binds a new name to the object bound to an old name, and unbinds the old name.
-	 */ 	
-	public synchronized void rename(Name oldName, Name newName) throws NamingException {
-		// get data for name
-		oldName = normalize(oldName);
-		newName = normalize(newName);
-		BindData dat = getBindData(oldName);
-
-		if(dat==null) throw new NameNotFoundException(String.valueOf(oldName));
-
-		unbind(oldName);
-		bind(newName, dat.getObject());
-	}
-
-
-
-	/** 	
-	 * Unbinds the named object.
-	 */ 	
-	public synchronized void unbind(Name name) throws NamingException {
-
-		// get data for name
-		name = normalize(name);
-		Name name2 = name.getPrefix(name.size()-1);
-		BindData dat = getBindData(name2);
-
-		if(dat==null) throw new NameNotFoundException(String.valueOf(name2));
-
-		dat = getBindData(name);
-		if(dat==null) return;
-
-		if(dat.getObject() instanceof SubCtx) {
-			throw new NamingException("Name is a context. To remove context use destroyContext() : " + String.valueOf(name));
-		}
-
-		removeData(name);
-	}
-
-    public Object getMutex() {
-        return mutex;
-    }
-
-	static class BindData {
-
-		Name name;
-		String className;
-		Object obj;
-	
-		BindData(Name name, Class clazz, Object obj) {
-			this(name, clazz.getName(), obj);
-		}
-
-		BindData(Name name, String clazz, Object obj) {
-			this.name = name;
-			this.className = clazz;
-			this.obj = obj;
-		}
-		
-		Name getName() {
-			return name;
-		}
-		
-		String getObjectClassName() {
-			return className;
-		}
-		
-		Object getObject() {
-			return obj;
-		}
-
-	}
-
-
-	static class SubCtx {
-
-		String sname;
-		LinkedHashMap map = new LinkedHashMap();
-
-		SubCtx(String sname) {
-			this.sname = sname;
-		}
-		public int size() {
-			return map.size();
-		}
-
-		public List list() {
-			LinkedList ls = new LinkedList();
-
-			// fill a list with NameClassPair
-			Iterator it = map.entrySet().iterator();
-			while(it.hasNext()) {
-				Map.Entry ent = (Map.Entry) it.next();
-				String nm = (String) ent.getKey();
-				BindData dat = (BindData) ent.getValue();
-
-				NameClassPair b;
-				
-				if(dat.getObject() instanceof SubCtx) {
-					b = new NameClassPair(nm, org.jboss.fresh.registry.StaticRegistryContext.class.getName(), true);
-				} else {
-					b = new NameClassPair(nm, dat.getObjectClassName(), true);
-				}
-				
-				ls.add(b);
-			}
-
-			return ls;
-		}
-
-		public List listBindings() throws NamingException {
-
-			LinkedList ls = new LinkedList();
-
-			// fill a list with Bindings
-			Iterator it = map.entrySet().iterator();
-			while(it.hasNext()) {
-				Map.Entry ent = (Map.Entry) it.next();
-				String nm = (String) ent.getKey();
-				BindData dat = (BindData) ent.getValue();
-
-				Binding b;
-				if(dat.getObject() instanceof SubCtx) {
-					b = new Binding(nm, org.jboss.fresh.registry.StaticRegistryContext.class.getName(), new StaticRegistryContext(sname, dat.getName()), true);
-				} else {
-					b = new Binding(nm, dat.getObjectClassName(), dat.getObject(), true);
-				}
-				
-				ls.add(b);
-			}
-
-			return ls;
-		}
-
-		
-		public Object get(String name) {
-			return map.get(name);
-		}
-		
-		public Object put(String name, Object val) {
-			return map.put(name, val);
-		}
-
-		public Object remove(String name) {
-			return map.remove(name);
-		}
-
-		LinkedHashMap getMap() {
-			return map;
-		}
-
-		public String toString() {
-			return super.toString() + ": " + map;
-		}
-	}
-
-
-	static class ListNameEnum implements NamingEnumeration {
-	
-		Iterator it;
-		
-		ListNameEnum(List ls) {
-			it = ls.iterator();
-		}
-		
-		public void close() {
-		}
-
-		public boolean hasMore() {
-			return it.hasNext();
-		}
-
-		public Object next() {
-			return it.next();
-		}
-
-		public boolean hasMoreElements() {
-			return it.hasNext();
-		}
-
-		public Object nextElement() {
-			return next();
-		}
-	}
-	
-	
-	static class RegistryNameParser implements NameParser {
-		
-		public Name parse(String name) throws NamingException {
-			return new CompositeName(name);
-		}
-	
-	}
-}
\ No newline at end of file

Modified: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/VFSInputStream.java
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/VFSInputStream.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/VFSInputStream.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -5,7 +5,7 @@
 import org.jboss.fresh.vfs.FileOpInfo;
 import org.jboss.fresh.vfs.FileReadInfo;
 import org.jboss.fresh.vfs.VFSFileHandlerFactory;
-import org.jboss.fresh.registry.RegistryContext;
+import javax.naming.InitialContext;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -36,7 +36,7 @@
         String device = (String) info.getAttributes().get("file-handler");
         if(device != null) {
         	try {
-	        	RegistryContext ctx = new RegistryContext();
+	        	InitialContext ctx = new InitialContext();
 	        	VFSFileHandlerFactory f = (VFSFileHandlerFactory) ctx.lookup(device);
 	        	delegate = f.getInputStream(info);
         	} catch(IOException ex) {

Modified: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSMeta.java
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSMeta.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSMeta.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,21 +1,9 @@
 package org.jboss.fresh.vfs.impl.mem;
 
-import org.jboss.fresh.vfs.FileInfo;
-import org.jboss.fresh.vfs.FileName;
-import org.jboss.fresh.vfs.VFSException;
-import org.jboss.fresh.vfs.VFSMeta;
-import org.jboss.fresh.vfs.VFSMetaCacheUpdater;
-import org.jboss.fresh.registry.RegistryContext;
-
 import org.apache.log4j.Logger;
+import org.jboss.fresh.vfs.*;
 
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NotContextException;
-
+import javax.naming.*;
 import java.util.Collection;
 import java.util.Date;
 import java.util.LinkedList;
@@ -23,432 +11,437 @@
 
 public class MemVFSMeta implements VFSMeta {
 
-	private static final String INTERNAL_FILE = "==__node__";
-	private String sfJndiName;
-	private VFSMetaCacheUpdater cup;
-	RegistryContext fsroot;
+    private static final String INTERNAL_FILE = "==__node__";
+    private String sfJndiName;
+    private VFSMetaCacheUpdater cup;
+    InitialContext fsroot;
 
-	private static Logger log = Logger.getLogger(MemVFSMeta.class);
+    private static Logger log = Logger.getLogger(MemVFSMeta.class);
 
-	public MemVFSMeta(String sfJndiName, String fsname) throws Exception {
-		this.sfJndiName = sfJndiName;
-		fsroot = new RegistryContext(fsname);
+    public MemVFSMeta(String sfJndiName, String fsname) throws Exception {
+        this.sfJndiName = sfJndiName;
+        fsroot = (InitialContext) new InitialContext().lookup(fsname);
 
-		FileInfo inf = new FileInfo(new FileName("/"));
-		inf.setCreateDate(new Date());
-		inf.setFileType(FileInfo.TYPE_DIR);
-		inf.setLastModified(inf.getCreateDate());
-		inf.setLength(0);
+        FileInfo inf = new FileInfo(new FileName("/"));
+        inf.setCreateDate(new Date());
+        inf.setFileType(FileInfo.TYPE_DIR);
+        inf.setLastModified(inf.getCreateDate());
+        inf.setLength(0);
 
-		Context rootCtx = (Context) fsroot.lookup("/");
-		try {
-			rootCtx.lookup(INTERNAL_FILE);
-		} catch(NameNotFoundException ex) {
-			rootCtx.bind(INTERNAL_FILE, fileInfoToFNode(inf));
-		}
-	}
+        Context rootCtx = (Context) fsroot.lookup("/");
+        try {
+            rootCtx.lookup(INTERNAL_FILE);
+        } catch (NameNotFoundException ex) {
+            rootCtx.bind(INTERNAL_FILE, fileInfoToFNode(inf));
+        }
+    }
 
 
-	//***** VFSMeta METHODS *****
+    //***** VFSMeta METHODS *****
 
-	public void setCacheUpdater(VFSMetaCacheUpdater updater) {
-		cup = updater;
-	}
+    public void setCacheUpdater(VFSMetaCacheUpdater updater) {
+        cup = updater;
+    }
 
-	public VFSMetaCacheUpdater getCacheUpdater() {
-		return cup;
-	}
+    public VFSMetaCacheUpdater getCacheUpdater() {
+        return cup;
+    }
 
-	public Object getResolvedNode(String name) throws VFSException, NamingException {
-		Object node = null;
+    public Object getResolvedNode(String name) throws VFSException, NamingException {
+        Object node = null;
 
-		if("/".equals(name)) {
-			name = "";
-		}
-		
-		for(int i=0; i<256; i++) {
-			try {
-				node = fsroot.lookup(name);
-			} catch(NameNotFoundException ex) {
-			}
+        if ("/".equals(name)) {
+            name = "";
+        }
 
-			if(node instanceof FNode) {
-				FNode fnode = (FNode) node;
-				if(fnode.getType() == FNode.LINK) {
-					name = fnode.getLinkRef();
-				} else {
-					return node;
-				}
-			} else {
-				return node;
-			}
-		}
+        for (int i = 0; i < 256; i++) {
+            try {
+                node = fsroot.lookup(name);
+            } catch (NameNotFoundException ex) {
+            }
 
-		throw new VFSException("Link resolution infinitely looped: " + name);
-	}
+            if (node instanceof FNode) {
+                FNode fnode = (FNode) node;
+                if (fnode.getType() == FNode.LINK) {
+                    name = fnode.getLinkRef();
+                } else {
+                    return node;
+                }
+            } else {
+                return node;
+            }
+        }
 
-	private FNode fileInfoToFNode(FileInfo finfo) {
-		FNode node = new FNode();
-		node.setName(finfo.getFileName().toString());
-		node.setAttrs(finfo.getAttributes());
-		node.setCreateDate( finfo.getCreateDate());
-		node.setLastModified( finfo.getLastModified());
-		node.setType(finfo.getFileType() == FileInfo.TYPE_FILE ? FNode.FILE : finfo.getFileType() == FileInfo.TYPE_DIR ? FNode.DIR : FNode.LINK);
-		node.setMime(finfo.getMime());
-		node.setFileContent(new MemFile());
-		node.setLength(finfo.getLength());
-		node.setTag(finfo.getTag());
-		return node;
-	}
+        throw new VFSException("Link resolution infinitely looped: " + name);
+    }
 
-	private FileInfo fnodeToFileInfo(FileName name, FNode node) throws VFSException {
-		FileInfo inf = new FileInfo(name);
-		inf.setAttributes(node.getAttrs());
-		inf.setCreateDate(node.getCreateDate());
-		inf.setFileType(node.getType() == FNode.FILE ? FileInfo.TYPE_FILE : node.getType() == FNode.DIR ? FileInfo.TYPE_DIR : FileInfo.TYPE_LINK);
-		inf.setLastModified(node.getLastModified());
-		inf.setLength(node.getLength());
-		inf.setMime(node.getMime());
-		inf.setTag(node.getTag());
-		if(node.getLink() != null) {
-			inf.setTarget(new FileName(node.getLink()));
-		}
-		return inf;
-	}
+    private FNode fileInfoToFNode(FileInfo finfo) {
+        FNode node = new FNode();
+        node.setName(finfo.getFileName().toString());
+        node.setAttrs(finfo.getAttributes());
+        node.setCreateDate(finfo.getCreateDate());
+        node.setLastModified(finfo.getLastModified());
+        node.setType(finfo.getFileType() == FileInfo.TYPE_FILE ? FNode.FILE : finfo.getFileType() == FileInfo.TYPE_DIR ? FNode.DIR : FNode.LINK);
+        node.setMime(finfo.getMime());
+        node.setFileContent(new MemFile());
+        node.setLength(finfo.getLength());
+        node.setTag(finfo.getTag());
+        return node;
+    }
 
-	private void updateFNodeWithFileInfo(FNode node, FileInfo finfo) {
-		node.setAttrs(finfo.getAttributes());
-		node.setCreateDate( finfo.getCreateDate());
-		node.setLastModified( finfo.getLastModified());
-		node.setType(finfo.getFileType() == FileInfo.TYPE_FILE ? FNode.FILE : finfo.getFileType() == FileInfo.TYPE_DIR ? FNode.DIR : FNode.LINK);
-		node.setMime(finfo.getMime());
-		node.setLength(finfo.getLength());
-		node.setTag(finfo.getTag());
-	}
+    private FileInfo fnodeToFileInfo(FileName name, FNode node) throws VFSException {
+        FileInfo inf = new FileInfo(name);
+        inf.setAttributes(node.getAttrs());
+        inf.setCreateDate(node.getCreateDate());
+        inf.setFileType(node.getType() == FNode.FILE ? FileInfo.TYPE_FILE : node.getType() == FNode.DIR ? FileInfo.TYPE_DIR : FileInfo.TYPE_LINK);
+        inf.setLastModified(node.getLastModified());
+        inf.setLength(node.getLength());
+        inf.setMime(node.getMime());
+        inf.setTag(node.getTag());
+        if (node.getLink() != null) {
+            inf.setTarget(new FileName(node.getLink()));
+        }
+        return inf;
+    }
 
-	private FileInfo childToFileInfo(FileName name, Object child) throws VFSException, NamingException {
-		if(child instanceof FNode) {
-			return fnodeToFileInfo(name, (FNode)child);
-		} else if(child instanceof Context) {
-			Context ctx = (Context) child;
-			try {
-				FNode node = (FNode) ctx.lookup(INTERNAL_FILE);
-				return fnodeToFileInfo(name, node);
-			} catch(NameNotFoundException ex) {
-				throw new RuntimeException("Internal error - missing child node: " + INTERNAL_FILE + "  (for key: " + name + ")");				
-			}
-		} else {
-			throw new RuntimeException("Internal error: child of illegal type: " + child.getClass().getName());
-		}
-	}
+    private void updateFNodeWithFileInfo(FNode node, FileInfo finfo) {
+        node.setAttrs(finfo.getAttributes());
+        node.setCreateDate(finfo.getCreateDate());
+        node.setLastModified(finfo.getLastModified());
+        node.setType(finfo.getFileType() == FileInfo.TYPE_FILE ? FNode.FILE : finfo.getFileType() == FileInfo.TYPE_DIR ? FNode.DIR : FNode.LINK);
+        node.setMime(finfo.getMime());
+        node.setLength(finfo.getLength());
+        node.setTag(finfo.getTag());
+    }
 
-	/** Name must be valid FileName object.
-	 */
-	public boolean exists(FileName name) throws Exception {
+    private FileInfo childToFileInfo(FileName name, Object child) throws VFSException, NamingException {
+        if (child instanceof FNode) {
+            return fnodeToFileInfo(name, (FNode) child);
+        } else if (child instanceof Context) {
+            Context ctx = (Context) child;
+            try {
+                FNode node = (FNode) ctx.lookup(INTERNAL_FILE);
+                return fnodeToFileInfo(name, node);
+            } catch (NameNotFoundException ex) {
+                throw new RuntimeException("Internal error - missing child node: " + INTERNAL_FILE + "  (for key: " + name + ")");
+            }
+        } else {
+            throw new RuntimeException("Internal error: child of illegal type: " + child.getClass().getName());
+        }
+    }
 
-		// Convert to CompositeName 
-		// lookup RegistryContext
-		// if NameNotFoundException it doesn't exist
-		
-		Object node = null;
+    /**
+     * Name must be valid FileName object.
+     */
+    public boolean exists(FileName name) throws Exception {
 
-		try {
-			node = getResolvedNode(name.toString());
-		} catch(NameNotFoundException ex) {
-		}
+        // Convert to CompositeName
+        // lookup RegistryContext
+        // if NameNotFoundException it doesn't exist
 
-		if(node == null)
-			return false;
+        Object node = null;
 
-		return true;
-	}
+        try {
+            node = getResolvedNode(name.toString());
+        } catch (NameNotFoundException ex) {
+        }
 
+        if (node == null)
+            return false;
 
-	public int countNamingEnum(NamingEnumeration enom) throws NamingException {
-		int i = 0;
-		for(;enom.hasMore();i++) {
-			enom.next();
-		}
-		return i;
-	}
+        return true;
+    }
 
 
-	/** Path must be valid FileName object.
-	 */
-	public int countChildren(FileName path) throws Exception {
-		// Convert to CompositeName 
-		// get NameEnumeration
-		// return count
-		NamingEnumeration names = null;
-		Object node = null;
-		try {
-			node = getResolvedNode(path.toString());
-		} catch(NameNotFoundException ex) {}
+    public int countNamingEnum(NamingEnumeration enom) throws NamingException {
+        int i = 0;
+        for (; enom.hasMore(); i++) {
+            enom.next();
+        }
+        return i;
+    }
 
-		if(node == null) 
-			throw new VFSException("File not found: " + path);
 
-		if(!(node instanceof Context))
-			throw new VFSException("File is not a directory");
+    /**
+     * Path must be valid FileName object.
+     */
+    public int countChildren(FileName path) throws Exception {
+        // Convert to CompositeName
+        // get NameEnumeration
+        // return count
+        NamingEnumeration names = null;
+        Object node = null;
+        try {
+            node = getResolvedNode(path.toString());
+        } catch (NameNotFoundException ex) {
+        }
 
-		try {
-			names = ((Context) node).list("");
-		} catch(NotContextException ex) {
-			throw new VFSException("File is not a directory");
-		}
+        if (node == null)
+            throw new VFSException("File not found: " + path);
 
-		return countNamingEnum(names);
-	}
+        if (!(node instanceof Context))
+            throw new VFSException("File is not a directory");
 
+        try {
+            names = ((Context) node).list("");
+        } catch (NotContextException ex) {
+            throw new VFSException("File is not a directory");
+        }
 
-	/**	Path must point to existing file or dir and must not be null.
-	 */
-	public List resolvePath(FileName path) throws Exception {
-		// Convert to CompositeName 
-		// get FileInfo
-		// as long as fileinfo is link keep looking up reference to next fileinfo
-		// and adding FileInfo for every next component to return list.
-		
-		// if found broken link return whatever you have in list
-		// first item in a list is always passed path param
-		LinkedList ls = new LinkedList();
-		
-		if(path == null) {
-			ls.add(new FileName("/"));
-			return ls;
-		}
+        return countNamingEnum(names);
+    }
 
-		//ls.add(path);
 
-		Object node = null;
-		String name = path.toString();
+    /**
+     * Path must point to existing file or dir and must not be null.
+     */
+    public List resolvePath(FileName path) throws Exception {
+        // Convert to CompositeName
+        // get FileInfo
+        // as long as fileinfo is link keep looking up reference to next fileinfo
+        // and adding FileInfo for every next component to return list.
 
-		for(int i=0; i<256; i++) {
-			try {
-				node = fsroot.lookup(name);
-			} catch(NameNotFoundException ex) {
-				node = null;
-			}
+        // if found broken link return whatever you have in list
+        // first item in a list is always passed path param
+        LinkedList ls = new LinkedList();
 
-			if(node instanceof FNode) {
-				ls.add(new FileName(name));
-				FNode fnode = (FNode) node;
-				if(fnode.getType() == FNode.LINK) {
-					name = fnode.getLinkRef();
-				} else {
-					return ls;
-				}
-			} else {
-				ls.add(new FileName(name));
-				return ls;
-			}
-		}
+        if (path == null) {
+            ls.add(new FileName("/"));
+            return ls;
+        }
 
-		throw new VFSException("Link resolution infinitely looped: " + name);
+        //ls.add(path);
 
-	}
+        Object node = null;
+        String name = path.toString();
 
+        for (int i = 0; i < 256; i++) {
+            try {
+                node = fsroot.lookup(name);
+            } catch (NameNotFoundException ex) {
+                node = null;
+            }
 
-	public FileInfo getFileInfo(FileName name) throws Exception {
-		// Convert to CompositeName 
-		// get FileInfo
-		// return null if no info for name
+            if (node instanceof FNode) {
+                ls.add(new FileName(name));
+                FNode fnode = (FNode) node;
+                if (fnode.getType() == FNode.LINK) {
+                    name = fnode.getLinkRef();
+                } else {
+                    return ls;
+                }
+            } else {
+                ls.add(new FileName(name));
+                return ls;
+            }
+        }
 
-		Object node = getResolvedNode(name.toString());
-		
-		if(node == null)
-			return null;
-		
-		if(node instanceof FNode) {
-			return fnodeToFileInfo(name, (FNode) node);
-		} else if(node instanceof Context) {
-			Context ctx = (Context) node;
-			try {
-				node = ctx.lookup(INTERNAL_FILE);
-			} catch(NameNotFoundException ex) {
-				throw new RuntimeException("Internal error - missing child node: " + INTERNAL_FILE + "  (for key: " + name + ")");
-			}
-		}
-		
-		if(node == null)
-			throw new RuntimeException("Internal error: node should not be null for key: " + name);
+        throw new VFSException("Link resolution infinitely looped: " + name);
 
-		return fnodeToFileInfo(name, (FNode) node);
-	}
+    }
 
 
-	public List list(FileName path) throws Exception {
+    public FileInfo getFileInfo(FileName name) throws Exception {
+        // Convert to CompositeName
+        // get FileInfo
+        // return null if no info for name
 
-		// Convert to CompositeName
-		// enumerate values for the name
-		// return a list of them
+        Object node = getResolvedNode(name.toString());
 
-		NamingEnumeration names = null;
-		Object node = null;
-		try {
-			node = getResolvedNode(path.toString());
-		} catch(NameNotFoundException ex) {}
+        if (node == null)
+            return null;
 
-		if(node == null) 
-			throw new VFSException("File not found: " + path);
+        if (node instanceof FNode) {
+            return fnodeToFileInfo(name, (FNode) node);
+        } else if (node instanceof Context) {
+            Context ctx = (Context) node;
+            try {
+                node = ctx.lookup(INTERNAL_FILE);
+            } catch (NameNotFoundException ex) {
+                throw new RuntimeException("Internal error - missing child node: " + INTERNAL_FILE + "  (for key: " + name + ")");
+            }
+        }
 
-		if(!(node instanceof Context))
-			throw new VFSException("File is not a directory");
+        if (node == null)
+            throw new RuntimeException("Internal error: node should not be null for key: " + name);
 
-		try {
-			names = ((Context) node).listBindings("");
-		} catch(NotContextException ex) {
-			throw new VFSException("File is not a directory");
-		}
+        return fnodeToFileInfo(name, (FNode) node);
+    }
 
-		LinkedList ls = new LinkedList();
-		while(names.hasMore()) {
-			Binding binding = (Binding) names.next();
-			if(! INTERNAL_FILE.equals(binding.getName()))
-				ls.add(childToFileInfo(path.absolutize(binding.getName().toString()), binding.getObject()));
-		}
 
-		return ls;
-	}
+    public List list(FileName path) throws Exception {
 
-	public Collection getLinks(FileName target) throws Exception {
+        // Convert to CompositeName
+        // enumerate values for the name
+        // return a list of them
 
-		// return all fileinfos that link to this one
-		// why would we need that?
-		// it means we need to keep reverse references - a pain
-		throw new RuntimeException();
-	}
+        NamingEnumeration names = null;
+        Object node = null;
+        try {
+            node = getResolvedNode(path.toString());
+        } catch (NameNotFoundException ex) {
+        }
 
-	public void create(FileInfo fi) throws Exception {
-		// save fi under CompositeName
-		// what if it exists already ?
-		// Error, it must not exist
+        if (node == null)
+            throw new VFSException("File not found: " + path);
 
-		try {
-			// check father
-			// Noro - v primeru direktorija moramo narediti nov context !!!
-			if(fi.getFileType() == FileInfo.TYPE_DIR) {
+        if (!(node instanceof Context))
+            throw new VFSException("File is not a directory");
 
-				try {
-					fsroot.lookup(fi.getFileName().toString());
-					throw new VFSException("Directory exists already: " + fi.getFileName());
-				} catch(NameNotFoundException ex) {
-				}
+        try {
+            names = ((Context) node).listBindings("");
+        } catch (NotContextException ex) {
+            throw new VFSException("File is not a directory");
+        }
 
-				Context nuctx = fsroot.createSubcontext(fi.getFileName().toString());
-				nuctx.bind(INTERNAL_FILE, fileInfoToFNode(fi));
-			} else {
-				fsroot.bind(fi.getFileName().toString(), fileInfoToFNode(fi));
-			}
-		} catch(NamingException ex) {
-			throw new VFSException("Could not create file: " + fi.getFileName(), ex);
-		}
-	}
+        LinkedList ls = new LinkedList();
+        while (names.hasMore()) {
+            Binding binding = (Binding) names.next();
+            if (!INTERNAL_FILE.equals(binding.getName()))
+                ls.add(childToFileInfo(path.absolutize(binding.getName().toString()), binding.getObject()));
+        }
 
+        return ls;
+    }
 
-	// lahko spremeni katerikoli metainfo, samo filename-a ne (na ravni tabel se torej ne spremeni filename, parent in name),
-	// ker je to edini primary key, ki ga imam na voljo iz parametrov;
-	// problem pri primary key-ih pa je v drugih tabelah, kjer bo treba najprej vse vrstice pobrisat in nato
-	// novo vnest... (ni druge; ce bi hoteli ugotoviti, kaj ekzactly se updata, bi bilo se bolj potratno... odvisno od primera)
-	public void update(FileInfo fi) throws Exception {
-		// look up info for CompositeName
-		// apply new info to it
-		Object node = null;
-		try {
-			node = fsroot.lookup(fi.getFileName().toString());
-		} catch(NameNotFoundException ex) {
-		}
-		
-		if(node == null)
-			throw new VFSException("File does not exist: " + fi.getFileName());
-		
-		if(node instanceof FNode) {
-			updateFNodeWithFileInfo((FNode) node, fi);
-		} else if(node instanceof Context) {
-			node = ((Context) node).lookup(INTERNAL_FILE);
-			updateFNodeWithFileInfo((FNode) node, fi);
-		} else {
-			throw new RuntimeException("Internal error - Node is of wrong type: " + node.getClass().getName());
-		}
-	}
+    public Collection getLinks(FileName target) throws Exception {
 
+        // return all fileinfos that link to this one
+        // why would we need that?
+        // it means we need to keep reverse references - a pain
+        throw new RuntimeException();
+    }
 
-	// ko klices getInt na result setu, pa da je ta int nastavljen na NULL, dobis nazaj 0! Zato ne sme biti noben index 0!
-	public void remove(FileName name) throws Exception {
-		// remove entry
-		// if directory you need to remove context
-		Object node = null;
-		try {
-			node = fsroot.lookup(name.toString());
-		} catch(NameNotFoundException ex) {
-		}
-		
-		if(node == null)
-			throw new VFSException("File does not exist: " + name);
-		
-		if(node instanceof FNode) {
-			fsroot.unbind(name.toString());
-		} else if(node instanceof Context) {
-			// remove INTERNAL_FILE first
-			String nnode = name.toString() + INTERNAL_FILE;
-			Object co = fsroot.lookup(nnode);
-			fsroot.unbind(nnode);
-			try {
-				fsroot.destroySubcontext(name.toString());
-			} catch (Exception ex) {
-				fsroot.bind(nnode, co);
-				throw ex;
-			} catch (Throwable t) {
-				fsroot.bind(nnode, co);
-				throw new RuntimeException("Error while removing directory: ", t);
-			}
-		} else {
-			throw new RuntimeException("Internal error - Node is of wrong type: " + node.getClass().getName());
-		}
-		
-	}
+    public void create(FileInfo fi) throws Exception {
+        // save fi under CompositeName
+        // what if it exists already ?
+        // Error, it must not exist
 
+        try {
+            // check father
+            // Noro - v primeru direktorija moramo narediti nov context !!!
+            if (fi.getFileType() == FileInfo.TYPE_DIR) {
 
-	public void rename(FileName oldPath, FileName newPath) throws Exception {
-		// lookup structure and change the name
-		// rename is same as move - should be called move
-		Object node = null;
+                try {
+                    fsroot.lookup(fi.getFileName().toString());
+                    throw new VFSException("Directory exists already: " + fi.getFileName());
+                } catch (NameNotFoundException ex) {
+                }
 
-		try {
-			node = fsroot.lookup(oldPath.toString());
-		} catch(NameNotFoundException ex) {
-		}
+                Context nuctx = fsroot.createSubcontext(fi.getFileName().toString());
+                nuctx.bind(INTERNAL_FILE, fileInfoToFNode(fi));
+            } else {
+                fsroot.bind(fi.getFileName().toString(), fileInfoToFNode(fi));
+            }
+        } catch (NamingException ex) {
+            throw new VFSException("Could not create file: " + fi.getFileName(), ex);
+        }
+    }
 
-		if(node == null)
-			throw new RuntimeException("Internal error - Node does not exist: " + oldPath.toString());
 
-		if(node instanceof FNode) {
-			fsroot.rename(oldPath.toString(), newPath.toString());
-		} else if(node instanceof Context) {
-			// rename is already covered in naming
-			// we have to move it first
-			fsroot.rename(oldPath.toString(), newPath.toString());
-			if(!newPath.getName().equals(oldPath.getName())) {
-				try {
-					node = fsroot.lookup(newPath.toString() + INTERNAL_FILE);
-				} catch(NameNotFoundException ex) {
-				}
+    // lahko spremeni katerikoli metainfo, samo filename-a ne (na ravni tabel se torej ne spremeni filename, parent in name),
+    // ker je to edini primary key, ki ga imam na voljo iz parametrov;
+    // problem pri primary key-ih pa je v drugih tabelah, kjer bo treba najprej vse vrstice pobrisat in nato
+    // novo vnest... (ni druge; ce bi hoteli ugotoviti, kaj ekzactly se updata, bi bilo se bolj potratno... odvisno od primera)
+    public void update(FileInfo fi) throws Exception {
+        // look up info for CompositeName
+        // apply new info to it
+        Object node = null;
+        try {
+            node = fsroot.lookup(fi.getFileName().toString());
+        } catch (NameNotFoundException ex) {
+        }
 
-				if(node == null)
-					throw new RuntimeException("Internal error - Node does not exist: " + newPath.toString() + INTERNAL_FILE);
-				
-				((FNode) node).setName(newPath.getName());
-			}
-		} else {
-			throw new RuntimeException("Internal error - Node is of wrong type: " + node.getClass().getName());
-		}
+        if (node == null)
+            throw new VFSException("File does not exist: " + fi.getFileName());
 
-	}
+        if (node instanceof FNode) {
+            updateFNodeWithFileInfo((FNode) node, fi);
+        } else if (node instanceof Context) {
+            node = ((Context) node).lookup(INTERNAL_FILE);
+            updateFNodeWithFileInfo((FNode) node, fi);
+        } else {
+            throw new RuntimeException("Internal error - Node is of wrong type: " + node.getClass().getName());
+        }
+    }
 
 
-	public float moveBefore(FileName currFile, FileName nextFile) throws Exception {
-		// this operation moves a file whithin it's parent. Native FSs usually don't support this
-		throw new RuntimeException("Method not implemented");
+    // ko klices getInt na result setu, pa da je ta int nastavljen na NULL, dobis nazaj 0! Zato ne sme biti noben index 0!
+    public void remove(FileName name) throws Exception {
+        // remove entry
+        // if directory you need to remove context
+        Object node = null;
+        try {
+            node = fsroot.lookup(name.toString());
+        } catch (NameNotFoundException ex) {
+        }
+
+        if (node == null)
+            throw new VFSException("File does not exist: " + name);
+
+        if (node instanceof FNode) {
+            fsroot.unbind(name.toString());
+        } else if (node instanceof Context) {
+            // remove INTERNAL_FILE first
+            String nnode = name.toString() + INTERNAL_FILE;
+            Object co = fsroot.lookup(nnode);
+            fsroot.unbind(nnode);
+            try {
+                fsroot.destroySubcontext(name.toString());
+            } catch (Exception ex) {
+                fsroot.bind(nnode, co);
+                throw ex;
+            } catch (Throwable t) {
+                fsroot.bind(nnode, co);
+                throw new RuntimeException("Error while removing directory: ", t);
+            }
+        } else {
+            throw new RuntimeException("Internal error - Node is of wrong type: " + node.getClass().getName());
+        }
+
+    }
+
+
+    public void rename(FileName oldPath, FileName newPath) throws Exception {
+        // lookup structure and change the name
+        // rename is same as move - should be called move
+        Object node = null;
+
+        try {
+            node = fsroot.lookup(oldPath.toString());
+        } catch (NameNotFoundException ex) {
+        }
+
+        if (node == null)
+            throw new RuntimeException("Internal error - Node does not exist: " + oldPath.toString());
+
+        if (node instanceof FNode) {
+            fsroot.rename(oldPath.toString(), newPath.toString());
+        } else if (node instanceof Context) {
+            // rename is already covered in naming
+            // we have to move it first
+            fsroot.rename(oldPath.toString(), newPath.toString());
+            if (!newPath.getName().equals(oldPath.getName())) {
+                try {
+                    node = fsroot.lookup(newPath.toString() + INTERNAL_FILE);
+                } catch (NameNotFoundException ex) {
+                }
+
+                if (node == null)
+                    throw new RuntimeException("Internal error - Node does not exist: " + newPath.toString() + INTERNAL_FILE);
+
+                ((FNode) node).setName(newPath.getName());
+            }
+        } else {
+            throw new RuntimeException("Internal error - Node is of wrong type: " + node.getClass().getName());
+        }
+
+    }
+
+
+    public float moveBefore(FileName currFile, FileName nextFile) throws Exception {
+        // this operation moves a file whithin it's parent. Native FSs usually don't support this
+        throw new RuntimeException("Method not implemented");
 	}
 
 }
\ No newline at end of file

Modified: projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSStore.java
===================================================================
--- projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSStore.java	2009-10-16 20:05:58 UTC (rev 95051)
+++ projects/fresh/trunk/fresh-vfs/src/main/java/org/jboss/fresh/vfs/impl/mem/MemVFSStore.java	2009-10-16 20:38:23 UTC (rev 95052)
@@ -1,193 +1,188 @@
 package org.jboss.fresh.vfs.impl.mem;
 
-import org.jboss.fresh.vfs.FileInfo;
-import org.jboss.fresh.vfs.FileName;
-import org.jboss.fresh.vfs.FileOpInfo;
-import org.jboss.fresh.vfs.FileReadInfo;
-import org.jboss.fresh.vfs.VFSException;
-import org.jboss.fresh.vfs.VFSMeta;
-import org.jboss.fresh.vfs.VFSStore;
-import org.jboss.fresh.vfs.VFSStoreCacheUpdater;
-import org.jboss.fresh.registry.RegistryContext;
-
 import org.apache.log4j.Logger;
+import org.jboss.fresh.vfs.*;
 
 import javax.naming.Context;
+import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
-
 import java.util.Date;
 
 public class MemVFSStore implements VFSStore {
 
-	private VFSMeta meta;
-	private VFSStoreCacheUpdater cup;
-	RegistryContext fsroot;
+    private VFSMeta meta;
+    private VFSStoreCacheUpdater cup;
+    InitialContext fsroot;
 
-	private static Logger log = Logger.getLogger("org.jboss.fresh.vfs.impl.mem.MemVFSStore");
+    private static Logger log = Logger.getLogger("org.jboss.fresh.vfs.impl.mem.MemVFSStore");
 
-	public MemVFSStore(VFSMeta meta, String fsname) throws Exception {
-		this.meta = meta;
-		fsroot = new RegistryContext(fsname);
-	}
+    public MemVFSStore(VFSMeta meta, String fsname) throws Exception {
+        this.meta = meta;
+        fsroot = (InitialContext) new InitialContext().lookup(fsname);
+    }
 
-	public void setCacheUpdater(VFSStoreCacheUpdater updater) {
-		cup = updater;
-	}
+    public void setCacheUpdater(VFSStoreCacheUpdater updater) {
+        cup = updater;
+    }
 
-	public VFSStoreCacheUpdater getCacheUpdater() {
-		return cup;
-	}
+    public VFSStoreCacheUpdater getCacheUpdater() {
+        return cup;
+    }
 
 
-	public Object getResolvedNode(String name) throws VFSException, NamingException {
-		Object node = null;
+    public Object getResolvedNode(String name) throws VFSException, NamingException {
+        Object node = null;
 
-		for(int i=0; i<256; i++) {
-			node = fsroot.lookup(name);
-			if(node instanceof FNode) {
-				FNode fnode = (FNode) node;
-				if(fnode.getType() == FNode.LINK) {
-					name = fnode.getLinkRef();
-				} else {
-					return node;
-				}
-			} else {
-				return node;
-			}
-		}
+        for (int i = 0; i < 256; i++) {
+            node = fsroot.lookup(name);
+            if (node instanceof FNode) {
+                FNode fnode = (FNode) node;
+                if (fnode.getType() == FNode.LINK) {
+                    name = fnode.getLinkRef();
+                } else {
+                    return node;
+                }
+            } else {
+                return node;
+            }
+        }
 
-		throw new VFSException("Link resolution infinitely looped: " + name);
-	}
+        throw new VFSException("Link resolution infinitely looped: " + name);
+    }
 
-	
-	/** FileName must not be null, it can point to inexisting file.
-	 */
-	public boolean hasContent(FileName filename) throws Exception {
 
-		// lookup if it is a file
-		Object node = null;
-		try {
-			node = getResolvedNode(filename.toString());
-		} catch(NameNotFoundException ex) {
-		}
-		
-		if(node == null)
-			return false;
+    /**
+     * FileName must not be null, it can point to inexisting file.
+     */
+    public boolean hasContent(FileName filename) throws Exception {
 
-		if(node instanceof FNode) {
-			return ((FNode) node).getLength() > 0;
-		} else if(node instanceof Context) {
-			return false;
-		} else {
-			throw new RuntimeException("Internal error: child of illegal type: " + node.getClass().getName());
-		}		
-	}
+        // lookup if it is a file
+        Object node = null;
+        try {
+            node = getResolvedNode(filename.toString());
+        } catch (NameNotFoundException ex) {
+        }
 
+        if (node == null)
+            return false;
 
-	/** Writes a chunk of content data.
-	 *	FileOpInfo must be filled filename (file doesn't need to exist), filepos, and len.
-	 */
-	public void writeContent(FileOpInfo info) throws Exception {
-		try {
+        if (node instanceof FNode) {
+            return ((FNode) node).getLength() > 0;
+        } else if (node instanceof Context) {
+            return false;
+        } else {
+            throw new RuntimeException("Internal error: child of illegal type: " + node.getClass().getName());
+        }
+    }
 
-			Object node = null;
-			try {
-				node = getResolvedNode(info.filename.toString());
-			} catch(NameNotFoundException ex) {
-			}
-			
-			if(node == null) {
-				// file doesn't exist
-				// create it
-				FileInfo finf = new FileInfo(info.filename);
-				finf.setCreateDate(new Date());
-				finf.setLastModified(new Date());
-				finf.setFileType(FileInfo.TYPE_FILE);
-				finf.setLength(0);
-				finf.setMime("application/octet-stream");
-				meta.create(finf);
-				node = getResolvedNode(info.filename.toString());
-			}
 
-			RAF raf = null;
-			if(node instanceof FNode) {
-				raf = ((FNode) node).getFileContent().getRAF();
-			} else if(node instanceof Context) {
-				throw new VFSException(info.filename.toString() + " is a directory.");
-			}
+    /**
+     * Writes a chunk of content data.
+     * FileOpInfo must be filled filename (file doesn't need to exist), filepos, and len.
+     */
+    public void writeContent(FileOpInfo info) throws Exception {
+        try {
 
-			
-			if(info.append) {
-				raf.seek(raf.getLength());
-			} else {
-				raf.seek(info.offset);	
-			}
-			raf.write(info.buf, 0, info.buf.length);
-			raf.close();
+            Object node = null;
+            try {
+                node = getResolvedNode(info.filename.toString());
+            } catch (NameNotFoundException ex) {
+            }
 
-		} catch (Exception e) {
-			log.error("Could not write content", e);
-			throw e;
-		}
+            if (node == null) {
+                // file doesn't exist
+                // create it
+                FileInfo finf = new FileInfo(info.filename);
+                finf.setCreateDate(new Date());
+                finf.setLastModified(new Date());
+                finf.setFileType(FileInfo.TYPE_FILE);
+                finf.setLength(0);
+                finf.setMime("application/octet-stream");
+                meta.create(finf);
+                node = getResolvedNode(info.filename.toString());
+            }
 
-	}
+            RAF raf = null;
+            if (node instanceof FNode) {
+                raf = ((FNode) node).getFileContent().getRAF();
+            } else if (node instanceof Context) {
+                throw new VFSException(info.filename.toString() + " is a directory.");
+            }
 
 
-	/** 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 info) throws Exception {
+            if (info.append) {
+                raf.seek(raf.getLength());
+            } else {
+                raf.seek(info.offset);
+            }
+            raf.write(info.buf, 0, info.buf.length);
+            raf.close();
 
-		FileReadInfo result = new FileReadInfo();
-		long count;
+        } catch (Exception e) {
+            log.error("Could not write content", e);
+            throw e;
+        }
 
-			Object node = null;
-			try {
-				node = getResolvedNode(info.filename.toString());
-			} catch(NameNotFoundException ex) {
-			}
-			
-			if(node == null) throw new VFSException("File not found: " + info.filename);
+    }
 
-			RAF raf = null;
-			if(node instanceof FNode) {
-				raf = ((FNode) node).getFileContent().getRAF();
-			} else if(node instanceof Context) {
-				throw new VFSException(info.filename.toString() + " is a directory.");
-			}
-			
-			raf.seek(info.offset);
-			int size = 8192;
-			int togo = (int) (raf.getLength() - info.offset);
-			if(togo <= 0) {
-				result.buf = new byte[] {};
-				result.more = false;
-			} else if( togo > 0 && togo <= size) {
-				result.buf = new byte[togo];
-				result.more = false;
-			} else {
-				result.buf = new byte[size];
-				result.more = true;
-			}
 
-			raf.read(result.buf);
+    /**
+     * 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 info) throws Exception {
 
-			return result;
-	}
+        FileReadInfo result = new FileReadInfo();
+        long count;
 
+        Object node = null;
+        try {
+            node = getResolvedNode(info.filename.toString());
+        } catch (NameNotFoundException ex) {
+        }
 
-	/** Removes content data for specified file from persistence.
-	 */
-	public void removeContent(FileName name) throws Exception {
+        if (node == null) throw new VFSException("File not found: " + info.filename);
 
-		// ves content je v podatkovni strukturi, ki bo odstranjena 
-		// skupaj z metainfom
-	}
+        RAF raf = null;
+        if (node instanceof FNode) {
+            raf = ((FNode) node).getFileContent().getRAF();
+        } else if (node instanceof Context) {
+            throw new VFSException(info.filename.toString() + " is a directory.");
+        }
 
+        raf.seek(info.offset);
+        int size = 8192;
+        int togo = (int) (raf.getLength() - info.offset);
+        if (togo <= 0) {
+            result.buf = new byte[]{};
+            result.more = false;
+        } else if (togo > 0 && togo <= size) {
+            result.buf = new byte[togo];
+            result.more = false;
+        } else {
+            result.buf = new byte[size];
+            result.more = true;
+        }
 
-	public void rename(FileName oldPath, FileName newPath) throws Exception {
-		// v content delu ni ni� za postoriti na to temo
+        raf.read(result.buf);
+
+        return result;
+    }
+
+
+    /**
+     * Removes content data for specified file from persistence.
+     */
+    public void removeContent(FileName name) throws Exception {
+
+        // ves content je v podatkovni strukturi, ki bo odstranjena
+        // skupaj z metainfom
+    }
+
+
+    public void rename(FileName oldPath, FileName newPath) throws Exception {
+        // v content delu ni ni� za postoriti na to temo
 	}
 
 




More information about the jboss-cvs-commits mailing list