Re: Incorporating VPP code into cgen

From: Mike Kienenberger (mkienen..laska.net)
Date: Tue May 24 2005 - 11:08:37 EDT

  • Next message: Mike Kienenberger: "Re: Incorporating VPP code into cgen"

    Erik Hatcher <eri..hatchersolutions.com> wrote:
    > On May 23, 2005, at 9:18 PM, Mike Kienenberger wrote:
    > > public Object createConfig() {
    > > this.vppConfig = new VPPConfig();
    > > return this.vppConfig;
    > > }
    >
    > This construct should be fine - Ant doesn't care about the return
    > type of the object in this case - it will use the same reflect magic
    > that it does on the task itself to dig into the object when needed.

    Right. I don't think java supports this distinction. It's why you can't
    overload the return type.
    And sure enough, that appears to be all that I needed to do. I'm not sure
    why they were using addConfiguredConfig(), but it appears to be working fine
    like this. I guess I gave up a couple minutes too early :)

    The regressions all work, so I think the dependency issue is handled.

    using <config refid="vppconfig0" /> fails with "vppconfig0 does not refer to
    a VPPConfig".

    Maybe it's some kind of ant classloader problem, because the <vppconfig> tag
    parses properly (and from what I can understand from the ant -debug output,
    it is using the VPPConfig class for the type.), yet the cgen task doesn't
    think it's a VPPConfig instance.

    Changing the source to output the class referenced shows that it is a
    foundrylogic.vpp.VPPConfig class.

    E:\Applications\eclipse3.1M4\workspace\cayenne\build-regression.xml:145:
    vppconfig0 does not refer to a VPPConfig:
    o.getClass().getName()=foundrylogic.vpp.VPPConfig

    I don't know how to deal with that problem, so I guess I'll let someone else
    figure it out if they want that functionality.

    -Mike
    --------------------------------------------------------------
                <taskdef name="cgen12"
    classname="org.objectstyle.cayenne.tools.CayenneGenerator">
                     <classpath refid="classpathPlusVpp"/>
                </taskdef>
            
                <typedef name="vppconfig" classname="foundrylogic.vpp.VPPConfig">

                     <classpath refid="classpathPlusVpp"/>
                </typedef>
                <vppconfig id="vppconfig0" >
                    <context>
                        <property key="foo" value="bar" />
                        <tool key="StringBuffer"
    className="java.lang.StringBuffer" />
                    </context>
                </vppconfig>

                <cgen12 map="${resources.test.classgeneration}/testmap.map.xml"
                    version="1.2"
                    destDir="${testrun.classgeneration}/1_2/singleclass"
                    makepairs="false"
                    overwrite="true"
                    usepkgpath="false"
                    superpkg="org.objectstyle.art.auto">
                    <config refid="vppconfig0" /> <!-- line 145 -->
                </cgen12>
    --------------------------------------------------------------
    =====================================================================================
    Finding class foundrylogic.vpp.VPPConfig
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\otherlib\foundrylogic
    -vpp-2.2.1.jar foundrylogic/vpp/VPPConfig.class
    Class org.apache.tools.ant.types.DataType loaded from parent loader
    (parentFirst
    )
    Class foundrylogic.vpp.VPPConfig loaded from ant loader (parentFirst)
    Class org.apache.tools.ant.BuildListener loaded from parent loader
    (parentFirst)

    Class org.apache.tools.ant.util.FileUtils loaded from parent loader
    (parentFirst
    )
    Class org.apache.tools.ant.types.Reference loaded from parent loader
    (parentFirs
    t)
    Class org.apache.tools.ant.Project loaded from parent loader (parentFirst)
    Finding class org.apache.velocity.VelocityContext
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\dist\cayenne-1.2-dev\
    lib\cayenne.jar org/apache/velocity/VelocityContext.class
    Finding class org.apache.velocity.context.AbstractContext
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\dist\cayenne-1.2-dev\
    lib\cayenne.jar org/apache/velocity/context/AbstractContext.class
    Finding class org.apache.velocity.context.InternalContextBase
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\dist\cayenne-1.2-dev\
    lib\cayenne.jar org/apache/velocity/context/InternalContextBase.class
    Class java.io.Serializable loaded from parent loader (parentFirst)
    Class org.apache.velocity.context.InternalContextBase loaded from ant loader
    (pa
    rentFirst)
    Class org.apache.velocity.context.AbstractContext loaded from ant loader
    (parent
    First)
    Class org.apache.velocity.VelocityContext loaded from ant loader
    (parentFirst)
    Finding class foundrylogic.vpp.VPPContext
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\otherlib\foundrylogic
    -vpp-2.2.1.jar foundrylogic/vpp/VPPContext.class
    Class foundrylogic.vpp.VPPContext loaded from ant loader (parentFirst)
    Finding class foundrylogic.vpp.VPPEngine
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\otherlib\foundrylogic
    -vpp-2.2.1.jar foundrylogic/vpp/VPPEngine.class
    Class foundrylogic.vpp.VPPEngine loaded from ant loader (parentFirst)
    Finding class org.apache.velocity.app.VelocityEngine
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\dist\cayenne-1.2-dev\
    lib\cayenne.jar org/apache/velocity/app/VelocityEngine.class
    Class org.apache.velocity.app.VelocityEngine loaded from ant loader
    (parentFirst
    )
    Finding class foundrylogic.vpp.log.VPPTaskLogAdapter
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\otherlib\foundrylogic
    -vpp-2.2.1.jar foundrylogic/vpp/log/VPPTaskLogAdapter.class
    Finding class foundrylogic.vpp.log.VPPLogAdapterSupport
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\otherlib\foundrylogic
    -vpp-2.2.1.jar foundrylogic/vpp/log/VPPLogAdapterSupport.class
    Class foundrylogic.vpp.log.VPPLogAdapterSupport loaded from ant loader
    (parentFi
    rst)
    Class foundrylogic.vpp.log.VPPTaskLogAdapter loaded from ant loader
    (parentFirst
    )
    Finding class foundrylogic.vpp.log.VPPProjectLogAdapter
    Loaded from
    E:\Applications\eclipse3.1M4\workspace\cayenne\otherlib\foundrylogic
    -vpp-2.2.1.jar foundrylogic/vpp/log/VPPProjectLogAdapter.class
    Class foundrylogic.vpp.log.VPPProjectLogAdapter loaded from ant loader
    (parentFi
    rst)
          [ant] Exiting
    E:\Applications\eclipse3.1M4\workspace\cayenne\build-regress
    ion.xml.

    BUILD FAILED
    E:\Applications\eclipse3.1M4\workspace\cayenne\build.xml:123: The following
    erro
    r occurred while executing this line:
    E:\Applications\eclipse3.1M4\workspace\cayenne\build-regression.xml:145:
    vppconf
    ig0 does not refer to a VPPConfig
            at
    org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
    tHelper.java:539)
            at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:384)
            at
    org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
            at org.apache.tools.ant.Task.perform(Task.java:364)
            at org.apache.tools.ant.Target.execute(Target.java:341)
            at org.apache.tools.ant.Target.performTasks(Target.java:369)
            at
    org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
            at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
            at
    org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
    cutor.java:40)
            at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
            at org.apache.tools.ant.Main.runBuild(Main.java:668)
            at org.apache.tools.ant.Main.startAnt(Main.java:187)
            at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
            at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
    Caused by:
    E:\Applications\eclipse3.1M4\workspace\cayenne\build-regression.xml:1
    45: vppconfig0 does not refer to a VPPConfig
            at foundrylogic.vpp.VPPConfig.setRefid(Unknown Source)

        public void setRefid(Reference ref) {
            Object o = ref.getReferencedObject(getProject());
            if(o instanceof VPPConfig) {
    // [...]
            }
            else {
                String msg = ref.getRefId() + " does not refer to a VPPConfig";
                throw new BuildException(msg);
            }



    This archive was generated by hypermail 2.0.0 : Tue May 24 2005 - 11:06:23 EDT