Package org.apache.tools.ant

Examples of org.apache.tools.ant.AntTypeDefinition


        // find the script repository - it is stored in the project
        Map scriptRepository = lookupScriptRepository();
        name = ProjectHelper.genComponentName(getURI(), name);
        scriptRepository.put(name, this);
        AntTypeDefinition def = new AntTypeDefinition();
        def.setName(name);
        def.setClass(ScriptDefBase.class);
        ComponentHelper.getComponentHelper(
            getProject()).addDataTypeDefinition(def);
    }
View Full Code Here


                if (adaptTo != null) {
                    adaptToClass = Class.forName(adaptTo, true, al);
                }

                AntTypeDefinition def = new AntTypeDefinition();
                def.setName(name);
                def.setClassName(classname);
                def.setClass(cl);
                def.setAdapterClass(adapterClass);
                def.setAdaptToClass(adaptToClass);
                def.setClassLoader(al);
                if (cl != null) {
                    def.checkClass(getProject());
                }
                ComponentHelper.getComponentHelper(getProject())
                    .addDataTypeDefinition(def);
            } catch (ClassNotFoundException cnfe) {
                String msg = getTaskName() + " class " + classname
View Full Code Here

     * attributes.
     */
    public void execute() {
        String componentName = ProjectHelper.nsToComponentName(
            getURI());
        AntTypeDefinition def = new AntTypeDefinition();
        def.setName(componentName);
        def.setClassName(AttributeNamespace.class.getName());
        def.setClass(AttributeNamespace.class);
        def.setRestrict(true);
        def.setClassLoader(AttributeNamespace.class.getClassLoader());
        ComponentHelper.getComponentHelper(getProject())
            .addDataTypeDefinition(def);
    }
View Full Code Here

                if (adaptTo != null) {
                    adaptToClass = Class.forName(adaptTo, true, al);
                }

                AntTypeDefinition def = new AntTypeDefinition();
                def.setName(name);
                def.setClassName(classname);
                def.setClass(cl);
                def.setAdapterClass(adapterClass);
                def.setAdaptToClass(adaptToClass);
                def.setClassLoader(al);
                if (cl != null) {
                    def.checkClass(getProject());
                }
                ComponentHelper.getComponentHelper(getProject())
                    .addDataTypeDefinition(def);
            } catch (ClassNotFoundException cnfe) {
                String msg = getTaskName() + " class " + classname
View Full Code Here

            }
        }

        name = ProjectHelper.genComponentName(getURI(), name);
        scriptRepository.put(name, this);
        AntTypeDefinition def = new AntTypeDefinition();
        def.setName(name);
        def.setClass(ScriptDefBase.class);
        ComponentHelper.getComponentHelper(
            getProject()).addDataTypeDefinition(def);
    }
View Full Code Here

            getProject());

        String componentName = ProjectHelper.genComponentName(
            nestedTask.getNamespace(), nestedTask.getTag());

        AntTypeDefinition def = helper.getDefinition(componentName);
        if (def == null) {
            throw new BuildException(
                "Unable to find typedef " + componentName);
        }
View Full Code Here

        ServiceInstance instance = new ServiceInstance();
        instance.setProject(project);
        instance.setReference("foo");
       
        MockControl atdCtrl = MockClassControl.createControl(AntTypeDefinition.class);
        AntTypeDefinition typeDef = (AntTypeDefinition)atdCtrl.getMock();
        typeDef.create(project);
        ServiceInstance helperInstance = new ServiceInstance();
        helperInstance.setServiceDef(service);
        atdCtrl.setReturnValue(helperInstance);
        cHelper.getDefinition("foo");
        chCtrl.setReturnValue(typeDef);
View Full Code Here

        ServiceInstance instance = new ServiceInstance();
        instance.setProject(project);
        instance.setReference("foo");
       
        MockControl atdCtrl = MockClassControl.createControl(AntTypeDefinition.class);
        AntTypeDefinition typeDef = (AntTypeDefinition)atdCtrl.getMock();
        typeDef.create(project);
        atdCtrl.setReturnValue(new Object()); // bad reference!
        cHelper.getDefinition("foo");
        chCtrl.setReturnValue(typeDef);

        chCtrl.replay();
View Full Code Here

                     ch.getDefinition().getClass().getName());
        Object instance = ch.getDefinition().create(project);
        assertTrue("Wrong instance", instance instanceof ServiceInstance);
        assertEquals("Wrong ServiceDef", service, ((ServiceInstance)instance).getServiceDef());
       
        AntTypeDefinition otherDef = new AntTypeDefinition();
        assertTrue("TypeDefinition should be same",
                   ch.getDefinition().sameDefinition(ch.getDefinition(), project));
        assertTrue("TypeDefinition shouldn't be same",
                   !ch.getDefinition().sameDefinition(otherDef, project));
        assertTrue("TypeDefinition should be similar",
View Full Code Here

        if (serviceDef == null) {
            if (serviceName == null) {
                throw new BuildException("No Service Definition found!");
            } else {
                ComponentHelper helper = ComponentHelper.getComponentHelper(getProject());
                AntTypeDefinition def = helper.getDefinition(serviceName);
                Object obj = def.create(getProject());
                if (obj instanceof ServiceInstance) {
                    serviceDef = ((ServiceInstance)obj).getServiceDef();
                } else {
                    throw new BuildException("No Service Definition found!");
                }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.AntTypeDefinition

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.