Package org.alfresco.repo.admin
Class BaseInterpreter
- java.lang.Object
-
- org.springframework.extensions.surf.util.AbstractLifecycleBean
-
- org.alfresco.repo.admin.BaseInterpreter
-
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener
- Direct Known Subclasses:
RepoAdminInterpreter,TenantInterpreter,WorkflowInterpreter
public abstract class BaseInterpreter extends org.springframework.extensions.surf.util.AbstractLifecycleBeanAn interactive console
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorityServiceauthorityServiceprotected StringlastCommandLast command issuedprotected TransactionServicetransactionService
-
Constructor Summary
Constructors Constructor Description BaseInterpreter()Make up a new console.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract StringexecuteCommand(String line)Execute a single command using the BufferedReader passed in for any data needed.static BaseInterpretergetConsoleBean(org.springframework.context.ApplicationContext context, String beanName)StringgetCurrentUserName()Get current user nameprotected booleanhasAuthority(String username)StringinterpretCommand(String line)Interpret a single command using the BufferedReader passed in for any data needed.protected voidonBootstrap(org.springframework.context.ApplicationEvent event)protected voidonShutdown(org.springframework.context.ApplicationEvent event)voidrep()A Read-Eval-Print loop.static voidrunMain(String beanName)static voidrunMain(org.springframework.context.ApplicationContext context, String beanName)voidsetAuthorityService(AuthorityService authorityService)voidsetCurrentUserName(String username)voidsetTransactionService(TransactionService transactionService)
-
-
-
Field Detail
-
transactionService
protected TransactionService transactionService
-
authorityService
protected AuthorityService authorityService
-
lastCommand
protected String lastCommand
Last command issued
-
-
Method Detail
-
runMain
public static void runMain(String beanName)
-
runMain
public static void runMain(org.springframework.context.ApplicationContext context, String beanName)
-
getConsoleBean
public static BaseInterpreter getConsoleBean(org.springframework.context.ApplicationContext context, String beanName)
-
setTransactionService
public void setTransactionService(TransactionService transactionService)
-
setAuthorityService
public void setAuthorityService(AuthorityService authorityService)
-
rep
public void rep()
A Read-Eval-Print loop.
-
interpretCommand
public String interpretCommand(String line) throws IOException
Interpret a single command using the BufferedReader passed in for any data needed.- Parameters:
line- The unparsed command- Returns:
- The textual output of the command.
- Throws:
IOException
-
hasAuthority
protected boolean hasAuthority(String username)
-
executeCommand
protected abstract String executeCommand(String line) throws IOException
Execute a single command using the BufferedReader passed in for any data needed. TODO: Use decent parser!- Parameters:
line- The unparsed command- Returns:
- The textual output of the command.
- Throws:
IOException
-
getCurrentUserName
public String getCurrentUserName()
Get current user name- Returns:
- user name
-
setCurrentUserName
public void setCurrentUserName(String username)
-
onBootstrap
protected void onBootstrap(org.springframework.context.ApplicationEvent event)
- Specified by:
onBootstrapin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
onShutdown
protected void onShutdown(org.springframework.context.ApplicationEvent event)
- Specified by:
onShutdownin classorg.springframework.extensions.surf.util.AbstractLifecycleBean
-
-