Package npanday.executable

Examples of npanday.executable.CommandExecutor$Factory


        logger.info( "NPANDAY-068-003: Compiling Artifact: Vendor = "
            + compilerContext.getCompilerRequirement().getVendor() + ", Language = "
            + compilerContext.getCompilerRequirement().getLanguage() + ", Assembly Name = "
            + compilerContext.getArtifact().getAbsolutePath() );

        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
        commandExecutor.setLogger( logger );
        commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), failOnErrorOutput() );
    }
View Full Code Here


     */
    private void installArtifactGacFile(Artifact artifact)
    {
        try
        {
            CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
           
            String executable = "gacutil";
            List<String> commands = new ArrayList<String>();
           
            //searching for the .dll to be installed.
            String sourceDir =  config.getIncludeSources().get( 0 );
            String[] sourceDirTokens = sourceDir.split( "\\\\" );
            String sDir = "";
           
            //constructing the directory for the.dll
            for(int i=0;i<sourceDirTokens.length-3;i++)
            {
                if(sDir.equalsIgnoreCase( "" ))
                {
                    sDir = sourceDirTokens[i];
                }
                else
                {
                    sDir = sDir +"\\"+sourceDirTokens[i];
                }
               
            }
           
            String dll = artifact.getArtifactId()+".dll";
            String dllSysPath ="";
            List<File> potentialDlls= FileUtils.getFiles( new File(sDir), "**" , null );
           
            for(File cFile: potentialDlls)
            {
                String pSysPath = cFile.getAbsolutePath();
                String[] pathTokens = pSysPath.split( "\\\\" );
                if(pathTokens[pathTokens.length-1].equalsIgnoreCase( dll ) )
                {
                    dllSysPath = cFile.getAbsolutePath();
                    //break;
                }
            }
           
            commands.add( "/i "+dllSysPath );
            commandExecutor.executeCommand( executable, commands);
        }
        catch(Exception e)
        {
            System.out.println("NPANDAY-000-000: Could not install artifact to GAC artifact:" +artifact.getArtifactId());
        }
View Full Code Here

     */
    private Logger logger;

    public void run()
    {
        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
        try
        {
            commandExecutor.setLogger( logger );
            commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), true );
        }
        catch ( ExecutionException e )
        {
            //  throw new ExecutionException( "NPANDAY-063-000: Command = " + commands, e );
        }
        if ( commandExecutor.getStandardOut().contains( "error" ) )
        {
            //   t/w new ExecutionException( "NPANDAY-063-001: Command = " + commands );
        }
    }
View Full Code Here

        {
            Vendor vendor = getCompilerVendor();
            List<String> commands = getCommandsFor( vendor, webreference );

            getLog().debug( "NPANDAY-1300-000: Commands = " + commands.toString() );
            CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
            try
            {
                commandExecutor.executeCommand( getExecutableFor( vendor, netHome ), commands );
                getLog().info(
                               "NPANDAY-1300-008: Generated WSDL: File = "
                                   + project.getBuild().getSourceDirectory()
                                   + File.separator
                                   + project.getBuild().getSourceDirectory()
                                   + File.separator
                                   + webreference.getOutput()
                                   + File.separator
                                   + getFileNameFor( project.getBuild().getSourceDirectory() + File.separator
                                       + webreference.getPath() ) );

            }
            catch ( ExecutionException e )
            {
                // TODO: This is a hack to get around the fact that MONO returns a result=1 on warnings and MS returns a
                // result=1 on errors.
                // I don't want to fail on MONO warning here.
                if ( ( vendor.equals( Vendor.MONO ) && commandExecutor.getResult() > 1 )
                    || vendor.equals( Vendor.MICROSOFT ) )
                {
                    throw new MojoExecutionException( "NPANDAY-1300-001: Result = " + commandExecutor.getResult(), e );
                }
            }
        }

    }
View Full Code Here

        getLog().debug( "NPANDAY-1100-008: " + commands.toString() );

        // pretty print nunit logs
        getLog().info( System.getProperty( "line.separator" ) );

        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
        try
        {
            commandExecutor.setLogger( new org.codehaus.plexus.logging.AbstractLogger( 0, "nunit-logger" )
            {
                Log log = getLog();

                public void debug( String message, Throwable throwable )
                {
                    log.debug( message, throwable );

                }

                public void error( String message, Throwable throwable )
                {
                    log.error( message, throwable );
                }

                public void fatalError( String message, Throwable throwable )
                {
                    log.error( message, throwable );
                }

                public Logger getChildLogger( String message )
                {
                    return null;
                }

                public void info( String message, Throwable throwable )
                {
                    log.info( message, throwable );
                }

                public void warn( String message, Throwable throwable )
                {
                    log.warn( message, throwable );
                }

            } );
            commandExecutor.executeCommand( getExecutableFor( vendorInfo ), commands );
        }
        catch ( ExecutionException e )
        {
            String line = System.getProperty( "line.separator" );
            throw new MojoFailureException( "NPANDAY-1100-007: There are test failures." + line + line + e.getMessage(), e);
View Full Code Here

                 *          if the platform cannot be matched.
                 */
                private Vendor getVendorForCommand( String command )
                    throws PlatformUnsupportedException
                {
                    CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
                    //commandExecutor.setLogger(logger);
                    try
                    {
                        List<String> commands = new ArrayList<String>();
                        commandExecutor.executeCommand( command, commands );
                    }
                    catch ( ExecutionException e )
                    {
                        throw new PlatformUnsupportedException( "", e );
                    }
                    String results = commandExecutor.getStandardOut();
                    if ( results.contains( microsoftContainsString ) )
                    {
                        return Vendor.MICROSOFT;
                    }
                    else if ( results.contains( monoContainsString ) )
View Full Code Here

    public void execute()
        throws ExecutionException
    {
        List<String> commands = getCommands();

        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
        try
        {
            commandExecutor.setLogger( logger );
            commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), true );
        }
        catch ( ExecutionException e )
        {
            throw new ExecutionException( "NPANDAY-063-000: Execution Path = " +
                ( ( getExecutionPath() != null ) ? getExecutionPath().getAbsolutePath() : "unknown" ) + ", Executable = " + getExecutable() + ", Args = " +
                commands, e );
        }
        if ( commandExecutor.getStandardOut().contains( "error" )
          && !commandExecutor.getStandardOut().contains( "exit code = 0" ) )       
        {
            throw new ExecutionException(
                "NPANDAY-063-001: Execution Path = " +
                ( ( getExecutionPath() != null ) ? getExecutionPath().getAbsolutePath() : "unknown" ) + ", Executable = " + getExecutable() + ", Args = " +
                commands );
View Full Code Here

        logger.info( "NPANDAY-068-003: Compiling Artifact: Vendor = " +
            compilerContext.getCompilerRequirement().getVendor() + ", Language = " +
            compilerContext.getCompilerRequirement().getVendor() + ", Assembly Name = " +
            compilerContext.getArtifact().getAbsolutePath() );

        CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor();
        commandExecutor.setLogger( logger );
        commandExecutor.executeCommand( getExecutable(), getCommands(), getExecutionPath(), failOnErrorOutput() );
    }
View Full Code Here

TOP

Related Classes of npanday.executable.CommandExecutor$Factory

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.