Examples of CommandExecutor


Examples of org.drools.concurrent.CommandExecutor

        ReteooStatefulSession session = InputMarshaller.readSession( context,
                                                                     id,
                                                                     executor,
                                                                     environment,
                                                                     (SessionConfiguration) config );
        executor.setCommandExecutor( new CommandExecutor( session ) );
        context.close();
        if ( ((SessionConfiguration) config).isKeepReference() ) {
            ((ReteooRuleBase)((KnowledgeBaseImpl)this.kbase).ruleBase).addStatefulSession( session );
        }
        return new StatefulKnowledgeSessionImpl( session );
View Full Code Here

Examples of org.drools.concurrent.CommandExecutor

                                                                       executor,
                                                                       sessionConfig,
                                                                       environment );
            new StatefulKnowledgeSessionImpl(session);

            executor.setCommandExecutor( new CommandExecutor( session ) );

            if ( sessionConfig.isKeepReference() ) {
                super.addStatefulSession( session );
                for (Object listener : session.getRuleBaseUpdateListeners()) {
                    addEventListener((RuleBaseEventListener) listener);
View Full Code Here

Examples of org.drools.runtime.CommandExecutor

        if ( !(cmd instanceof BatchExecutionCommandImpl) ) {
            cmd = new BatchExecutionCommandImpl( Arrays.asList( new GenericCommand< ? >[]{(GenericCommand<?>) cmd} ) );
        }

        CommandExecutor exec;
        ExecutionNodePipelineContextImpl droolsContext = exchange.getProperty( "drools-context",
                                                                                   ExecutionNodePipelineContextImpl.class );
        if ( droolsContext != null ) {
            exec = droolsContext.getCommandExecutor();
        } else {
            exec = de.getExecutor();
            if ( exec == null ) {
                String lookup = exchange.getIn().getHeader( DroolsComponent.DROOLS_LOOKUP,
                                                                String.class );
                if ( StringUtils.isEmpty( lookup ) && (cmd instanceof BatchExecutionCommandImpl) ) {
                    lookup = ((BatchExecutionCommandImpl) cmd).getLookup();
                }

                if ( de.getGridNode() != null && !StringUtils.isEmpty( lookup ) ) {
                    exec = de.getGridNode().get( lookup,
                                                     CommandExecutor.class );
                    if ( exec == null ) {
                        throw new RuntimeException( "ExecutionNode is unable to find ksession=" + lookup + " for uri" + de.getEndpointUri() );
                    }
                } else {
                    throw new RuntimeException( "No ExecutionNode, unable to find ksession=" + lookup + " for uri" + de.getEndpointUri() );
                }
            }
        }

        if ( exec == null ) {
            throw new RuntimeException( "No defined ksession for uri" + de.getEndpointUri() );
        }

        ExecutionResults results = exec.execute( (BatchExecutionCommandImpl) cmd );;
        exchange.getOut().setBody( results );
    }
View Full Code Here

Examples of org.drools.runtime.CommandExecutor

                unwrapper = ExchangeUnwrapper.INSTANCE;
                break;
        }

        // Creates the actual worker
        CommandExecutor exec = de.getExecutor();
        if ( exec instanceof StatefulKnowledgeSession ) {
            WorkingMemoryEntryPoint wmep;
            String ep = de.getEntryPoint();
            if ( ep != null ) {
                wmep = ((StatefulKnowledgeSession) exec).getWorkingMemoryEntryPoint( ep );
View Full Code Here

Examples of org.drools.runtime.CommandExecutor

            ClassLoader originalClassLoader = null;
            try {
                originalClassLoader = Thread.currentThread().getContextClassLoader();

                CommandExecutor exec = dep.executor;
                if ( exec == null ) {
                    String lookup = exchange.getIn().getHeader( DroolsComponent.DROOLS_LOOKUP,
                                                                String.class );
                    if ( StringUtils.isEmpty( lookup ) ) {
                        //Bad Hack - Need to remote it and fix it in Camel (if it's a camel problem)
View Full Code Here

Examples of org.eclim.util.CommandExecutor

      String nature, CommandLine commandLine)
    throws Exception
  {
    String interpreterPath = commandLine.getValue(Options.PATH_OPTION);
    String type = "ruby";
    CommandExecutor process = CommandExecutor.execute(new String[]{
      interpreterPath, "--version",
    }, 5000);

    if(process.getReturnCode() == -1){
      process.destroy();
      logger.error("ruby command timed out.");
      throw new RuntimeException("ctags command timed out.");
    }else if(process.getReturnCode() > 0){
      logger.error("ruby command error: " + process.getErrorMessage());
      throw new RuntimeException("ruby error: " + process.getErrorMessage());
    }

    if (process.getResult().indexOf("jruby") != -1){
      type = "jruby";
    }

    return DltkInterpreterTypeManager.getInterpreterInstallType(type, nature);
  }
View Full Code Here

Examples of org.formic.util.CommandExecutor

    }

    public Status validate()
    {
      try{
        CommandExecutor command =
          CommandExecutor.execute(new String[]{"vim", "--version"}, 2000);
        if (command.getReturnCode() != 0){
          logger.error(
              "Error checking vim version: {}", command.getErrorMessage());
          return new Status(
              WARN, Installer.getString("vim.validation.failed"));
        }
        String result = command.getResult();
        Matcher matcher = VERSION.matcher(result);
        if(!matcher.find()){
          logger.error("Error finding vim version in output: {}", result);
          return new Status(
              WARN, Installer.getString("vim.validation.failed"));
View Full Code Here

Examples of org.jboss.dna.graph.commands.executor.CommandExecutor

        // Create a federating command executor to execute the commands and merge the results into a single set of
        // commands.
        final String configurationSourceName = configurationProjection.getSourceName();
        List<Projection> projections = Collections.singletonList(configurationProjection);
        CommandExecutor executor = null;
        if (configurationProjection.getRules().size() == 0) {
            // There is no projection for the configuration repository, so just use a no-op executor
            executor = new NoOpCommandExecutor(context, configurationSourceName);
        } else if (configurationProjection.isSimple()) {
            // There is just a single projection for the configuration repository, so just use an executor that
            // translates the paths using the projection
            executor = new SingleProjectionCommandExecutor(context, configurationSourceName, configurationProjection,
                                                           connectionFactory);
        } else {
            // The configuration repository has more than one projection, so we need to merge the results
            executor = new FederatingCommandExecutor(context, configurationSourceName, projections, connectionFactory);
        }
        // Wrap the executor with a logging executor ...
        executor = new LoggingCommandExecutor(executor, context.getLogger(getClass()), Logger.Level.DEBUG);

        // The configuration projection (via "executor") will convert this path into a path that exists in the configuration
        // repository
        Path configNode = pathFactory.create(PATH_TO_CONFIGURATION_INFORMATION);

        try {
            // Get the repository node ...
            BasicGetNodeCommand getRepository = new BasicGetNodeCommand(configNode);
            executor.execute(getRepository);
            if (getRepository.hasError()) {
                throw new FederationException(FederationI18n.federatedRepositoryCannotBeFound.text(repositoryName));
            }

            // Get the first child node of the "dna:cache" node, since this represents the source used as the cache ...
            Path cacheNode = pathFactory.create(configNode, nameFactory.create(DNA_CACHE_SEGMENT));
            BasicGetChildrenCommand getCacheSource = new BasicGetChildrenCommand(cacheNode);

            executor.execute(getCacheSource);
            if (getCacheSource.hasError() || getCacheSource.getChildren().size() < 1) {
                I18n msg = FederationI18n.requiredNodeDoesNotExistRelativeToNode;
                throw new FederationException(msg.text(DNA_CACHE_SEGMENT, configNode));
            }

            // Add a command to get the projection defining the cache ...
            Path pathToCacheRegion = pathFactory.create(cacheNode, getCacheSource.getChildren().get(0));
            BasicGetNodeCommand getCacheRegion = new BasicGetNodeCommand(pathToCacheRegion);
            executor.execute(getCacheRegion);
            Projection cacheProjection = createProjection(context,
                                                          projectionParser,
                                                          getCacheRegion.getPath(),
                                                          getCacheRegion.getPropertiesByName(),
                                                          problems);

            if (getCacheRegion.hasError()) {
                I18n msg = FederationI18n.requiredNodeDoesNotExistRelativeToNode;
                throw new FederationException(msg.text(DNA_CACHE_SEGMENT, configNode));
            }

            // Get the source projections for the repository ...
            Path projectionsNode = pathFactory.create(configNode, nameFactory.create(DNA_PROJECTIONS_SEGMENT));
            BasicGetChildrenCommand getProjections = new BasicGetChildrenCommand(projectionsNode);

            executor.execute(getProjections);
            if (getProjections.hasError()) {
                I18n msg = FederationI18n.requiredNodeDoesNotExistRelativeToNode;
                throw new FederationException(msg.text(DNA_PROJECTIONS_SEGMENT, configNode));
            }

            // Build the commands to get each of the projections (children of the "dna:projections" node) ...
            List<Projection> sourceProjections = new LinkedList<Projection>();
            if (getProjections.hasNoError() && !getProjections.getChildren().isEmpty()) {
                BasicCompositeCommand commands = new BasicCompositeCommand();
                for (Path.Segment child : getProjections.getChildren()) {
                    final Path pathToSource = pathFactory.create(projectionsNode, child);
                    commands.add(new BasicGetNodeCommand(pathToSource));
                }
                // Now execute these commands ...
                executor.execute(commands);

                // Iterate over each region node obtained ...
                for (GraphCommand command : commands) {
                    BasicGetNodeCommand getProjectionCommand = (BasicGetNodeCommand)command;
                    if (getProjectionCommand.hasNoError()) {
                        Projection projection = createProjection(context,
                                                                 projectionParser,
                                                                 getProjectionCommand.getPath(),
                                                                 getProjectionCommand.getPropertiesByName(),
                                                                 problems);
                        if (projection != null) {
                            Logger logger = context.getLogger(getClass());
                            if (logger.isTraceEnabled()) {
                                logger.trace("Adding projection to federated repository {0}: {1}",
                                             getRepositoryName(),
                                             projection);
                            }
                            sourceProjections.add(projection);
                        }
                    }
                }
            }

            // Look for the default cache policy ...
            BasicCachePolicy cachePolicy = new BasicCachePolicy();
            Property timeToLiveProperty = getRepository.getPropertiesByName().get(nameFactory.create(CACHE_POLICY_TIME_TO_LIVE_CONFIG_PROPERTY_NAME));
            if (timeToLiveProperty != null && !timeToLiveProperty.isEmpty()) {
                cachePolicy.setTimeToLive(longFactory.create(timeToLiveProperty.getValues().next()), TimeUnit.MILLISECONDS);
            }
            CachePolicy defaultCachePolicy = cachePolicy.isEmpty() ? null : cachePolicy.getUnmodifiable();
            return new FederatedRepositoryConfig(repositoryName, cacheProjection, sourceProjections, defaultCachePolicy);
        } catch (InvalidPathException err) {
            I18n msg = FederationI18n.federatedRepositoryCannotBeFound;
            throw new FederationException(msg.text(repositoryName));
        } finally {
            executor.close();
        }

    }
View Full Code Here

Examples of org.jboss.dna.graph.commands.executor.CommandExecutor

        if (!this.repository.isRunning()) {
            throw new RepositorySourceException(FederationI18n.repositoryHasBeenShutDown.text(this.repository.getName()));
        }
        if (commands == null || commands.length == 0) return;

        CommandExecutor executor = this.repository.getExecutor(context, sourceName);
        try {
            assert executor != null;
            for (GraphCommand command : commands) {
                executor.execute(command);
            }
        } finally {
            executor.close();
        }
    }
View Full Code Here

Examples of org.jboss.soa.esb.services.jbpm.cmd.CommandExecutor

    addAuthenticationRequest(message);

    message.getBody().add(Constants.COMMAND_CODE, messageFacade.getOpCode().toString());
    messageFacade.setJBPMContextParameters(message);

        CommandExecutor commandExecutor = CommandExecutor.getInstance();
        String commandString  = (String)message.getBody().get(Constants.COMMAND_CODE);
        Command command = commandExecutor.getCommand(commandString);
        command.execute(message);
        return message;
  }
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.