/*
(non-Javadoc)

@see com.ibm.ws.wlp.repository.CreateDownloadXml#execute()
768669
@Override
    public void execute() throws BuildException {
        /*
         * A couple of the sample properties used in the download XML come from the Readme.html file and need the HTML elements stripped out before we can write the XML using the
         * supertype
         */
        String sampleName = null;
        String sampleAbstract = null;
        String readmeContent = null;

        // Parse the source readme file for the abstract, as it exists only in here
        try {
            Document doc = Jsoup.parse(sourceReadmeFile, "UTF-8");
            //Short abstract description is used by the tools (via download XML - "description"), and WASDev via wasdev.xml.
            Element abstractElement = getRequiredElementById(doc, "ibm-wasdev-sample-abstract-content");
            sampleAbstract = abstractElement.text();
            this.setDescription(abstractElement.text());

        } catch (IOException e) {
            // Can't read the readme so can't produce the XML
            throw new BuildException("Unable to load the Readme.html from " + sourceReadmeFile.getAbsolutePath() + " due to IOException: " + e.getMessage(), e);
        }

        // Parse the built readme file for everything else
        try {
            Document doc = Jsoup.parse(builtReadmeFile, "UTF-8");
            Element nameElement = getRequiredElementById(doc, "ibm-wasdev-sample-name-title");
            sampleName = nameElement.text();
            this.setName(sampleName);

            // Several nodes aren't needed for the WASDev page
            removeElementIfExistsById(doc, "ibm-wasdev-sample-name-title");
            removeElementIfExistsById(doc, "ibm-wasdev-sample-desc-title");
            removeElementIfExistsById(doc, "ibm-wasdev-sample-external-deps-title");
            removeElementIfExistsById(doc, "ibm-wasdev-sample-external-deps-content");
            removeElementIfExistsById(doc, "ibm-wasdev-sample-abstract-content");
            removeElementIfExistsById(doc, "ibm-title-support-info");
            removeElementIfExistsById(doc, "ibm-support-info");
            removeElementIfExistsById(doc, "ibmLicenseFlowing");

            Element readmeElement = getRequiredElementById(doc, "ibm-wasdev-sample-readme-content");

            // If the source is supplied append it to the description
            if (this.sourceFilePath != null) {
                File sourceFile = new File(this.sourceFilePath);
                if (sourceFile.exists()) {
                    BufferedReader br = null;
                    try {
                        br = new BufferedReader(new FileReader(sourceFile));
                        Element sourceNode = new Element(Tag.valueOf("code"), "");
                        String line = null;
                        while ((line = br.readLine()) != null) {
                            // Add nice spacing in the HTML, first tabs to spaces
                            line = line.replaceAll("\\t", "    ");
                            while (line.startsWith(" ")) {
                                line = line.substring(1);
                                sourceNode.append("&nbsp;");
                            }
                            sourceNode.appendText(line);
                            sourceNode.append("<br/>");
                        }
                        readmeElement.appendChild(sourceNode);
                    } finally {
                        if (br != null) {
                            br.close();
                        }
                    }
                }
            }
            readmeContent = readmeElement.html();
        } catch (IOException e) {
            // Can't read the readme so can't produce the XML
            throw new BuildException("Unable to load the Readme.html from " + builtReadmeFile.getAbsolutePath() + " due to IOException: " + e.getMessage(), e);
        }

        // All processing done (everything is set by ANT) so let the supertype generate the XML
        super.execute();

        // We also need to generate a properties file and a description.html with content used to populate Massive
        // First the properties file
        File propertiesFile = new File(this.propertiesFilePath);
        Properties assetInfoProps = new Properties();
        if (propertiesFile.exists()) {
            // Append to an existing props
            FileInputStream in = null;
            try {
                in = new FileInputStream(propertiesFile);
                assetInfoProps.load(in);
            } catch (FileNotFoundException e) {
                throw new BuildException(e);
            } catch (IOException e) {
                throw new BuildException(e);
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException e) {
                        throw new BuildException(e);
                    }
                }
            }
        }
        assetInfoProps.put("name", sampleName);
        assetInfoProps.put("shortDescription", sampleAbstract);
        assetInfoProps.put("downloadURL", assetDownloadUrl);
        FileOutputStream out = null;
        try {
            out = new FileOutputStream(propertiesFile);
            assetInfoProps.store(out, null);
        } catch (FileNotFoundException e) {
            throw new BuildException(e);
        } catch (IOException e) {
            throw new BuildException(e);
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    throw new BuildException(e);
                }
            }
        }

        // In the same directory as the properties file, write the description.html file
        File descriptionFile = new File(propertiesFile.getParentFile(), "description.html");
        Writer descriptionWriter = null;
        try {
            descriptionWriter = new OutputStreamWriter(new FileOutputStream(descriptionFile), StandardCharsets.UTF_8);
            descriptionWriter.write(readmeContent);
        } catch (IOException e) {
            throw new BuildException(e);
        } finally {
            if (descriptionWriter != null) {
                try {
                    descriptionWriter.close();
                } catch (IOException e) {
                    throw new BuildException(e);
                }
            }
        }
    }
354058
public void execute ()
        throws MojoExecutionException
    {
        if (mapFile == null) mapFile = new File(base, "compmap.txt");
        if (actionDef == null) actionDef = new File(base, "actions.xml");

        ComponentBundler bundler = new ComponentBundler(mapFile, actionDef) {
            @Override protected boolean keepRawPngs () { return keepRawPngs; }
            @Override protected boolean uncompressed () { return false; }
            @Override protected void logInfo (String message) { getLog().info(message); }
            @Override protected void logWarn (String message) { getLog().warn(message); }
        };

        if (bundleDirectories == null) {
            bundleDirectories = findBundleDirs();
        }
        for (BundleDirectory bdir : bundleDirectories) {
            getLog().info("Processing " + bdir);
            File root = new File(base, bdir.root);

            // create the scanner
            DirectoryScanner scanner = new DirectoryScanner();
            scanner.setBasedir(new File(root, bdir.path));
            scanner.setIncludes(includes.toArray(new String[0]));
            scanner.setExcludes(excludes.toArray(new String[0]));
            scanner.scan();

            File targetDir = new File(targetBase, bdir.root);
            File target = new File(new File(targetDir, bdir.path), "components.jar");
            List<Tuple<File,List<String>>> sourceDirs = Lists.newArrayList();
            sourceDirs.add(Tuple.newTuple(scanner.getBasedir(),
                                          Arrays.asList(scanner.getIncludedFiles())));
            bundler.execute(root.getPath(), target, sourceDirs);
        }
    }
468456
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {
    return m_arg0.execute(xctxt).xstr().startsWith(m_arg1.execute(xctxt).xstr())
           ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  }
1246977
@Override
    public void execute() throws MojoExecutionException {
        if (typescript == null) {
            typescript = new TypeScript();
        }

        if (!typescript.isEnabled()) {
            removeFromWatching();
            getLog().info("Typescript processing disabled");
            return;
        }

        npm = npm(this, TYPE_SCRIPT_NPM_NAME, typescript.getVersion());
        this.internalSources = new File(basedir, MAIN_RESOURCES_DIR);
        this.destinationForInternals = new File(buildDirectory, "classes");

        this.externalSources = new File(basedir, ASSETS_SRC_DIR);
        this.destinationForExternals = new File(getWisdomRootDirectory(), ASSETS_DIR);

        try {
            if (internalSources.isDirectory()) {
                getLog().info("Compiling TypeScript files with 'tsc' from " + internalSources.getAbsolutePath());
                processDirectory(internalSources, destinationForInternals);
            }

            if (externalSources.isDirectory()) {
                getLog().info("Compiling TypeScript files with 'tsc' from " + externalSources.getAbsolutePath());
                processDirectory(externalSources, destinationForExternals);
            }
        } catch (WatchingException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
828714
public void execute() {
        try {
            new JdbcTemplate(dataSource).execute(readResourceContent(SCHEMA_FILE)); // TODO: sql independence
        } catch (IOException e) {
            throw new RuntimeException("Could not create schema for EDBI Index", e);
        }
    }
1164597
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {
    return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  }
433843
@Override
    public void execute() {
        Set<String> annotated = db.getAnnotationIndex().get(Audit.class.getName());
        ScanAnnotatedFilter filter = new ScanAnnotatedFilter();
        for (String annotaionClass : annotated) {
            try {
                Class<?> clazz = Class.forName(annotaionClass);
                filter.addClass(clazz);
            } catch (ClassNotFoundException e) {
                throw new InitializationException("", e);
            }
        }
        PreConfigurationContext.addAnnotationFilter(filter);
    }
183992
@Override
    public void execute()
        throws MojoExecutionException
    {
        if ( !canGenerateReport() )
        {
            getLog().info( "Skipping SCoverage report generation" );
            return;
        }

        try
        {
            RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" );
            SiteRendererSink sink = new SiteRendererSink( context );
            Locale locale = Locale.getDefault();
            generate( sink, locale );
        }
        catch ( MavenReportException e )
        {
            String prefix = "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation";
            throw new MojoExecutionException( prefix + ": " + e.getMessage(), e );
        }
    }
970902
public void execute() throws BuildException {
        log.debug("execute()");

        command = command.trim();

        if (srcFile == null && command.length() == 0 && filesets.isEmpty()) {
            throw new BuildException("Source file does not exist!", getLocation());
        }

        if (srcFile != null && !srcFile.exists()) {
            throw new BuildException("Source file does not exist!", getLocation());
        }

        // TODO: any of this used?
        // deal with the filesets
        for (int i = 0; i < filesets.size(); i++) {
            FileSet fs = filesets.elementAt(i);
            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
            File srcDir = fs.getDir(getProject());
            String[] srcFiles = ds.getIncludedFiles();
        }

        try {
            PrintStream out = System.out;
            try {
                if (output != null) {
                    log.verbose("Opening PrintStream to output file " + output);
                    out = new PrintStream(
                            new BufferedOutputStream(
                                    new FileOutputStream(output.getAbsolutePath(), append)));
                }

                // if there are no groovy statements between the enclosing Groovy tags
                // then read groovy statements in from a text file using the src attribute
                if (command == null || command.trim().length() == 0) {
                    createClasspath().add(new Path(getProject(), srcFile.getParentFile().getCanonicalPath()));
                    command = getText(new BufferedReader(new FileReader(srcFile)));
                }

                if (command != null) {
                    execGroovy(command, out);
                } else {
                    throw new BuildException("Source file does not exist!", getLocation());
                }

            } finally {
                if (out != null && out != System.out) {
                    out.close();
                }
            }
        } catch (IOException e) {
            throw new BuildException(e, getLocation());
        }

        log.verbose("statements executed successfully");
    }
1223158
@Override
    public void processXML() throws InjectionException {

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "processXML : " + this);

        List<? extends ConnectionFactory> connectionFactoryDefinitions = ivNameSpaceConfig.getJNDIEnvironmentRefs(ConnectionFactory.class);

        if (connectionFactoryDefinitions != null)
        {
            for (ConnectionFactory connectionFactory : connectionFactoryDefinitions)
            {
                String jndiName = connectionFactory.getName();
                InjectionBinding<ConnectionFactoryDefinition> injectionBinding = ivAllAnnotationsCollection.get(jndiName);
                ConnectionFactoryDefinitionInjectionBinding binding;

                if (injectionBinding != null)
                {
                    binding = (ConnectionFactoryDefinitionInjectionBinding) injectionBinding;
                }
                else
                {
                    binding = new ConnectionFactoryDefinitionInjectionBinding(jndiName, ivNameSpaceConfig);
                    addInjectionBinding(binding);
                }

                binding.mergeXML(connectionFactory);
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "processXML : " + this);

    }
607503
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {

    StringBuffer sb = new StringBuffer();

    // Compiler says we must have at least two arguments.
    sb.append(m_arg0.execute(xctxt).str());
    sb.append(m_arg1.execute(xctxt).str());

    if (null != m_arg2)
      sb.append(m_arg2.execute(xctxt).str());

    if (null != m_args)
    {
      for (int i = 0; i < m_args.length; i++)
      {
        sb.append(m_args[i].execute(xctxt).str());
      }
    }

    return new XString(sb.toString());
  }
1307041
@Override
    public MwsResponse execute() {
        HttpPost request = createRequest();
        try {
            HttpResponse hr = executeRequest(request);
            StatusLine statusLine = hr.getStatusLine();
            int status = statusLine.getStatusCode();
            String message = statusLine.getReasonPhrase();
            rhmd = getResponseHeaderMetadata(hr);
            String body = getResponseBody(hr);
            MwsResponse response = new MwsResponse(status,message,rhmd,body);
            return response;
        } catch (Exception e) {
            throw MwsUtl.wrap(e);
        } finally {
             request.releaseConnection();
        }
    }
916432
def execute(xml, version = '1.1', options = {})
      options.store(:timeout, @timeout) unless options.key?(:timeout)
      options.store(:open_timeout, @open_timeout)
      @request_xml = xml.to_s
      @api_version = version
      response = APIRequest.execute(@url, @request_xml, @api_version, options, @trust_store)
      @response_xml = response.raw_response_data
      response
    end
978003
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {

    int whereNode = getArg0AsNode(xctxt);
    String fileLocation = null;

    if (DTM.NULL != whereNode)
    {
      DTM dtm = xctxt.getDTM(whereNode);
      
      // %REVIEW%
      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
      {
        whereNode = dtm.getFirstChild(whereNode);
      }

      if (DTM.NULL != whereNode)
      {        
        fileLocation = dtm.getDocumentBaseURI();
//        int owner = dtm.getDocument();
//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
      }
    }

    return new XString((null != fileLocation) ? fileLocation : "");
  }
475579
public void execute() throws MojoExecutionException {
		synchronized (lock) {
			injectDependencyDefaults();
			resolveArtifacts();

			// Install project dependencies into classloader's class path
			// and execute xjc2.
			final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
			final ClassLoader classLoader = createClassLoader(currentClassLoader);
			Thread.currentThread().setContextClassLoader(classLoader);
			final Locale currentDefaultLocale = Locale.getDefault();
			try {
				final Locale locale = LocaleUtils.valueOf(getLocale());
				Locale.setDefault(locale);
				//
				doExecute();

			} finally {
				Locale.setDefault(currentDefaultLocale);
				// Set back the old classloader
				Thread.currentThread().setContextClassLoader(currentClassLoader);
			}
		}
	}
559705
public final void execute()
  {
    _log.debug( _sqlString );

    CallableStatement lCallableStatement = null;

    try
    {
      lCallableStatement = _callableStatementProvider.createCallableStatement( _sqlString );

      useCallableStatement( lCallableStatement );
    }
    catch( SQLException e )
    {
      _log.debug( e + ": " + _sqlString, e );

      throw ExceptionManager.createException( e, _sqlString );
    }
    finally
    {
      if( lCallableStatement != null )
      {
        try
        {
          lCallableStatement.close();
        }
        catch( SQLException e )
        {
          _log.debug( e, e );

          throw ExceptionManager.createException( e, _sqlString );
        }
      }
    }
  }
246419
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {

//    DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());

//    // We should probably make a function on the iterator for this, 
//    // as a given implementation could optimize.
//    int i = 0;
//
//    while (DTM.NULL != nl.nextNode())
//    {
//      i++;
//    }
//    nl.detach();
	DTMIterator nl = m_arg0.asIterator(xctxt, xctxt.getCurrentNode());
	int i = nl.getLength();	
	nl.detach();

    return new XNumber((double) i);
  }