Package org.apache.felix.gogo.commands

Examples of org.apache.felix.gogo.commands.Action


            for (int i = 0, size = arguments.size(); i < size; i++) {
                Completer argCompleter = NullCompleter.INSTANCE;
                Method method = methods.get(i);
                if (method != null) {
                    // lets invoke the method
                    Action action = function.createNewAction();
                    try {
                        Object value = method.invoke(action);
                        if (value instanceof String[]) {
                            argCompleter = new StringsCompleter((String[]) value);
                        } else if (value instanceof Collection) {
View Full Code Here


            return blueprintConverter.convert(o, new GenericType(type));
        }
    }

    protected Action createNewAction() throws Exception {
        Action action = (Action) blueprintContainer.getComponentInstance(actionId);
        if (action instanceof BlueprintContainerAware) {
            ((BlueprintContainerAware) action).setBlueprintContainer(blueprintContainer);
        }
        if (action instanceof BundleContextAware) {
            BundleContext context = (BundleContext) blueprintContainer.getComponentInstance("blueprintBundleContext");
View Full Code Here

        }
    }

    @Override
    public Action createNewAction() {
        Action action = (Action) blueprintContainer.getComponentInstance(actionId);
        if (action instanceof BlueprintContainerAware) {
            ((BlueprintContainerAware) action).setBlueprintContainer(blueprintContainer);
        }
        if (action instanceof BundleContextAware) {
            BundleContext context = (BundleContext) blueprintContainer.getComponentInstance("blueprintBundleContext");
View Full Code Here

import org.osgi.service.command.Function;

public abstract class AbstractCommand implements Function {

    public Object execute(CommandSession session, List<Object> arguments) throws Exception {
        Action action = createNewAction();
        try {
            if (getPreparator().prepare(action, session, arguments)) {
                return action.execute(session);
            } else {
                return null;
            }
        } finally {
          releaseAction(action);
View Full Code Here

        }

        public String printHelp(String format, boolean includeHelpOption) throws Exception {
            PrintStream oldout = System.out;
            try {
                Action action = actionClass.newInstance();
                CommandSession session = new DummyCommandSession();
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                PrintStream newout = new PrintStream(baos);
                System.setOut(newout);
                ActionPreparator preparator;
View Full Code Here

            function = unProxy(function);
            if (function instanceof AbstractCommand) {
                try {
                    Method mth = AbstractCommand.class.getDeclaredMethod("createNewAction");
                    mth.setAccessible(true);
                    Action action = (Action) mth.invoke(function);
                    Class<? extends Action> clazz = action.getClass();
                    Command ann = clazz.getAnnotation(Command.class);
                    description = ann.description();
                } catch (Throwable e) {
                }
                if (name.startsWith("*:")) {
View Full Code Here

        }

    }

    public Action createNewAction() {
        Action action = (Action) blueprintContainer.getComponentInstance(actionId);
        if (action instanceof BlueprintContainerAware) {
            ((BlueprintContainerAware) action).setBlueprintContainer(blueprintContainer);
        }
        if (action instanceof BundleContextAware) {
            BundleContext context = (BundleContext) blueprintContainer.getComponentInstance("blueprintBundleContext");
View Full Code Here

            for (int i = 0, size = arguments.size(); i < size; i++) {
                Completer argCompleter = NullCompleter.INSTANCE;
                Method method = methods.get(i);
                if (method != null) {
                    // lets invoke the method
                    Action action = function.createNewAction();
                    try {
                        Object value = method.invoke(action);
                        if (value instanceof String[]) {
                            argCompleter = new StringsCompleter((String[]) value);
                        } else if (value instanceof Collection) {
View Full Code Here

                    function = unProxy(function);
                    if (function instanceof AbstractCommand) {
                        try {
                            Method mth = AbstractCommand.class.getDeclaredMethod("createNewAction");
                            mth.setAccessible(true);
                            Action action = (Action) mth.invoke(function);
                            Class<? extends Action> clazz = action.getClass();
                            Command ann = clazz.getAnnotation(Command.class);
                            description = ann.description();
                        } catch (Throwable e) {
                        }
                        if (name.startsWith("*:")) {
View Full Code Here

            for (int i = 0, size = arguments.size(); i < size; i++) {
                Completer argCompleter = NullCompleter.INSTANCE;
                Method method = methods.get(i);
                if (method != null) {
                    // lets invoke the method
                    Action action = function.createNewAction();
                    try {
                        Object value = method.invoke(action);
                        if (value instanceof String[]) {
                            argCompleter = new StringsCompleter((String[]) value);
                        } else if (value instanceof Collection) {
View Full Code Here

TOP

Related Classes of org.apache.felix.gogo.commands.Action

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.