[jboss-cvs] JBossAS SVN: r96765 - in projects/fresh/trunk: fresh-shell/src/main/java/org/jboss/fresh/deployer and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 23 17:44:35 EST 2009
Author: ctomc
Date: 2009-11-23 17:44:34 -0500 (Mon, 23 Nov 2009)
New Revision: 96765
Removed:
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/deployer/BaseService.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinder.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinderMBean.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinder.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinderMBean.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/NamingBinderMBean.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/RegistryNamingBinderMBean.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/RootVFSServiceMBean.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceAlreadyStartedException.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModule.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModuleMBean.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorServiceMBean.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileServiceMBean.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSService.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSServiceMBean.java
projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHServiceMBean.java
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/ejb/UnremoterShell.java
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java
projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHService.java
Log:
mbeans are out
Deleted: 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-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-scripting/src/main/java/org/jboss/fresh/deployer/ScriptingServiceMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,8 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import org.jboss.fresh.deployer.ScriptingCentral;
-import org.jboss.fresh.deployer.RegistryNamingBinderMBean;
-
-public interface ScriptingServiceMBean extends ScriptingCentral, NamingBinderMBean {
-
-}
\ No newline at end of file
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/BaseService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/BaseService.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/BaseService.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,34 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import javax.management.ObjectName;
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-
-public class BaseService implements MBeanRegistration {
-
- private ObjectName mbname;
-
- // override this method if you want to perform something or you want to override ObjectName of the mbean
- public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception {
- mbname = name;
- return mbname;
- }
-
- public void postRegister(Boolean registrationDone) {
- }
-
- public void preDeregister() throws java.lang.Exception {
- }
-
- public void postDeregister() {
- }
-
- public ObjectName getObjectName() {
- return mbname;
- }
-
- // you can call this method from extended constructor to set mbname
- protected void setObjectName(ObjectName oname) {
- mbname = oname;
- }
-}
\ No newline at end of file
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinder.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinder.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinder.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,33 +0,0 @@
-/*
- * Created on 2004.10.25
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.jboss.fresh.deployer;
-
-import org.jboss.fresh.ctx.FlatContext;
-import org.jboss.fresh.ctx.Context;
-
-/**
- * @author Marko Strukelj
- *
- */
-public class ContextBinder extends RegistryNamingBinder implements ContextBinderMBean {
-
- /**
- *
- */
- public ContextBinder() {
- super();
- }
-
- protected Object classToInstance(Class c) {
- return new FlatContext();
- }
-
- protected String getBindClass() {
- return Context.class.getName();
- }
-
-}
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinderMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinderMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ContextBinderMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,17 +0,0 @@
-/*
- * Created on 2004.10.25
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-package org.jboss.fresh.deployer;
-
-/**
- * @author strukelj
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
-public interface ContextBinderMBean extends RegistryNamingBinderMBean {
-
-}
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinder.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinder.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinder.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,70 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.fresh.ctx.FlatContext;
-import org.jboss.fresh.ctx.JNDICtx;
-
-public class JNDICtxBinder extends RegistryNamingBinder implements JNDICtxBinderMBean {
-
- private String mappings;
- private Map map = new HashMap();
-
- public String getName() {
- return "JNDICtxBinder";
- }
-
- public void setMappings(String str) {
- try {
- this.mappings = str;
-
- InputStream in = new ByteArrayInputStream(str.getBytes());
- Properties p = new Properties();
- p.load(in);
-
- Enumeration enom = p.propertyNames();
- while (enom.hasMoreElements()) {
- String key = (String) enom.nextElement();
- map.put(key, p.getProperty(key));
- }
- } catch (Exception ex) {
- throw new RuntimeException("Error configuring mappings: " + ex.toString());
- }
- }
-
- public String getMappings() {
- return mappings;
- }
-
- protected String getBindClass() {
- return "com.parsek.ctx.Context";
- }
-
- protected Object classToInstance(Class c) {
-
- // create it
- // set mappings
- // return
-
- FlatContext ctx = new FlatContext();
-
- JNDICtx jctx = new JNDICtx();
- jctx.setMappings(map);
- ctx.registerDelegate(jctx);
-
- setServiceObject(ctx);
- return ctx;
-
- }
-
- protected boolean bindByReference() {
- return true;
- }
-
-}
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinderMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinderMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/JNDICtxBinderMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,12 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-public interface JNDICtxBinderMBean extends RegistryNamingBinderMBean {
-
- public void setMappings(String str);
-
- public String getMappings();
-
-}
-
-
Deleted: 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-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinder.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,162 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.Name;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-
-import org.jboss.fresh.naming.StaticObjectStore;
-import org.jboss.fresh.util.UniqueNumberGenerator;
-
-public abstract class NamingBinder extends ServiceModule implements NamingBinderMBean {
- // Attributes ----------------------------------------------------
- private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(NamingBinder.class);
- private String m_jndiName;
- private String m_bindName;
- private String bindClassName;
- private Object sobj;
- private static boolean jndiSupportsNonSerializable = false;
-
- static{
- diagnoseJNDIConf();
- }
-
- public String getName() {
- return "CP2 Binder Service";
- }
-
- public void setJNDIName(String name) {
- m_jndiName = name;
- }
-
- public String getJNDIName() {
- return m_jndiName;
- }
-
- public void setServiceObject(Object obj) {
- this.sobj = obj;
- }
-
- public Object getServiceObject() {
- return sobj;
- }
-
- public void doStart() throws Exception {
- try {
- bind();
- } catch (NamingException x) {
- log.error("Bind failed!", x);
- throw x;
- }
- }
-
- public void doStop() {
- try {
- unbind();
- } catch (NamingException x) {
- log.error("Unbind failed!", x);
- }
- }
-
- abstract protected String getBindClass();
-
- abstract protected Object classToInstance(Class c);
-
- protected Object getBindInstance() {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class clazz = null;
- String bindClassName = getBindClass();
- if (bindClassName != null) {
- try {
- clazz = cl.loadClass(bindClassName);
- return classToInstance(clazz);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("No such class: " + bindClassName + " : " + e.toString());
- }
- }
- return null;
- }
-
- private void bind() throws NamingException {
- Context cx = new InitialContext();
- String name = getJNDIName();
- if (name == null)
- return;
- m_bindName = name;
- log.debug("bindName: "+name);
- Name n = cx.getNameParser("").parse(m_bindName);
- Context ctx = null;
- while (n.size() > 1) {
- String ctxName = n.get(0);
- log.debug("CtxName: "+ctxName);
- try {
- ctx = (Context) cx.lookup(ctxName);
- if (ctx==null){//to workaround resin bug!
- log.debug("Lookup retured null, will create new subcontext");
- ctx = cx.createSubcontext(ctxName);
- }
- } catch (NameNotFoundException e) {
- log.warn("Could not lookup for ctx "+ctxName);
- ctx = cx.createSubcontext(ctxName);
- log.debug("ctx after create subcontext: "+ctx);
- }
- n = n.getSuffix(1);
- }
- if (ctx==null)ctx=cx;
- Object binst = getBindInstance();
- 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 (jndiSupportsNonSerializable) {
- ctx.bind(n.get(0), binst);
- } else if (bindByReference()) {
- StringRefAddr addr = new StringRefAddr("nns", m_bindName);
- Reference ref = new Reference(getBindClass(), addr, StaticObjectStore.class.getName(), null);
- StaticObjectStore.put(m_bindName, binst);
- ctx.bind(n.get(0), ref);
- } else {
- ctx.bind(n.get(0), binst);
- }
- log.info(getName() + ": '" + getJNDIName() + "' bound to '" + m_bindName + "'");
- }
-
- private void unbind() throws NamingException {
- if (m_bindName != null) {
- new InitialContext().unbind(m_bindName);
- StaticObjectStore.remove(m_bindName);
- log.info(getName() + ": '" + getJNDIName() + "' removed from JNDI.");
- }
- }
-
- 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-shell/src/main/java/org/jboss/fresh/deployer/NamingBinderMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinderMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/NamingBinderMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,13 +0,0 @@
-package org.jboss.fresh.deployer;
-
-public interface NamingBinderMBean extends ServiceModuleMBean {
-
- public void setJNDIName(String name);
-
- public String getJNDIName();
-
- public void setServiceObject(Object obj);
-
- public Object getServiceObject();
-
-}
Deleted: 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-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinder.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,223 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import javax.naming.*;
-import javax.naming.InitialContext;
-import org.jboss.fresh.naming.StaticObjectStore;
-
-public abstract class RegistryNamingBinder extends ServiceModule implements RegistryNamingBinderMBean {
-
- private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(RegistryNamingBinder.class);
-
- private String m_jndiName;
- private String m_bindName;
-
- private boolean doBindNative = true;
- private String nativeJNDIName;
-
- private Object sobj;
-
- private boolean doBindByReference = true;
-
- public String getName() {
- return "CP2 Registry Binder Service";
- }
-
- public void setJNDIName(String name) {
- m_jndiName = name;
- }
-
- public String getJNDIName() {
- return m_jndiName;
- }
-
- public void setServiceObject(Object obj) {
- this.sobj = obj;
- }
-
- public Object getServiceObject() {
- return sobj;
- }
-
- public void doStart() throws Exception {
- try {
- bind();
- } catch (NamingException x) {
- log.error("Bind failed!", x);
- throw x;
- }
- }
-
- public void doStop() {
- try {
- unbind();
- } catch (NamingException x) {
- log.error("Unbind failed!", x);
- }
-
- }
-
-
- abstract protected String getBindClass();
-
- abstract protected Object classToInstance(Class c);
-
-
- protected Object getBindInstance() {
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class clazz = null;
-
- String bindClassName = getBindClass();
- if (bindClassName != null) {
- try {
- clazz = cl.loadClass(bindClassName);
- return classToInstance(clazz);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("No such class: " + bindClassName + " : " + e.toString());
- }
- }
-
- return null;
-
- }
-
- private void bind() throws NamingException {
- Context ctx = new InitialContext();
- String name = getJNDIName();
- if (name == null)
- return;
-
- log.info("name: "+name);
- // if (!name.startsWith("java:/")) {
- // name = "java:/" + name;
- // }
-
- m_bindName = name;
-
- // Ah ! This class isn't serializable, so we use a helper class
- // Make this work - oneliner for binding
- //ctx.bind(m_bindName, getBindInstance());
-
- Name n = ctx.getNameParser("").parse(m_bindName);
- 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);
- }
-
- Object bindInstance = getBindInstance();
- ctx.bind(n.get(0), bindInstance);
-
- log.info(getName() + ": '" + getJNDIName() + "' bound to '" + m_bindName + "' in registry");
-
- icBind(bindInstance);
- }
-
-
- private void icBind(Object bindInstance) throws NamingException {
- Context cx = new InitialContext();
- String name = getNativeBindName();
- if (name == null)
- return;
-
- log.debug("native bindName: " + name);
- Name n = cx.getNameParser("").parse(name);
- Context ctx = cx;
- while (n.size() > 1) {
- String ctxName = n.get(0);
- log.debug("native CtxName: " + ctxName);
- try {
- cx = (Context) ctx.lookup(ctxName);
- if (cx == null){ //to workaround resin bug!
- log.debug("Lookup retured null, will create new subcontext");
- cx = ctx.createSubcontext(ctxName);
- }
- } catch (NameNotFoundException e) {
- log.debug("Creating subcontext: " + ctxName);
- cx = ctx.createSubcontext(ctxName);
- }
-
- ctx = cx;
- n = n.getSuffix(1);
- }
-
- Object binst = bindInstance;
- log.info("bindInstance() ? " + binst + " [" + (binst == null ? "" : binst.getClass().getName()) + "]");
-
- // each service decides how it's gonna bind
- // - default is by value
- if(doBindByReference) {
- StringRefAddr addr = new StringRefAddr("nns", name);
- Reference ref = new Reference(getBindClass(), addr, StaticObjectStore.class.getName(), null);
- StaticObjectStore.put(name, binst);
- ctx.bind(n.get(0), ref);
- } else {
- ctx.bind(n.get(0), binst);
- }
-
- log.info(getName() + ": '" + getJNDIName() + "' bound to '" + name + "' in JNDI");
- }
-
- private void unbind() throws NamingException {
- if (m_bindName != null) {
- new InitialContext().unbind(m_bindName);
- log.info(getName() + ": '" + getJNDIName() + "' removed from registry");
-
- }
-
- icUnbind();
- }
-
- private void icUnbind() throws NamingException {
- String name = getNativeBindName();
- if (name != null) {
- new InitialContext().unbind(name);
- StaticObjectStore.remove(name);
- log.info(getName() + ": '" + getNativeBindName() + "' removed from JNDI.");
- }
-
- }
-
-
- public String getNativeBindName() {
- if(!doBindNative)
- return null;
- else if(nativeJNDIName != null)
- return nativeJNDIName;
- else
- return m_jndiName;
- }
-
-
- public void setBindNative(boolean bnat) {
- this.doBindNative = bnat;
- }
-
- public boolean getBindNative() {
- return this.doBindNative;
- }
-
-
- public void setNativeJNDIName(String jndiName) {
- this.nativeJNDIName = jndiName;
- }
-
- public String getNativeJNDIName() {
- return nativeJNDIName;
- }
-
-
-
- public boolean getBindByReference() {
- return doBindByReference;
- }
-
- public void setBindByReference(boolean val) {
- this.doBindByReference = val;
- }
-
-}
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinderMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinderMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RegistryNamingBinderMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,18 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-public interface RegistryNamingBinderMBean extends ServiceModuleMBean {
-
- public void setJNDIName(String name);
- public String getJNDIName();
-
- public void setBindNative(boolean bnat);
- public boolean getBindNative();
-
- public void setNativeJNDIName(String jndiName);
- public String getNativeJNDIName();
-
- public boolean getBindByReference();
- public void setBindByReference(boolean val);
-
-}
Deleted: 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-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSService.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,77 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-import org.apache.log4j.Logger;
-import javax.naming.InitialContext;
-import org.jboss.fresh.vfs.RootVFS;
-import org.jboss.fresh.vfs.VFS;
-import org.jboss.fresh.vfs.impl.DefaultRootVFS;
-import org.jboss.aop.microcontainer.aspects.jmx.JMX;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * @author uros
- * @version $Revision: 3032 $
- * @modified $Author: strukelj $
- */
-//@JMX(name = "FRESH:service=VFS.Root", exposedInterface = RootVFSServiceMBean.class)
-public class RootVFSService{
-
- private static Logger log = Logger.getLogger(RootVFSService.class);
- private RootVFS vfs;
- private Properties props;
-
- protected String getBindClass() {
- return RootVFS.class.getName();
- }
-
- public void setAutomount(Properties p) {
- props = p;
- }
-
- public Properties getAutomount() {
- return props;
- }
-
- protected Object classToInstance(Class c) {
-
- try {
- vfs = new DefaultRootVFS(null);
- return vfs;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- protected boolean bindByReference() {
- return true;
- }
-
- public void doStart() throws Exception {
- //super.doStart();
- if (props != null) {
- InitialContext ctx = new InitialContext();
- Set set = props.entrySet();
- Iterator it = set.iterator();
- while (it.hasNext()) {
- Map.Entry ent = (Map.Entry) it.next();
- String path = (String) ent.getKey();
- String jndi = (String) ent.getValue();
-
- VFS mvfs = (VFS) ctx.lookup(jndi);
- vfs.mount(path, mvfs);
- }
- }
- }
-
- public String getName() {
- return "CP2 Root VFS Binder Service";
- }
-
-}
-
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSServiceMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/RootVFSServiceMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,9 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import java.util.Properties;
-
-
-public interface RootVFSServiceMBean extends RegistryNamingBinderMBean {
- public void setAutomount(Properties p);
- public Properties getAutomount();
-}
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceAlreadyStartedException.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceAlreadyStartedException.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceAlreadyStartedException.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,13 +0,0 @@
-package org.jboss.fresh.deployer;
-
-public class ServiceAlreadyStartedException extends RuntimeException {
-
- public ServiceAlreadyStartedException() {
- super();
- }
-
- public ServiceAlreadyStartedException(String message) {
- super(message);
- }
-
-}
\ No newline at end of file
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModule.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModule.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModule.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,90 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import java.util.Date;
-
-public class ServiceModule extends BaseService implements ServiceModuleMBean {
-
- public static final String STARTING = "Starting";
- public static final String STARTED = "Started";
- public static final String STOPPING = "Stopping";
- public static final String STOPPED = "Stopped";
-
- private String status = STOPPED;
- private long startTime = 0;
-
- public synchronized void start() throws Exception {
-
- if(status==STARTED) throw new ServiceAlreadyStartedException("The service has already been started. If you want to restart it call stop() first or call restart().");
-
- //if(state==STARTING) throw new RuntimeException("The service is already starting up. Wait for it to reach STARTED or STOPPED state.");
- //if(state==STOPPING) throw new RuntimeException("The service is being stopped. Wait for it to reach STARTED or STOPPED state.");
-
- status = STARTING;
-
- try {
- doStart();
- status = STARTED;
- startTime = System.currentTimeMillis();
- } catch(Exception ex) {
- status = STOPPED;
- startTime = 0;
- throw ex;
- } catch(Throwable th) {
- status = STOPPED;
- startTime = 0;
- throw new RuntimeException(th);
- }
- }
-
- public synchronized void stop() throws Exception {
-
- if(status==STOPPED) return;
-
- status = STOPPING;
-
- try {
- doStop();
- status = STOPPED;
- startTime = 0;
- } catch(Exception ex) {
- status = STARTED;
- throw ex;
- } catch(Throwable th) {
- status = STARTED;
- throw new RuntimeException(th);
- }
- }
-
- public synchronized void restart() throws Exception {
- if(status==STOPPED) throw new RuntimeException("The service is not running.");
-
- stop();
- start();
- }
-
- public String getStatus() {
- return status;
- }
-
-
- public Date getStartTime() {
- if(startTime == 0) return null;
- return new Date(startTime);
- }
-
-
- /**
- * Override this methods to perform any startup actions
- * (like binding objects into naming or starting a service thread)
- */
- public void doStart() throws Exception {
- }
-
- /**
- * Override this methods to perform any shutdown actions
- * (like unbinding objects from naming or stopping a service thread)
- */
- public void doStop() throws Exception {
- }
-
-}
\ No newline at end of file
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModuleMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModuleMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ServiceModuleMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,11 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import java.util.Date;
-
-public interface ServiceModuleMBean {
- public void start() throws Exception;
- public void stop() throws Exception;
- public void restart() throws Exception;
- public String getStatus();
- public Date getStartTime();
-}
\ No newline at end of file
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorServiceMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/ShellExecutorServiceMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,39 +0,0 @@
-package org.jboss.fresh.deployer;
-
-import java.util.Map;
-
-public interface ShellExecutorServiceMBean extends ServiceModuleMBean {
-
- public void setBatchFile(String file);
-
- public String getBatchFile();
-
- public void setBatchCode(String code);
-
- public String getBatchCode();
-
- public void setStopOnError(Boolean val);
-
- public Boolean getStopOnError();
-
- public void setLogFile(String val);
-
- public String getLogFile();
-
- public void setSvcName(String val);
-
- public String getSvcName();
-
- public void setExecuteOnStart(boolean val);
-
- public boolean getExecuteOnStart();
-
- public void setUseLocal(boolean val);
-
- public boolean getUseLocal();
-
- public void execute() throws Exception;
-
- public void execute(Map params) throws Exception;
-
-}
\ No newline at end of file
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileServiceMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSFileServiceMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,45 +0,0 @@
-package org.jboss.fresh.deployer;
-
-/**
- * This Mbean will upon firing create a file in VFS (creating folders as neccessary) and fill it
- * with specified content. Content can either be given as a <tt>content</tt> parameter or as an
- * external, on-disk file which will be read upon startup.
- */
-public interface VFSFileServiceMBean extends ServiceModuleMBean {
-
- /**
- * File name in VFS
- */
- public void setFile(String file);
-
- public String getFile();
-
- /**
- * Content of the file
- */
- public void setContent(String content);
-
- public String getContent();
-
- /**
- * Fill with contents from this file.
- */
- public void setFilePath(String FilePath);
-
- public String getFilePath();
-
- /**
- * Find the file using standard classpath search mechanism.
- */
- public void setResourcePath(String ResourcePath);
-
- public String getResourcePath();
-
- /**
- * Load content from any valid URL.
- */
- public void setUrl(String url) throws java.net.MalformedURLException;
-
- public String getUrl();
-
-}
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSService.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSService.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSService.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,241 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-import org.apache.log4j.Logger;
-import org.jboss.fresh.vfs.*;
-import org.jboss.fresh.vfs.impl.DefaultVFS;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Properties;
-import java.lang.reflect.Constructor;
-
-/**
- * @author uros
- * @modified $Author: strukelj $
- * @version $Revision: 3554 $
- */
-public class VFSService extends RegistryNamingBinder implements VFSServiceMBean {
-
- // Attributes ----------------------------------------------------
- private String metaClassName;
- private String storeClassName;
- private String tagFactoryName;
- private String vfsImpl;
-
-
- private String metapropStr;
- private String storepropStr;
- private Properties metaProps;
- private Properties storeProps;
-
- private VFS vfs;
-
- private static Logger log = Logger.getLogger(VFSService.class);
-
- protected String getBindClass() {
- return VFS.class.getName();
- }
-
-
- protected Object classToInstance(Class c) {
-
- VFSMeta meta = null;
- VFSStore store = null;
- TagFactory tagfactory = null;
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class clazz = null;
-
- if (metaClassName != null) {
- try {
- clazz = cl.loadClass(metaClassName);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("No such class: " + metaClassName + " : " + e.toString());
- }
-
- try {
- meta = ((VFSMetaFactory) clazz.newInstance()).create(metaProps);
- } catch (InstantiationException e) {
- throw new RuntimeException("Could not instantiate class: " + clazz, e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("Not allowed to instantiate class: " + clazz, e);
- } catch (Exception ex) {
- throw new RuntimeException("Exception while instanciating: " + clazz, ex);
- }
-
- // bind meta class to naming so store can look it up
- // debilno - to moramo spremeniti
- /*
- try {
- RegistryContext ctx = new RegistryContext();
- try {
- ctx.createSubcontext("java:");
- } catch(NamingException ex) {
- }
-
- try {
- ctx.createSubcontext("java:/CP2");
- } catch(NamingException ex) {
- }
-
- ctx.bind("java:/CP2/VFSMeta", meta);
- } catch(Exception ex) {
- throw new RuntimeException("Failed to bind meta: ", ex);
- }
- */
- }
-
- if (storeClassName != null) {
- try {
- clazz = cl.loadClass(storeClassName);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("No such class: " + storeClassName + " : " + e.toString());
- }
-
- try {
- store = ((VFSStoreFactory) clazz.newInstance()).create(meta, storeProps);
- } catch (InstantiationException e) {
- throw new RuntimeException("Could not instantiate class: " + clazz, e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("Not allowed to instantiate class: " + clazz, e);
- } catch (Exception ex) {
- throw new RuntimeException("Exception while instanciating: " + clazz, ex);
- }
- }
-
- if (tagFactoryName != null) {
- try {
- clazz = cl.loadClass(tagFactoryName);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("No such class: " + tagFactoryName + " : " + e.toString());
- }
-
- try {
- tagfactory = (TagFactory) clazz.newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException("Could not instantiate class: " + clazz);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("Not allowed to instantiate class: " + clazz);
- }
- }
-
- if (vfsImpl != null) {
- try {
- clazz = cl.loadClass(vfsImpl);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("No such class: " + vfsImpl + " : " + e.toString());
- }
-
- try {
- Constructor cons = clazz.getConstructor(new Class[]{VFSMeta.class, VFSStore.class, TagFactory.class});
- vfs = (VFS) cons.newInstance(new Object[]{meta, store, tagfactory});
- } catch (InstantiationException e) {
- throw new RuntimeException("Could not instantiate class: " + clazz);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("Not allowed to instantiate class: " + clazz);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- //vfs = new CachedDefaultVFS( meta, store, tagfactory );
- //vfs = new DefaultVFS(meta, store, tagfactory);
- if (vfs == null) {
- log.warn("VFSImpl not specified. Using DefaultVFS");
- vfs = new DefaultVFS(meta, store, tagfactory);
- }
-
-
- setServiceObject(vfs);
-
- //return new VFSJMXProxy(getRegisteredName());
- return vfs;
- }
-
-
- protected boolean bindByReference() {
- return true;
- }
-
-
- public void setMetaClassFactory(String name) {
- log.info("setMetaClassFactory: " + name);
- metaClassName = name;
- }
-
-
- public void setStoreClassFactory(String name) {
- log.info("setStoreClassFactory: " + name);
- storeClassName = name;
- }
-
-
- public void setMetaPropertyString(String val) {
- log.info("setMetaPropertyString: " + val);
-
- Properties p = new Properties();
-
- try {
- p.load(new ByteArrayInputStream(val.getBytes()));
- } catch (IOException ex) {
- log.error("Could not load properties from StringInputStream.", ex);
- }
- metapropStr = val;
- metaProps = p;
- }
-
- public void setStorePropertyString(String val) {
- log.info("setStorePropertyString: " + val);
-
- Properties p = new Properties();
-
- try {
- p.load(new ByteArrayInputStream(val.getBytes()));
- } catch (IOException ex) {
- log.error("Could not load properties from StringInputStream.", ex);
- }
- storepropStr = val;
- storeProps = p;
- }
-
- public void setTagFactory(String val) {
- log.info("setTagFactory: " + val);
- tagFactoryName = val;
- }
-
- public void setVFSImpl(String name) {
- log.info("setVFSImpl: " + name);
- vfsImpl = name;
- }
-
- public String getName() {
- return "CP2 VFS Binder Service";
- }
-
-
- public String getMetaClassFactory() {
- return metaClassName;
- }
-
- public String getStoreClassFactory() {
- return storeClassName;
- }
-
- public String getMetaPropertyString() {
- return metapropStr;
- }
-
- public String getStorePropertyString() {
- return storepropStr;
- }
-
- public String getTagFactory() {
- return tagFactoryName;
- }
-
- public String getVFSImpl() {
- return vfsImpl;
- }
-}
-
Deleted: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSServiceMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/deployer/VFSServiceMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,29 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-public interface VFSServiceMBean extends RegistryNamingBinderMBean {
-
- public void setMetaClassFactory( String val );
-
- public String getMetaClassFactory();
-
- public void setStoreClassFactory( String val );
-
- public String getStoreClassFactory();
-
- public void setMetaPropertyString( String val );
-
- public String getMetaPropertyString();
-
- public void setStorePropertyString( String val );
-
- public String getStorePropertyString();
-
- public void setTagFactory( String val );
-
- public String getTagFactory();
-
- public void setVFSImpl( String name );
-
- public String getVFSImpl();
-}
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-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/commands/EventCentralQueryExe.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -71,9 +71,9 @@
}
- EventCentral ec = null;
+ EventCentral ec = getComponentByType(EventCentral.class);
- if (name != null) {
+ /*if (name != null) {
InitialContext ctx = new InitialContext();
try {
ec = (EventCentral) ctx.lookup(name);
@@ -88,7 +88,7 @@
} else {
Context ctx = getShell().getContext();
ec = (EventCentral) ctx.get("EventCentral");
- }
+ }*/
if(ec == null) {
error("Failed to locate EventCentral (make sure you specify EventCentral lookup name, or make sure instance is available in shell context under 'EventCentral')");
Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/ejb/UnremoterShell.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/ejb/UnremoterShell.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/ejb/UnremoterShell.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -477,4 +477,8 @@
}
return true;
}
+
+ public <T> T getComponentByType(Class<T> type) {
+ return null;
+ }
}
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-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -621,6 +621,7 @@
try {
actx = (Context) new InitialContext().lookup("java:/FRESH/GlobalContext");
} catch (Exception ex) {
+ //log.warn("Could not get context",ex);
}
//actx = getComponentByType(Context.class);
Modified: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHService.java
===================================================================
--- projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHService.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHService.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,19 +1,19 @@
package org.jboss.fresh.deployer;
import org.jboss.beans.metadata.api.annotations.Create;
+import org.jboss.beans.metadata.api.annotations.Stop;
import org.jboss.fresh.shell.SystemShell;
import org.jboss.fresh.ssh.DaemonStarter;
import org.jboss.logging.Logger;
public class SSHService {
- private static final Logger log = Logger.getLogger(SSHService.class);
- private Thread th = null;
- private String home;
- private SystemShell systemShell;
+ private static final Logger log = Logger.getLogger(SSHService.class);
+ private Thread th = null;
+ private String home;
+ private SystemShell systemShell;
-
public SystemShell getSystemShell() {
return systemShell;
}
@@ -24,29 +24,30 @@
@Create
- public void doStart() {
- th = new Thread() {
- public void run() {
- //System.setProperty("sshtools.home", home);
- //com.sshtools.j2ssh.SshServer.main(new String [] {"-start"});
- try {
- DaemonStarter.setConfigDir(home);
- DaemonStarter.setSystemShell(systemShell);
- DaemonStarter.initialize();
- } catch (Exception ex) {
- log.error("could not start ssh service",ex);
- }
- }
- };
- th.start();
- }
+ public void doStart() {
+ th = new Thread() {
+ public void run() {
+ //System.setProperty("sshtools.home", home);
+ //com.sshtools.j2ssh.SshServer.main(new String [] {"-start"});
+ try {
+ DaemonStarter.setConfigDir(home);
+ DaemonStarter.setSystemShell(systemShell);
+ DaemonStarter.initialize();
+ } catch (Exception ex) {
+ log.error("could not start ssh service", ex);
+ }
+ }
+ };
+ th.start();
+ }
- public void doStop() {
- try {
- DaemonStarter.stop("Stop command issued");
- } catch (java.io.IOException ex) {
- throw new RuntimeException(ex);
- }
- }
+ @Stop
+ public void doStop() {
+ try {
+ DaemonStarter.stop("Stop command issued");
+ } catch (java.io.IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
}
Deleted: projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHServiceMBean.java
===================================================================
--- projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHServiceMBean.java 2009-11-23 22:29:15 UTC (rev 96764)
+++ projects/fresh/trunk/fresh-ssh/src/main/java/org/jboss/fresh/deployer/SSHServiceMBean.java 2009-11-23 22:44:34 UTC (rev 96765)
@@ -1,14 +0,0 @@
-package org.jboss.fresh.deployer;
-
-
-public interface SSHServiceMBean extends ServiceModuleMBean {
-
- public void setHomeDirectory(String home);
- public String getHomeDirectory();
-
- public void setSystemShellJNDI(String name);
- public String getSystemShellJNDI();
-
-}
-
-
More information about the jboss-cvs-commits
mailing list