Examples of Executable


Examples of org.hpi.dialogue.protocol.entities.Executable

    invoker.setDescription(root.getLeaf(HPIConstants.DESCRIPTION_INVOKER_FILE).getValue());
   
    SSDObjectArray ssdExecutables = root.getArray(HPIConstants.EXECUTABLES_INVOKER_FILE);
    for (int i = 0; i < ssdExecutables.getSize(); i++) {
      SSDObjectNode ssdExecutable = ssdExecutables.getNode(i);;
      Executable executable = new Executable();
      executable.setCanonicalPath(ssdExecutable.getLeaf(HPIConstants.CANONICAL_PATH_INVOKER_FILE).getValue());
     
      SSDObjectArray ssdParameters = ssdExecutable.getArray(HPIConstants.PARAMETERS_INVOKER_FILE);
      for (int j = 0; j < ssdParameters.getSize(); j++) {
        SSDObjectNode ssdParameter = ssdParameters.getNode(j);
        Parameter parameter = new Parameter();
        parameter.setKey(ssdParameter.getLeaf(HPIConstants.KEY_INVOKER_FILE).getValue());
        parameter.setValue(ssdParameter.getLeaf(HPIConstants.VALUE_INVOKER_FILE).getValue());
        executable.getParameters().add(parameter);
      }
      invoker.getExecutables().add(executable);
    }
   
    HPIDataFactory.getInstance().addInvoker(invoker);
View Full Code Here

Examples of org.jboss.fresh.shell.Executable

                if (clazz == null) throw new ShellException("No Class attribute specified. (" + command + ")");
                command = clazz;
            }


            Executable exe = getInternal(command);
            if (exe != null) return exe;

        } catch (ShellException ex) {

            log.error(ex.getMessage(), ex);

            Executable exe = getInternal(command);
            if (exe != null) return exe;

            throw ex;

        } catch (VFSException ex) {
            log.error(ex.getMessage(), ex);
            throw new ShellException(ex.toString());
        }
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        Class execls = null;
        try {
            execls = cl.loadClass(command);
        } catch (ClassNotFoundException e) {
            throw new BadCommandException("Unknown command.", command);
        }

        Executable exe;
        try {
            exe = (Executable) execls.newInstance();
        } catch (InstantiationException e) {
            throw new ShellException("Could not instantiate class: " + execls);
        } catch (IllegalAccessException e) {
            throw new ShellException("Not allowed to instantiate class: " + execls);
        }

        exe.setFileInfo(inf);

        return exe;
    }
View Full Code Here

Examples of org.jvnet.hudson.reactor.Executable

            builder = new TaskGraphBuilder() {
                List<File> archives;
                Collection<String> bundledPlugins;

                {
                    Handle loadBundledPlugins = add("Loading bundled plugins", new Executable() {
                        public void run(Reactor session) throws Exception {
                            bundledPlugins = loadBundledPlugins();
                        }
                    });

                    Handle listUpPlugins = requires(loadBundledPlugins).add("Listing up plugins", new Executable() {
                        public void run(Reactor session) throws Exception {
                            archives = initStrategy.listPluginArchives(PluginManager.this);
                        }
                    });

                    requires(listUpPlugins).attains(PLUGINS_LISTED).add("Preparing plugins",new Executable() {
                        public void run(Reactor session) throws Exception {
                            // once we've listed plugins, we can fill in the reactor with plugin-specific initialization tasks
                            TaskGraphBuilder g = new TaskGraphBuilder();

                            final Map<String,File> inspectedShortNames = new HashMap<String,File>();

                            for( final File arc : archives ) {
                                g.followedBy().notFatal().attains(PLUGINS_LISTED).add("Inspecting plugin " + arc, new Executable() {
                                    public void run(Reactor session1) throws Exception {
                                        try {
                                            PluginWrapper p = strategy.createPluginWrapper(arc);
                                            if (isDuplicate(p)) return;

                                            p.isBundled = containsHpiJpi(bundledPlugins, arc.getName());
                                            plugins.add(p);
                                        } catch (IOException e) {
                                            failedPlugins.add(new FailedPlugin(arc.getName(),e));
                                            throw e;
                                        }
                                    }

                                    /**
                                     * Inspects duplication. this happens when you run hpi:run on a bundled plugin,
                                     * as well as putting numbered jpi files, like "cobertura-1.0.jpi" and "cobertura-1.1.jpi"
                                     */
                                    private boolean isDuplicate(PluginWrapper p) {
                                        String shortName = p.getShortName();
                                        if (inspectedShortNames.containsKey(shortName)) {
                                            LOGGER.info("Ignoring "+arc+" because "+inspectedShortNames.get(shortName)+" is already loaded");
                                            return true;
                                        }

                                        inspectedShortNames.put(shortName,arc);
                                        return false;
                                    }
                                });
                            }

                            g.followedBy().attains(PLUGINS_LISTED).add("Checking cyclic dependencies", new Executable() {
                                /**
                                 * Makes sure there's no cycle in dependencies.
                                 */
                                public void run(Reactor reactor) throws Exception {
                                    try {
                                        CyclicGraphDetector<PluginWrapper> cgd = new CyclicGraphDetector<PluginWrapper>() {
                                            @Override
                                            protected List<PluginWrapper> getEdges(PluginWrapper p) {
                                                List<PluginWrapper> next = new ArrayList<PluginWrapper>();
                                                addTo(p.getDependencies(), next);
                                                addTo(p.getOptionalDependencies(), next);
                                                return next;
                                            }

                                            private void addTo(List<Dependency> dependencies, List<PluginWrapper> r) {
                                                for (Dependency d : dependencies) {
                                                    PluginWrapper p = getPlugin(d.shortName);
                                                    if (p != null)
                                                        r.add(p);
                                                }
                                            }
                                           
                                            @Override
                                            protected void reactOnCycle(PluginWrapper q, List<PluginWrapper> cycle)
                                                    throws hudson.util.CyclicGraphDetector.CycleDetectedException {
                                               
                                                LOGGER.log(Level.SEVERE, "found cycle in plugin dependencies: (root="+q+", deactivating all involved) "+Util.join(cycle," -> "));
                                                for (PluginWrapper pluginWrapper : cycle) {
                                                    pluginWrapper.setHasCycleDependency(true);
                                                    failedPlugins.add(new FailedPlugin(pluginWrapper.getShortName(), new CycleDetectedException(cycle)));
                                                }
                                            }
                                           
                                        };
                                        cgd.run(getPlugins());

                                        // obtain topologically sorted list and overwrite the list
                                        ListIterator<PluginWrapper> litr = plugins.listIterator();
                                        for (PluginWrapper p : cgd.getSorted()) {
                                            litr.next();
                                            litr.set(p);
                                            if(p.isActive())
                                                activePlugins.add(p);
                                        }
                                    } catch (CycleDetectedException e) {
                                        stop(); // disable all plugins since classloading from them can lead to StackOverflow
                                        throw e;    // let Hudson fail
                                    }
                                }
                            });

                            session.addAll(g.discoverTasks(session));

                            pluginListed = true; // technically speaking this is still too early, as at this point tasks are merely scheduled, not necessarily executed.
                        }
                    });
                }
            };
        } else {
            builder = TaskBuilder.EMPTY_BUILDER;
        }

        final InitializerFinder initializerFinder = new InitializerFinder(uberClassLoader);        // misc. stuff

        // lists up initialization tasks about loading plugins.
        return TaskBuilder.union(initializerFinder, // this scans @Initializer in the core once
            builder,new TaskGraphBuilder() {{
            requires(PLUGINS_LISTED).attains(PLUGINS_PREPARED).add("Loading plugins",new Executable() {
                /**
                 * Once the plugins are listed, schedule their initialization.
                 */
                public void run(Reactor session) throws Exception {
                    Jenkins.getInstance().lookup.set(PluginInstanceStore.class,new PluginInstanceStore());
                    TaskGraphBuilder g = new TaskGraphBuilder();

                    // schedule execution of loading plugins
                    for (final PluginWrapper p : activePlugins.toArray(new PluginWrapper[activePlugins.size()])) {
                        g.followedBy().notFatal().attains(PLUGINS_PREPARED).add("Loading plugin " + p.getShortName(), new Executable() {
                            public void run(Reactor session) throws Exception {
                                try {
                                    p.resolvePluginDependencies();
                                    strategy.load(p);
                                } catch (IOException e) {
                                    failedPlugins.add(new FailedPlugin(p.getShortName(), e));
                                    activePlugins.remove(p);
                                    plugins.remove(p);
                                    throw e;
                                }
                            }
                        });
                    }

                    // schedule execution of initializing plugins
                    for (final PluginWrapper p : activePlugins.toArray(new PluginWrapper[activePlugins.size()])) {
                        g.followedBy().notFatal().attains(PLUGINS_STARTED).add("Initializing plugin " + p.getShortName(), new Executable() {
                            public void run(Reactor session) throws Exception {
                                try {
                                    p.getPlugin().postInitialize();
                                } catch (Exception e) {
                                    failedPlugins.add(new FailedPlugin(p.getShortName(), e));
                                    activePlugins.remove(p);
                                    plugins.remove(p);
                                    throw e;
                                }
                            }
                        });
                    }

                    g.followedBy().attains(PLUGINS_STARTED).add("Discovering plugin initialization tasks", new Executable() {
                        public void run(Reactor reactor) throws Exception {
                            // rescan to find plugin-contributed @Initializer
                            reactor.addAll(initializerFinder.discoverTasks(reactor));
                        }
                    });
View Full Code Here

Examples of org.jvnet.hudson.reactor.Executable

                return child.isDirectory() && Items.getConfigFile(child).exists();
            }
        });

        TaskGraphBuilder g = new TaskGraphBuilder();
        Handle loadHudson = g.requires(EXTENSIONS_AUGMENTED).attains(JOB_LOADED).add("Loading global config", new Executable() {
            public void run(Reactor session) throws Exception {
                // JENKINS-8043: some slaves (eg. swarm slaves) are not saved into the config file
                // and will get overwritten when reloading. Make a backup copy now, and re-add them later
                NodeList oldSlaves = slaves;
               
                XmlFile cfg = getConfigFile();
                if (cfg.exists()) {
                    // reset some data that may not exist in the disk file
                    // so that we can take a proper compensation action later.
                    primaryView = null;
                    views.clear();

                    // load from disk
                    cfg.unmarshal(Jenkins.this);
                }

                // if we are loading old data that doesn't have this field
                if (slaves == null) slaves = new NodeList();

                clouds.setOwner(Jenkins.this);
                items.clear();

                // JENKINS-8043: re-add the slaves which were not saved into the config file
                // and are now missing, but still connected.
                if (oldSlaves != null) {
                    ArrayList<Node> newSlaves = new ArrayList<Node>(slaves);
                    for (Node n: oldSlaves) {
                        if (n instanceof EphemeralNode) {
                            if(!newSlaves.contains(n)) {
                                newSlaves.add(n);
                            }
                        }
                    }
                    setNodes(newSlaves);
                }
            }
        });

        for (final File subdir : subdirs) {
            g.requires(loadHudson).attains(JOB_LOADED).notFatal().add("Loading job "+subdir.getName(),new Executable() {
                public void run(Reactor session) throws Exception {
                    TopLevelItem item = (TopLevelItem) Items.load(Jenkins.this, subdir);
                    items.put(item.getName(), item);
                }
            });
        }

        g.requires(JOB_LOADED).add("Finalizing set up",new Executable() {
            public void run(Reactor session) throws Exception {
                rebuildDependencyGraph();

                {// recompute label objects - populates the labels mapping.
                    for (Node slave : slaves)
View Full Code Here

Examples of org.openqa.selenium.firefox.internal.Executable

  public FirefoxBinary() {
    this(null);
  }

  public FirefoxBinary(File pathToFirefoxBinary) {
    executable = new Executable(pathToFirefoxBinary);
  }
View Full Code Here

Examples of org.pdf4j.saxon.instruct.Executable

     * @param visitor an ExpressionVisitor
     */

    public void refineVariableType(
            ItemType type, int cardinality, Value constantValue, int properties, ExpressionVisitor visitor) {
        Executable exec = visitor.getExecutable();
        if (exec == null) {
            // happens during use-when evaluation
            return;
        }
        TypeHierarchy th = exec.getConfiguration().getTypeHierarchy();
        ItemType oldItemType = getItemType(th);
        ItemType newItemType = oldItemType;
        if (th.isSubType(type, oldItemType)) {
            newItemType = type;
        }
View Full Code Here

Examples of org.soybeanMilk.core.Executable

       
        if(children != null)
        {
          for(Element e : children)
          {
            Executable executable=createExecutableInstance(e.getTagName());
           
            if(executable instanceof Action)
              setActionProperties((Action)executable,e);
            else
              setInvokeProperties((Invoke)executable,e, true);
View Full Code Here

Examples of org.soybeanMilk.core.Executable

        if(actionExes==null)
          continue;
       
        for(int i=0,len=actionExes.size();i<len;i++)
        {
          Executable e=actionExes.get(i);
         
          if(e instanceof ExecutableRefProxy)
          {
            ExecutableRefProxy proxy=((ExecutableRefProxy)e);
            Executable targetExe=getTargetRefExecutable((ExecutableRefProxy)e);
           
            if(targetExe == null)
              throw new ParseException("can not find Executable named "+SbmUtils.toString(proxy.getRefName())+" referenced in Action "+SbmUtils.toString(action.getName()));
           
            actionExes.set(i, targetExe);
View Full Code Here

Examples of org.soybeanMilk.core.Executable

    Interceptor ii=getConfiguration().getInterceptor();
    if(ii == null)
      return;
   
    {
      Executable before=ii.getBefore();
      if(before instanceof ExecutableRefProxy)
      {
        Executable targetExe=getTargetRefExecutable((ExecutableRefProxy)before);
        if(targetExe == null)
          throw new ParseException("can not find 'before' interceptor named "+SbmUtils.toString(((ExecutableRefProxy)before).getRefName()));
       
        ii.setBefore(targetExe);
      }
    }
   
    {
      Executable after=ii.getAfter();
      if(after instanceof ExecutableRefProxy)
      {
        Executable targetExe=getTargetRefExecutable((ExecutableRefProxy)after);
        if(targetExe == null)
          throw new ParseException("can not find 'after' interceptor named "+SbmUtils.toString(((ExecutableRefProxy)after).getRefName()));
       
        ii.setAfter(targetExe);
      }
    }
   
    {
      Executable exception=ii.getException();
      if(exception instanceof ExecutableRefProxy)
      {
        Executable targetExe=getTargetRefExecutable((ExecutableRefProxy)exception);
        if(targetExe == null)
          throw new ParseException("can not find 'exception' interceptor named "+SbmUtils.toString(((ExecutableRefProxy)exception).getRefName()));
       
        ii.setException(targetExe);
      }
View Full Code Here

Examples of org.soybeanMilk.core.Executable

   * @return
   * @date 2011-3-15
   */
  protected Executable getTargetRefExecutable(ExecutableRefProxy proxy)
  {
    Executable target=null;
   
    //先从它的文件作用域内取
    if(target == null)
    {
      if(proxy.getCurrentExecutablePrefix() != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.