• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UnknownElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tools.ant.UnknownElement的典型用法代码示例。如果您正苦于以下问题:Java UnknownElement类的具体用法?Java UnknownElement怎么用?Java UnknownElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnknownElement类属于org.apache.tools.ant包,在下文中一共展示了UnknownElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: process

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NbAntlib.java


示例2: addTaskToTarget

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
private void addTaskToTarget( Target target, Task task ) {
   UnknownElement replacement = new UnknownElement( taskType );  // shouldn't do taskType, for Ant 1.6 and later there is a getTaskType method
   replacement.setProject( getProject() );
   invokeMethod( replacement, "setTaskType", taskType );
   replacement.setTaskName( task.getTaskName() );
   replacement.setLocation( task.getLocation() );
   replacement.setOwningTarget( target );
   replacement.setRuntimeConfigurableWrapper( task.getRuntimeConfigurableWrapper() );
   invokeMethod( task.getRuntimeConfigurableWrapper(), "setProxy", replacement );
   replacement.maybeConfigure();
   log("replacement is a " + replacement.getTaskName() + ", " + replacement.getClass().getName());
   if (replacement instanceof TaskContainer) {
      log("replacement is a TaskContainer");
      invokeMethod(replacement, "handleChildren", new Object[]{this, this.getRuntimeConfigurableWrapper()});
   }
   target.addTask(replacement);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:ForTask.java


示例3: AntBuilder

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
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());
}
 
开发者ID:apache,项目名称:groovy,代码行数:17,代码来源:AntBuilder.java


示例4: parseUnknownElement

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Parse an unknown element from a url
 *
 * @param project the current project
 * @param source  the url containing the task
 * @return a configured task
 * @exception BuildException if an error occurs
 */
public UnknownElement parseUnknownElement(Project project, URL source)
    throws BuildException {
    Target dummyTarget = new Target();
    dummyTarget.setProject(project);

    AntXMLContext context = new AntXMLContext(project);
    context.addTarget(dummyTarget);
    context.setImplicitTarget(dummyTarget);

    parse(context.getProject(), source, new RootHandler(context, elementHandler));
    Task[] tasks = dummyTarget.getTasks();
    if (tasks.length != 1) {
        throw new BuildException("No tasks defined");
    }
    return (UnknownElement) tasks[0];
}
 
开发者ID:apache,项目名称:ant,代码行数:25,代码来源:ProjectHelper2.java


示例5: init

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Initialisation routine called after handler creation
 * with the element name and attributes. This configures
 * the element with its attributes and sets it up with
 * its parent container (if any). Nested elements are then
 * added later as the parser encounters them.
 *
 * @param propType Name of the element which caused this handler
 *            to be created. Must not be <code>null</code>.
 *
 * @param attrs Attributes of the element which caused this
 *              handler to be created. Must not be <code>null</code>.
 *
 * @exception SAXParseException in case of error, such as a
 *            BuildException being thrown during configuration.
 */
public void init(String propType, AttributeList attrs) throws SAXParseException {
    Class<?> parentClass = parent.getClass();
    IntrospectionHelper ih = IntrospectionHelper.getHelper(helperImpl.project, parentClass);

    try {
        String elementName = propType.toLowerCase(Locale.ENGLISH);
        if (parent instanceof UnknownElement) {
            UnknownElement uc = new UnknownElement(elementName);
            uc.setProject(helperImpl.project);
            ((UnknownElement) parent).addChild(uc);
            child = uc;
        } else {
            child = ih.createElement(helperImpl.project, parent, elementName);
        }
        helperImpl.configureId(child, attrs);

        childWrapper = new RuntimeConfigurable(child, propType);
        childWrapper.setAttributes(attrs);
        parentWrapper.addChild(childWrapper);
    } catch (BuildException exc) {
        throw new SAXParseException(exc.getMessage(), helperImpl.locator, exc);
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:40,代码来源:ProjectHelperImpl.java


示例6: getParams

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Get all the attributes in the ant-attribute:param
 * namespace and place them in a map.
 * @param el the element this attribute is in.
 * @return a map of attributes.
 */
protected Map<String, String> getParams(UnknownElement el) {
    Map<String, String> ret = new HashMap<>();
    RuntimeConfigurable rc = el.getWrapper();
    Hashtable<String, Object> attributes = rc.getAttributeMap(); // This does a copy!
    for (Iterator<Map.Entry<String, Object>> i =
        attributes.entrySet().iterator(); i.hasNext();) {
        Map.Entry<String, Object> entry = i.next();
        String key = entry.getKey();
        String value = (String) entry.getValue();
        if (key.startsWith("ant-attribute:param")) {
            int pos = key.lastIndexOf(':');
            ret.put(key.substring(pos + 1),
                el.getProject().replaceProperties(value));
        }
    }
    return ret;
}
 
开发者ID:apache,项目名称:ant,代码行数:24,代码来源:BaseIfAttribute.java


示例7: taskStarted

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * @see BuildListener#taskStarted
 * {@inheritDoc}.
 */
@Override
public void taskStarted(final BuildEvent event) {
    if (initialized) {
        final Task task = event.getTask();
        Object real = task;
        if (task instanceof UnknownElement) {
            final Object realObj = ((UnknownElement) task).getTask();
            if (realObj != null) {
                real = realObj;
            }
        }
        final Log log = getLog(real.getClass().getName(), null);
        if (log.isTraceEnabled()) {
            realLog(log, "Task \"" + task.getTaskName() + "\" started ",
                    Project.MSG_VERBOSE, null);
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:23,代码来源:CommonsLoggingListener.java


示例8: taskFinished

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * @see BuildListener#taskFinished
 * {@inheritDoc}.
 */
@Override
public void taskFinished(final BuildEvent event) {
    if (initialized) {
        final Task task = event.getTask();
        Object real = task;
        if (task instanceof UnknownElement) {
            final Object realObj = ((UnknownElement) task).getTask();
            if (realObj != null) {
                real = realObj;
            }
        }
        final Log log = getLog(real.getClass().getName(), null);
        if (event.getException() == null) {
            if (log.isTraceEnabled()) {
                realLog(log, "Task \"" + task.getTaskName() + "\" finished.",
                        Project.MSG_VERBOSE, null);
            }
        } else {
            realLog(log, "Task \"" + task.getTaskName()
                    + "\" finished with error.", Project.MSG_ERR,
                    event.getException());
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:29,代码来源:CommonsLoggingListener.java


示例9: concatDescriptions

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
private static void concatDescriptions(Project project, Target t,
                                       StringBuilder description) {
    if (t == null) {
        return;
    }
    for (Task task : findElementInTarget(t, "description")) {
        if (!(task instanceof UnknownElement)) {
            continue;
        }
        UnknownElement ue = ((UnknownElement) task);
        String descComp = ue.getWrapper().getText().toString();
        if (descComp != null) {
            description.append(project.replaceProperties(descComp));
        }
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:17,代码来源:Description.java


示例10: execute

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Execute the nested tasks, setting the classloader for
 * any tasks that derive from Definer.
 */
@Override
public void execute() {
    //TODO handle tasks added via #addTask()

    for (Task task : tasks) {
        UnknownElement ue = (UnknownElement) task;
        setLocation(ue.getLocation());
        ue.maybeConfigure();
        Object configuredObject = ue.getRealThing();
        if (configuredObject == null) {
            continue;
        }
        if (!(configuredObject instanceof AntlibDefinition)) {
            throw new BuildException(
                "Invalid task in antlib %s %s does not extend %s",
                ue.getTag(), configuredObject.getClass(),
                AntlibDefinition.class.getName());
        }
        AntlibDefinition def = (AntlibDefinition) configuredObject;
        def.setURI(uri);
        def.setAntlibClassLoader(getClassLoader());
        def.init();
        def.execute();
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:30,代码来源:Antlib.java


示例11: getNestedTask

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Convert the nested sequential to an unknown element
 * @return the nested sequential as an unknown element.
 */
public UnknownElement getNestedTask() {
    UnknownElement ret = new UnknownElement("sequential");
    ret.setTaskName("sequential");
    ret.setNamespace("");
    ret.setQName("sequential");
    // stores RuntimeConfigurable as "RuntimeConfigurableWrapper"
    // in ret as side effect
    new RuntimeConfigurable(ret, "sequential"); //NOSONAR
    final int size = nestedSequential.getNested().size();
    for (int i = 0; i < size; ++i) {
        UnknownElement e =
            (UnknownElement) nestedSequential.getNested().get(i);
        ret.addChild(e);
        ret.getWrapper().addChild(e.getWrapper());
    }
    return ret;
}
 
开发者ID:apache,项目名称:ant,代码行数:22,代码来源:MacroDef.java


示例12: processTasks

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
private void processTasks() {
    if (implicitTag != null) {
        return;
    }
    for (Task task : unknownElements) {
        UnknownElement ue = (UnknownElement) task;
        String name = ProjectHelper.extractNameFromComponentName(
            ue.getTag()).toLowerCase(Locale.ENGLISH);
        if (getNsElements().get(name) == null) {
            throw new BuildException("unsupported element %s", name);
        }
        if (presentElements.get(name) != null) {
            throw new BuildException("Element %s already present", name);
        }
        presentElements.put(name, ue);
    }
}
 
开发者ID:apache,项目名称:ant,代码行数:18,代码来源:MacroInstance.java


示例13: deployApps

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:awslabs,项目名称:aws-ant-tasks,代码行数:28,代码来源:IncrementalDeploymentTask.java


示例14: getTaskElement

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Get the TimedElement associated with a task.
 *
 * Where the task is not found directly, search for unknown elements which
 * may be hiding the real task
 */
private TimedElement getTaskElement(Task task) {
    TimedElement element = (TimedElement) tasks.get(task);
    if (element != null) {
        return element;
    }

    for (Enumeration<Task> e = tasks.keys(); e.hasMoreElements();) {
        Task key = (Task) e.nextElement();
        if (key instanceof UnknownElement) {
            if (((UnknownElement) key).getTask() == task) {
                return (TimedElement) tasks.get(key);
            }
        }
    }

    return null;
}
 
开发者ID:ModelN,项目名称:build-management,代码行数:24,代码来源:FrequentXmlLogger.java


示例15: findTask

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Searches the specified task (the first occurence) within the specified
 * target.
 * 
 * @param target
 *          the target to search for the task for
 * @param clazz
 *          the type of the task to be returned (if several are found the
 *          first one is returned)
 * 
 * @return the found task
 */
@SuppressWarnings("unchecked")
protected <T extends Task> T findTask(final Target target,
		final Class<T> clazz) {
	for (final Task task : target.getTasks()) {

		if (UnknownElement.class.equals(task.getClass())) {
			final UnknownElement unknownTask = (UnknownElement) task;

			// make sure we have the real thing
			unknownTask.maybeConfigure();

			// check it
			if (clazz.equals(unknownTask.getRealThing().getClass())) {
				return (T) unknownTask.getRealThing();
			}
		} else if (clazz.equals(task.getClass())) {
			return (T) task;
		}
	}

	return null;
}
 
开发者ID:pmeisen,项目名称:ant-processenabler,代码行数:35,代码来源:ClassPathBuildFileTest.java


示例16: getAntTaskRunnerInstanceFromProject

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
private AntTaskRunner getAntTaskRunnerInstanceFromProject()
{
    Target target = (Target) this.getProject().getTargets().get( "run" );
    Task[] tasks = target.getTasks();
    for (Task t : tasks)
    {
        if ("greenpepper".equals( t.getTaskName() ))
        {
            UnknownElement gpTask = (UnknownElement) t;
            return (AntTaskRunner) gpTask.getRealThing();
        }
    }

    throw new IllegalArgumentException( "GreenPepper task not found!" );
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:16,代码来源:AntTaskRunnerTest.java


示例17: addTask

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:groovy,代码行数:11,代码来源:SpoofTaskContainer.java


示例18: similar

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * A compare function to compare this with another
 * NestedSequential.
 * It calls similar on the nested unknown elements.
 *
 * @param other the nested sequential to compare with.
 * @return true if they are similar, false otherwise
 */
public boolean similar(NestedSequential other) {
    final int size = nested.size();
    if (size != other.nested.size()) {
        return false;
    }
    for (int i = 0; i < size; ++i) {
        UnknownElement me = (UnknownElement) nested.get(i);
        UnknownElement o = (UnknownElement) other.nested.get(i);
        if (!me.similar(o)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:ant,代码行数:23,代码来源:MacroDef.java


示例19: addTask

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Add a nested task to predefine attributes and elements on.
 * @param nestedTask  Nested task/type to extend.
 */
@Override
public void addTask(Task nestedTask) {
    if (this.nestedTask != null) {
        throw new BuildException("Only one nested element allowed");
    }
    if (!(nestedTask instanceof UnknownElement)) {
        throw new BuildException(
            "addTask called with a task that is not an unknown element");
    }
    this.nestedTask = (UnknownElement) nestedTask;
}
 
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:PreSetDef.java


示例20: PreSetDefinition

import org.apache.tools.ant.UnknownElement; //导入依赖的package包/类
/**
 * Creates a new <code>PresetDefinition</code> instance.
 *
 * @param parent The parent of this predefinition.
 * @param el     The predefined attributes, nested elements and text.
 */
public PreSetDefinition(AntTypeDefinition parent, UnknownElement el) {
    if (parent instanceof PreSetDefinition) {
        PreSetDefinition p = (PreSetDefinition) parent;
        el.applyPreSet(p.element);
        parent = p.parent;
    }
    this.parent = parent;
    this.element = el;
}
 
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:PreSetDef.java



注:本文中的org.apache.tools.ant.UnknownElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CountByExampleElementGenerator类代码示例发布时间:2022-05-22
下一篇:
Java CompletionUtil类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap