Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.shell
Class CommandLineService

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.shell.CommandLineService
All Implemented Interfaces:
java.util.EventListener, Adaptable, Component, Extensible, org.osgi.framework.FrameworkListener

public class CommandLineService
extends DefaultComponent
implements org.osgi.framework.FrameworkListener

Author:
Bogdan Stefanescu

Field Summary
static ComponentName NAME
           
 
Constructor Summary
CommandLineService()
           
 
Method Summary
 void activate(ComponentContext context)
          Activates the component.
 void addCommand(CommandDescriptor cmd)
           
 void addCommandOption(CommandOption arg)
           
 void deactivate(ComponentContext context)
          Deactivates the component.
 void frameworkEvent(org.osgi.framework.FrameworkEvent event)
           
 CommandDescriptor getCommand(java.lang.String name)
           
 CommandContext getCommandContext()
           
 java.lang.String[] getCommandNames()
           
 CommandOption getCommandOption(java.lang.String name)
           
 CommandOption[] getCommandOptions()
           
 CommandDescriptor[] getCommands()
           
 CommandDescriptor[] getMatchingCommands(java.lang.String prefix)
           
 CommandDescriptor[] getSortedCommands()
           
 CommandLine parse(java.lang.String[] args, boolean validate)
           
 void registerContribution(java.lang.Object contribution, java.lang.String extensionPoint, ComponentInstance contributor)
           
 void reload()
          Reloads script commands
 void removeCommand(java.lang.String name)
           
 void removeCommandOption(CommandOption arg)
           
 void runCommand(CommandDescriptor cd, CommandLine cmdLine)
           
 void unregisterContribution(java.lang.Object contribution, java.lang.String extensionPoint, ComponentInstance contributor)
           
 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
getAdapter, registerExtension, unregisterExtension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final ComponentName NAME
Constructor Detail

CommandLineService

public CommandLineService()
Method Detail

activate

public void activate(ComponentContext context)
              throws java.lang.Exception
Description copied from interface: Component
Activates the component.

This method is called by the runtime when a component is activated.

Specified by:
activate in interface Component
Overrides:
activate in class DefaultComponent
Parameters:
context - the runtime context
Throws:
java.lang.Exception - if an error occurs during activation

reload

public void reload()
Reloads script commands


deactivate

public void deactivate(ComponentContext context)
                throws java.lang.Exception
Description copied from interface: Component
Deactivates the component.

This method is called by the runtime when a component is deactivated.

Specified by:
deactivate in interface Component
Overrides:
deactivate in class DefaultComponent
Parameters:
context - the runtime context
Throws:
java.lang.Exception - if an error occurs during activation

registerContribution

public void registerContribution(java.lang.Object contribution,
                                 java.lang.String extensionPoint,
                                 ComponentInstance contributor)
Overrides:
registerContribution in class DefaultComponent

unregisterContribution

public void unregisterContribution(java.lang.Object contribution,
                                   java.lang.String extensionPoint,
                                   ComponentInstance contributor)
Overrides:
unregisterContribution in class DefaultComponent

getCommand

public CommandDescriptor getCommand(java.lang.String name)

addCommand

public void addCommand(CommandDescriptor cmd)

removeCommand

public void removeCommand(java.lang.String name)

getCommands

public CommandDescriptor[] getCommands()

getCommandNames

public java.lang.String[] getCommandNames()

getSortedCommands

public CommandDescriptor[] getSortedCommands()

getMatchingCommands

public CommandDescriptor[] getMatchingCommands(java.lang.String prefix)

getCommandOption

public CommandOption getCommandOption(java.lang.String name)

getCommandOptions

public CommandOption[] getCommandOptions()

addCommandOption

public void addCommandOption(CommandOption arg)

removeCommandOption

public void removeCommandOption(CommandOption arg)

getCommandContext

public CommandContext getCommandContext()

parse

public CommandLine parse(java.lang.String[] args,
                         boolean validate)
                  throws java.text.ParseException
Parameters:
args - the arguments as passed on the command line by a user, the first argument needs to be a command, if none is found the "interactive" command is assumed.
validate - specifies whether errors in parsing or in the passed arguments and options should throw ParseException
Returns:
a CommandLine initialized object
Throws:
java.text.ParseException

runCommand

public void runCommand(CommandDescriptor cd,
                       CommandLine cmdLine)
                throws java.lang.Exception
Throws:
java.lang.Exception

frameworkEvent

public void frameworkEvent(org.osgi.framework.FrameworkEvent event)
Specified by:
frameworkEvent in interface org.osgi.framework.FrameworkListener

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.