org.apache.tools.ant.UnknownElement Java Examples

The following examples show how to use org.apache.tools.ant.UnknownElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NbAntlib.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Process antlib.xml definitions.
 * @param p a project to add definitions to
 * @param antlib location of antlib.xml to load
 * @param uri a URI to add definitions in, or null
 * @param l a class loader to load defined classes from
 */
public static void process(Project p, URL antlib, String uri, ClassLoader l) throws IOException, BuildException {
    ComponentHelper helper = ComponentHelper.getComponentHelper(p);
    helper.enterAntLib(uri);
    Antlib al;
    try {
        UnknownElement antlibElement = new ProjectHelper2().parseUnknownElement(p, antlib);
        al = new NbAntlib(uri, l);
        al.setProject(p);
        al.setLocation(antlibElement.getLocation());
        al.init();
        antlibElement.configure(al);
    } finally {
        helper.exitAntLib();
    }
    al.execute();
}
 
Example #2
Source File: AntBuilder.java    From groovy with Apache License 2.0 6 votes vote down vote up
public AntBuilder(final Task parentTask) {
    this(parentTask.getProject(), parentTask.getOwningTarget());

    // define "owning" task as wrapper to avoid having tasks added to the target
    // but it needs to be an UnknownElement and no access is available from
    // task to its original UnknownElement 
    final UnknownElement ue = new UnknownElement(parentTask.getTaskName());
    ue.setProject(parentTask.getProject());
    ue.setTaskType(parentTask.getTaskType());
    ue.setTaskName(parentTask.getTaskName());
    ue.setLocation(parentTask.getLocation());
    ue.setOwningTarget(parentTask.getOwningTarget());
    ue.setRuntimeConfigurableWrapper(parentTask.getRuntimeConfigurableWrapper());
    parentTask.getRuntimeConfigurableWrapper().setProxy(ue);
    antXmlContext.pushWrapper(parentTask.getRuntimeConfigurableWrapper());
}
 
Example #3
Source File: IncrementalDeploymentTask.java    From aws-ant-tasks with Apache License 2.0 6 votes vote down vote up
/**
 * Deploys all apps in this deployment group, then waits for all the
 * deployments in the group to succeed. Deployments in a group will run
 * in parallel.
 */
public void deployApps() {
    for (Task deployAppTask : deployAppTasks) {
        
        // This is in case of a rare bug that occurs in some JVM implementations
        if (deployAppTask instanceof UnknownElement) {
            deployAppTask.maybeConfigure();
            deployAppTask = ((UnknownElement) deployAppTask).getTask();
        }
        if (!deployAppTask.getTaskName().equals("deploy-opsworks-app")) {
            throw new BuildException(
                    "Only <deploy-opsworks-app> elements are supported");
        }
        deployAppTask.execute();
        deploymentIds.add(deployAppTask.getDescription());
    }

    try {
        waitForDeploymentGroupToSucceed(deploymentIds, client);
    } catch (InterruptedException e) {
        throw new BuildException(e.getMessage(), e);
    }
}
 
Example #4
Source File: SpoofTaskContainer.java    From groovy with Apache License 2.0 5 votes vote down vote up
public void addTask(Task task) {
    // to work with ant 1.6
    spoof("in addTask");
    if (task instanceof UnknownElement) {
        spoof("configuring UnknownElement");
        task.maybeConfigure();
        task = ((UnknownElement) task).getTask();
    }
    tasks.add(task);
}
 
Example #5
Source File: SequentialElement.java    From ExpectIt with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 * <p/>
 * Passes the {@code expect} instance to the children tasks that are instanceof
 * {@link net.sf.expectit.ant.matcher.AbstractTaskElement}.
 */
@Override
public void execute() {
    for (Task t : tasks) {
        if (t instanceof UnknownElement) {
            t.maybeConfigure();
            Object proxy = ((UnknownElement) t).getWrapper().getProxy();
            if (proxy instanceof AbstractTaskElement) {
                ((AbstractTaskElement) proxy).setExpect(expect);
            }
        }
    }
    super.execute();
}