Class Main
- java.lang.Object
-
- org.apache.karaf.shell.impl.console.standalone.Main
-
public class Main extends Object
-
-
Constructor Summary
Constructors Constructor Description Main()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Session
createSession(SessionFactory sessionFactory, InputStream in, PrintStream out, PrintStream err, Terminal terminal)
Allow sub classes of main to change the ConsoleImpl implementation used.protected SessionFactory
createSessionFactory(org.apache.felix.service.threadio.ThreadIO threadio)
protected void
discoverCommands(Session session, ClassLoader cl, String resource)
String
getApplication()
String
getDiscoveryResource()
Sub classes can override so that their registered commands do not conflict with the default shell implementation.String
getUser()
boolean
isMultiScopeMode()
Returns whether or not we are in multi-scope mode.static void
main(String[] args)
void
run(String[] args)
Use this method when the shell is being executed as a top level shell.void
setApplication(String application)
void
setUser(String user)
-
-
-
Method Detail
-
run
public void run(String[] args) throws Exception
Use this method when the shell is being executed as a top level shell.- Parameters:
args
- the arguments.- Throws:
Exception
- in case of a failure.
-
createSession
protected Session createSession(SessionFactory sessionFactory, InputStream in, PrintStream out, PrintStream err, Terminal terminal) throws Exception
Allow sub classes of main to change the ConsoleImpl implementation used.- Parameters:
sessionFactory
- the session factory.in
- the input stream (console std in).out
- the output stream (console std out).err
- the error stream (console std err).terminal
- the terminal.- Returns:
- the created session.
- Throws:
Exception
- if something goes wrong during session creation.
-
createSessionFactory
protected SessionFactory createSessionFactory(org.apache.felix.service.threadio.ThreadIO threadio)
-
getDiscoveryResource
public String getDiscoveryResource()
Sub classes can override so that their registered commands do not conflict with the default shell implementation.- Returns:
- the location of the discovery resource.
-
discoverCommands
protected void discoverCommands(Session session, ClassLoader cl, String resource) throws IOException, ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
-
getApplication
public String getApplication()
-
setApplication
public void setApplication(String application)
-
getUser
public String getUser()
-
setUser
public void setUser(String user)
-
isMultiScopeMode
public boolean isMultiScopeMode()
Returns whether or not we are in multi-scope mode.
The default mode is multi-scoped where we prefix commands by their scope. If we are in single scoped mode then we don't use scope prefixes when registering or tab completing commands.
- Returns:
- true if the console is multi-scope, false else.
-
-