Re: Generating additional Classes from an Entity with Velocity EOGenerator

From: David Avendasora (webobject..vendasora.com)
Date: Thu Mar 06 2008 - 11:50:04 EST

  • Next message: Jeremy Matthews: "10.4 installer?"

    See below:

    On Mar 6, 2008, at 10:36 AM, John Huss wrote:

    > This reason I'm interested in this is that I started playing with
    > GWT (Google Web Toolkit). It is a similar model to Java Client in
    > that the EOs need to be serialized and sent to the client. But the
    > rules for serialization make difficult if not impossible to send a
    > real EO, so for the moment I settled on creating a regular set of EO
    > classes and additionally creating a set of "record" classes for the
    > client which are just a bunch of public instance variables.
    >
    >
    > What I would like to see is just some added flexibility in
    > specifying the generated java filenames and paths, maybe like this:
    >
    > 1) Ability to override the package directory structure to put the
    > files in a different package (like a client and server package both
    > having a _Entity and a Entity class)
    >
    > 2) Ability to add a token to the file-name/class-name, like to have
    > _ClientEntity and ClientEntity instead of just _Entity and Entity.
    > I thought setting the Client Class Name in EM might do this, but
    > changing the class name here doesn't change the file name.

    What EOGenerator are you using? Veogen? The old EOGenerator?

    If you are using the old EOGenerator there is a way to do it, but in
    the interest of moving forward, switch to Veogen and the latest
    nightly build of WOLips. :) If you really need to use the old one, I
    can give you instructions on that as well.

    For Veogen:

    Mike Schrag (thanks!!!) made some changes to this process just
    yesterday, so what didn't work 2 days ago, now does. Go get the latest
    nightly build of WOlips.

    1) You will need the following:
             server.eogen
            _EntityServer.java
            EntityServer.java
            client.eogen
            _EntityClient.java
            EntityClient.java

    2) Your server.eogen and *Server.java templates are pretty-much your
    normal run-of-the-mill templates.

    3) In your client.eogen file, you MUST select the "Java Client" option
    only. Don't select the "Java" option (this is a one-or-the-other thing
    that the UI doesn't enforce, yet). This will set the -javaclient flag
    that Veogen needs to know _which_ class name field you want to use for
    generating your classes.

    4) In your _EntityClient.java template, don't use the
    $entity.entityName binding as that will always resolve to the Server-
    Side Class Name. Use the classNameWithDefault,
    classNameWithoutPackage, classNameWithOptionalPackage, etc bindings.
    This tells Veogen to use which ever Class Name is right for the -java
    or -javaclient flag. Basically, these bindings will work for both
    server- and client-side templates.

    5) Look at the Java Client templates I just uploaded today to the Wiki
    (http://wiki.objectstyle.org/confluence/pages/viewpage.action?pageId=2655245
    ). They should help you. If you have any questions just let me know
    and I'll try to help.

    I have several feature requests in for changes to Entity Modeler and
    Veogen that are Java Client specific but could potentially work for
    what you are looking for also. If generalizing them would make the
    same change useful to more people, I'm all for that, as I'm sure Mike
    would be too.

    Get a JIRA account and vote for issues!

    Dave

    >
    >
    > 3) The .eogen file editor in WOLips could use some improvements in
    > the descriptions for the options there and even some tooltips with
    > more info. Right now the options there are really hard to interpret
    > without just trying them to see what they do.

    Mike has made some changes just yesterday on this too.
    >
    >
    > John
    >
    > Why do you want additional classes for each Entity? I have reasons for
    > wanting a "common" class in addition to "server" and "client" ones and
    > if there are others who want similar functionality we should work
    > together on what the requirements would be so we can submit a feature
    > request.
    >



    This archive was generated by hypermail 2.0.0 : Thu Mar 06 2008 - 11:51:32 EST