[jboss-cvs] JBossAS SVN: r88084 - in projects/fresh/trunk: fresh-shell/src/main/java/org/jboss/fresh/deployer and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 30 20:19:51 EDT 2009


Author: ctomc
Date: 2009-04-30 20:19:51 -0400 (Thu, 30 Apr 2009)
New Revision: 88084

Removed:
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationService.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationServiceMBean.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyService.java
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyServiceMBean.java
   projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/parsek/cpii/Cp2Configuration.java
Modified:
   projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-service.xml
   projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinder.java
Log:
removed cp2configration mbean as it was without any added value. only usefull method was moved to naming binder

Modified: projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-service.xml
===================================================================
--- projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-service.xml	2009-05-01 00:04:47 UTC (rev 88083)
+++ projects/fresh/trunk/fresh-jar/src/main/resources/META-INF/fresh-service.xml	2009-05-01 00:19:51 UTC (rev 88084)
@@ -1,13 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <server>
-    <mbean code="org.jboss.fresh.deployer.Cp2ConfigurationService" name="FRESH:service=Cp2ConfigurationService">
-        <attribute name="JNDIName">java:/FRESH/Configuration</attribute>
-        <attribute name="Properties">
-            cp2.UserTransaction.jndiName=java:comp/UserTransaction
-        </attribute>
-    </mbean>
-
+   
     <mbean code="org.jboss.fresh.deployer.ContextBinder" name="FRESH:service=GlobalContext">
         <attribute name="JNDIName">java:/FRESH/GlobalContext</attribute>
     </mbean>
@@ -28,8 +22,7 @@
         <attribute name="StoreClassFactory">org.jboss.fresh.vfs.impl.mem.MemVFSStoreFactory</attribute>
         <attribute name="MetaPropertyString">memfs.name=root</attribute>
         <attribute name="StorePropertyString">memfs.name=root</attribute>
-        <attribute name="TagFactory">org.jboss.fresh.vfs.impl.TimeTagFactory</attribute>
-        <depends>FRESH:service=Cp2ConfigurationService</depends>
+        <attribute name="TagFactory">org.jboss.fresh.vfs.impl.TimeTagFactory</attribute>        
     </mbean>
 
     <mbean code="org.jboss.fresh.deployer.RootVFSService" name="FRESH:service=VFS.Root">
@@ -45,7 +38,6 @@
         <attribute name="VFSJNDIName">java:/FRESH/VFS</attribute>
         <attribute name="GCInterval">10000</attribute>
         <attribute name="ExecutableRegistry"><inject bean="BeanFactoryExecutableRegistry"/></attribute>
-        <depends>FRESH:service=Cp2ConfigurationService</depends>
         <depends>FRESH:service=ThreadPool</depends>
         <depends>FRESH:service=VFS.Root</depends>
     </mbean>

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationService.java	2009-05-01 00:04:47 UTC (rev 88083)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationService.java	2009-05-01 00:19:51 UTC (rev 88084)
@@ -1,100 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import org.jboss.fresh.parsek.cpii.Cp2Configuration;
-
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-public class Cp2ConfigurationService extends RegistryNamingBinder implements Cp2ConfigurationServiceMBean {
-
-    private String jndiName;
-    private Properties props;
-
-    public Cp2ConfigurationService() {
-    }
-
-    public Cp2ConfigurationService(String properties) {
-
-        props = new Properties();
-        Cp2Configuration.updateConfiguration(props);
-        StringTokenizer st = new StringTokenizer(properties, "|");
-        while (st.hasMoreTokens()) {
-            String line = st.nextToken();
-            StringTokenizer lineTokenizer = new StringTokenizer(line, "=");
-            String name = lineTokenizer.nextToken().trim();
-            String value = lineTokenizer.nextToken().trim();
-            props.setProperty(name, value);
-        }
-    }
-
-
-    public void setProperties(Properties properties) {
-        props = properties;
-    }
-
-
-    public Properties getProperties() {
-        return props;
-    }
-
-
-    public String getName() {
-        return "Cp2ConfigurationService";
-    }
-
-
-    public void setProperty(String name, String value) {
-        props.setProperty(name, value);
-    }
-
-
-    public String removeProperty(String name) {
-        String value = (String) props.remove(name);
-        return ("Property named " + name + " had a value >" + value + "<.</BR>");
-    }
-
-
-    protected String getBindClass() {
-        return java.util.Map.class.getName();
-    }
-
-
-    protected Object classToInstance(Class c) {
-
-        // instaliraj se kot NotificationListener
-
-        // create pool instance.
-        // set factory
-
-        try {
-            Cp2Configuration.updateConfiguration(props);
-            Cp2Configuration.diagnoseJNDIConf();
-
-            System.out.println(Cp2Configuration.getString(Cp2Configuration.GLOBAL_CONFIGURATION_JNDI_NAME));
-            System.out.println(Cp2Configuration.getString(Cp2Configuration.USER_TRANSACTION_JNDI_NAME_PROPERTY));
-            System.out.println(Cp2Configuration.getBoolean(Cp2Configuration.JNDI_BIND_REFERENCES_PROPERTY));
-            System.out.println(Cp2Configuration.getBoolean(Cp2Configuration.JNDI_SUPPORTS_NON_SERIALIZABLE));
-            System.out.println(Cp2Configuration.getBoolean(Cp2Configuration.JNDI_SUPPORTS_SUBCONTEXTS));
-
-            setServiceObject(props);
-            return props;
-
-        } catch (Exception ex) {
-            throw new RuntimeException(ex.toString());
-        }
-    }
-
-
-    public String viewConfiguration() {
-        StringBuffer buf = new StringBuffer();
-        Iterator names = props.keySet().iterator();
-        while (names.hasNext()) {
-            String name = (String) names.next();
-            buf.append(name + " = >" + props.getProperty(name) + "<</BR>");
-        }
-
-        return buf.toString();
-    }
-
-}
\ No newline at end of file

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationServiceMBean.java	2009-05-01 00:04:47 UTC (rev 88083)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/Cp2ConfigurationServiceMBean.java	2009-05-01 00:19:51 UTC (rev 88084)
@@ -1,13 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import java.util.Properties;
-
-
-public interface Cp2ConfigurationServiceMBean extends RegistryNamingBinderMBean {
-    
-	public void setProperty( String name, String value );
-	public String removeProperty( String name );	
-	public String viewConfiguration();
-	public void setProperties(Properties props);
-	public Properties getProperties();
-}
\ No newline at end of file

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyService.java	2009-05-01 00:04:47 UTC (rev 88083)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyService.java	2009-05-01 00:19:51 UTC (rev 88084)
@@ -1,9 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-public class DummyService extends ServiceModule implements DummyServiceMBean {
-
-    public String getName() {
-        return "DummyService";
-    }
-}
\ No newline at end of file

Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyServiceMBean.java	2009-05-01 00:04:47 UTC (rev 88083)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/DummyServiceMBean.java	2009-05-01 00:19:51 UTC (rev 88084)
@@ -1,5 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-public interface DummyServiceMBean extends ServiceModuleMBean {
-}
\ No newline at end of file

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-05-01 00:04:47 UTC (rev 88083)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinder.java	2009-05-01 00:19:51 UTC (rev 88084)
@@ -9,8 +9,8 @@
 import javax.naming.Reference;
 import javax.naming.StringRefAddr;
 
-import org.jboss.fresh.parsek.cpii.Cp2Configuration;
 import org.jboss.fresh.naming.StaticObjectStore;
+import org.jboss.fresh.util.UniqueNumberGenerator;
 
 public abstract class NamingBinder extends ServiceModule implements NamingBinderMBean {
 	// Attributes ----------------------------------------------------
@@ -19,7 +19,12 @@
 	private String m_bindName;
 	private String bindClassName;
 	private Object sobj;
+    private static boolean jndiSupportsNonSerializable = false;
 
+    static{
+        diagnoseJNDIConf();
+    }
+
 	public String getName() {
 		return "CP2 Binder Service";
 	}
@@ -103,13 +108,13 @@
 		}
 		if (ctx==null)ctx=cx;
 		Object binst = getBindInstance();
-		log.info("supports non-serializable ? " + Cp2Configuration.jndiSupportsNonSerializable());
+		log.info("supports non-serializable ? " + jndiSupportsNonSerializable);
 		log.info("bindByReference() ? " + bindByReference());
 		log.info("bindInstance() ? " + binst + " [" + (binst == null ? "" : binst.getClass().getName()) + "]");
 		log.debug("NameParser: " + n);
 		log.debug("Ctx: "+ctx);
 		log.debug("binst: "+binst);
-		if (Cp2Configuration.jndiSupportsNonSerializable()) {
+		if (jndiSupportsNonSerializable) {
 			ctx.bind(n.get(0), binst);
 		} else if (bindByReference()) {
 			StringRefAddr addr = new StringRefAddr("nns", m_bindName);
@@ -133,4 +138,25 @@
 	protected boolean bindByReference() {
 		return false;
 	}
+
+    private static void diagnoseJNDIConf(){
+		String key = UniqueNumberGenerator.getRandomValue(40);
+		String subkey = UniqueNumberGenerator.getRandomValue(40);
+
+        try {
+            InitialContext ctx = new InitialContext();
+            // try bind a non-serializable
+            try {
+                ctx.bind(key, new Object());
+                ctx.unbind(key);
+                jndiSupportsNonSerializable = true;
+            } catch(Exception ex) {
+                jndiSupportsNonSerializable = false;
+            }
+        } catch (NamingException e) {
+            //we dont realy care!
+        }
+
+
+    }
 }

Deleted: projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/parsek/cpii/Cp2Configuration.java
===================================================================
--- projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/parsek/cpii/Cp2Configuration.java	2009-05-01 00:04:47 UTC (rev 88083)
+++ projects/fresh/trunk/fresh-util/src/main/java/org/jboss/fresh/parsek/cpii/Cp2Configuration.java	2009-05-01 00:19:51 UTC (rev 88084)
@@ -1,92 +0,0 @@
-package org.jboss.fresh.parsek.cpii;
-
-import java.util.Map;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.jboss.fresh.util.UniqueNumberGenerator;
-
-public class Cp2Configuration {
-
-	public static Map props;
-
-	public static final String GLOBAL_CONFIGURATION_JNDI_NAME		= "java:/CP2/Configuration";
-
-	public static final String USER_TRANSACTION_JNDI_NAME_PROPERTY		= "cp2.UserTransaction.jndiName";
-	public static final String JNDI_BIND_REFERENCES_PROPERTY		= "cp2.jndi.bindReferences";
-	public static final String JNDI_SUPPORTS_NON_SERIALIZABLE		= "cp2.jndi.supportsNonSerializable";
-	public static final String JNDI_SUPPORTS_SUBCONTEXTS			= "cp2.jndi.supportsSubContexts";
-	//public static final String JNDI_USE_PROXIES_PROPERTY			= "cp2.jndi.useProxies";
-
-	public static void updateConfiguration( Map p ) {
-		props = p;
-	}
-
-
-	public static String getUserTransactionJndiName() {
-		return getString( USER_TRANSACTION_JNDI_NAME_PROPERTY );
-	}
-
-	/*
-	public static boolean jndiUseProxies() {
-		return Boolean.getBoolean( props.getProperty( JNDI_USE_PROXIES_PROPERTY ) );
-	}
-	*/
-
-	public static boolean jndiBindReferences() {
-
-		return getBoolean(JNDI_BIND_REFERENCES_PROPERTY);
-	}
-
-
-	public static boolean jndiSupportsNonSerializable() {
-
-		return getBoolean(JNDI_SUPPORTS_NON_SERIALIZABLE);
-	}
-
-
-	public static boolean isSet(String key) {
-		return props.containsKey(key);
-	}
-
-	public static boolean getBoolean(String key) {
-		String tmp = (String) props.get( key );
-		boolean result = Boolean.valueOf( tmp ).booleanValue();
-		return result;
-	}
-	
-	public static String getString(String key) {
-		return (String) props.get( key );
-	}
-
-
-
-	public static void diagnoseJNDIConf() throws NamingException {
-		String key = UniqueNumberGenerator.getRandomValue(40);
-		String subkey = UniqueNumberGenerator.getRandomValue(40);
-
-		InitialContext ctx = new InitialContext();
-		// try bind a non-serializable
-		try {
-			ctx.bind(key, new Object());
-			ctx.unbind(key);
-			props.put(JNDI_SUPPORTS_NON_SERIALIZABLE, "true");
-		} catch(Exception ex) {
-			props.put(JNDI_SUPPORTS_NON_SERIALIZABLE, "false");
-		}
-
-		// check if subcontext binding works
-		try {
-			ctx.createSubcontext(subkey);
-			props.put(JNDI_SUPPORTS_SUBCONTEXTS, "true");
-		} catch(Exception ex) {
-			props.put(JNDI_SUPPORTS_SUBCONTEXTS, "false");
-		}
-		
-		// check if ref resolution is supported
-		// ...
-	}
-
-	//getInteger();
-	//getLong();
-
-}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list