[jboss-cvs] JBossAS SVN: r96768 - projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 23 18:32:19 EST 2009
Author: alesj
Date: 2009-11-23 18:32:19 -0500 (Mon, 23 Nov 2009)
New Revision: 96768
Modified:
projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/LazySystemShellImpl.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
Log:
Integrate type lookup with MC.
Modified: projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/LazySystemShellImpl.java
===================================================================
--- projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/LazySystemShellImpl.java 2009-11-23 23:29:12 UTC (rev 96767)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/LazySystemShellImpl.java 2009-11-23 23:32:19 UTC (rev 96768)
@@ -8,7 +8,6 @@
import org.jboss.dependency.spi.ControllerState;
import org.jboss.fresh.shell.Shell;
import org.jboss.fresh.vfs.UserCtx;
-import org.jboss.fresh.vfs.VFS;
public class LazySystemShellImpl extends SystemShellImpl
{
@@ -23,7 +22,7 @@
}
@Override
- public Shell startSession(UserCtx uctx, boolean interactive)
+ public Shell startSession(UserCtx uctx, boolean interactive, Controller c)
{
if (initialized.getAndSet(true) == false && onDemandBeans != null)
{
@@ -43,6 +42,6 @@
}
}
}
- return super.startSession(uctx, interactive);
+ return super.startSession(uctx, interactive, this.controller);
}
}
\ No newline at end of file
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 23:29:12 UTC (rev 96767)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/ShellImpl.java 2009-11-23 23:32:19 UTC (rev 96768)
@@ -1,11 +1,50 @@
package org.jboss.fresh.shell.impl;
+import java.io.ByteArrayInputStream;
+import java.io.EOFException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.naming.InitialContext;
+
import org.apache.log4j.Logger;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.fresh.ctx.Context;
import org.jboss.fresh.events.EventBroadcaster;
import org.jboss.fresh.events.EventCentral;
-import org.jboss.fresh.io.*;
-import org.jboss.fresh.shell.*;
+import org.jboss.fresh.io.Buffer;
+import org.jboss.fresh.io.BufferImpl;
+import org.jboss.fresh.io.BufferObjectReader;
+import org.jboss.fresh.io.InBuffer;
+import org.jboss.fresh.io.InputStreamBuffer;
+import org.jboss.fresh.io.MemFileBufferImpl;
+import org.jboss.fresh.io.MultiBufferObjectReader;
+import org.jboss.fresh.io.NullBuffer;
+import org.jboss.fresh.io.OutBuffer;
+import org.jboss.fresh.io.OutputStreamBuffer;
+import org.jboss.fresh.shell.EnvProperties;
+import org.jboss.fresh.shell.Executable;
+import org.jboss.fresh.shell.ExecutableRegistry;
+import org.jboss.fresh.shell.NoSuchProcessException;
+import org.jboss.fresh.shell.ProcessInfo;
+import org.jboss.fresh.shell.SessionTimeoutException;
+import org.jboss.fresh.shell.Shell;
+import org.jboss.fresh.shell.ShellException;
+import org.jboss.fresh.shell.ShellIOException;
+import org.jboss.fresh.shell.SystemShell;
import org.jboss.fresh.shell.events.ShellEvent;
import org.jboss.fresh.shell.events.ShellEventBroadcaster;
import org.jboss.fresh.shell.parser.Cmd;
@@ -21,15 +60,6 @@
import org.jboss.fresh.vfs.impl.SecureVFS;
import org.jboss.fresh.vfs.impl.VFSInputStream;
-import javax.naming.InitialContext;
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
/**
* @todo We need to clearly say that we are out of threads when we are out of threads.
*/
@@ -107,6 +137,7 @@
private static final Logger log = Logger.getLogger("org.jboss.fresh.shell.impl.ShellImpl");
private static final Logger cmdlog = Logger.getLogger("org.jboss.fresh.shell.impl.ShellImpl.CMD");
+ private Controller controller;
private EventBroadcaster eb;
private EventCentral ec;
@@ -121,12 +152,13 @@
// SysShell assigned shell session id
- public ShellImpl(String id, boolean interactive, SystemShellImpl sysshell, UserCtx uctx, VFS vfs) {
+ public ShellImpl(String id, boolean interactive, SystemShellImpl sysshell, UserCtx uctx, VFS vfs, Controller controller) {
this.interactive = interactive;
uid = id;
this.uctx = uctx;
sshell = sysshell;
this.vfs = vfs;
+ this.controller = controller;
props = new EnvProperties(System.getProperties());
// I don't really see when shellin would be of any use.
//shellin=new BufferImpl();
@@ -1912,6 +1944,11 @@
}
public <T>T getComponentByType(Class<T> type){
- throw new RuntimeException("MC Magick should happen here...");
+
+ if (controller == null)
+ return null;
+
+ ControllerContext context = controller.getInstalledContext(type);
+ return type.cast(context.getTarget());
}
}
\ No newline at end of file
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-11-23 23:29:12 UTC (rev 96767)
+++ projects/fresh/trunk/fresh-shell/src/main/java/org/jboss/fresh/shell/impl/SystemShellImpl.java 2009-11-23 23:32:19 UTC (rev 96768)
@@ -1,13 +1,24 @@
package org.jboss.fresh.shell.impl;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+
import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.fresh.shell.*;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.fresh.shell.EnvProperties;
+import org.jboss.fresh.shell.ExecutableRegistry;
+import org.jboss.fresh.shell.Shell;
+import org.jboss.fresh.shell.ShellException;
+import org.jboss.fresh.shell.SystemShell;
import org.jboss.fresh.vfs.UserCtx;
import org.jboss.fresh.vfs.VFS;
import org.jboss.util.threadpool.ThreadPool;
-import java.util.*;
-
/**
* // This class is a server. It has a set of Shell instances.
* // These instances have to timeout if inactive.
@@ -105,12 +116,16 @@
}
public Shell startSession(UserCtx uctx, boolean interactive) {
+ return startSession(uctx, interactive, null);
+ }
+
+ public Shell startSession(UserCtx uctx, boolean interactive, Controller controller) {
// create new shell object
// assign id to it
// assign uctx to it
String id = newID();
VFS vfs = getVFS();
- ShellImpl shell = new ShellImpl(id, interactive, this, uctx, vfs);
+ ShellImpl shell = new ShellImpl(id, interactive, this, uctx, vfs, controller);
shell.setRegistry(registry);
// put it in shellmap
More information about the jboss-cvs-commits
mailing list