Re: [Wonder-disc] EntityModeler and Prototypes loading question

From: Kieran Kelleher (kieran_list..ac.com)
Date: Mon Jun 22 2009 - 06:21:10 EDT

  • Next message: JIRA: "[OS-JIRA] Created: (WOL-1028) Mac Goodies crash Eclipse 3.5RC4 x86_64"

    OK, so I am on the same page with regards patchesModelOnLoad = false
    and using a property to define the EOModel subclass = ERXModel.

    So to get extended prototypes, you must set this:
    # To get Wonder's EOModel subclass, which supports extended prototypes
    #..ee ERXModel#createPrototypes(EOModel model)
    er.extensions.ERXModelGroup.modelClassName =
    com.webobjects.eoaccess.ERXModel

    OK, so I did set this on a regular project and I get an NPE, so let's
    not set it as default yet until the NPE risk is solved.

    Here are details of app models and the NPE:

    properties that are relevant:
    # A model with one proto entity named EOPrototypes. This is the only
    proto entity (currently) used on this app
    er.extensions.ERXModelGroup.prototypeModelNames=WKPrototypes

    In adddition to one proto eomodel, there are 3 database eomodels:
            cheetah
            EmailData
            WKDemography

    Here is the console log (which has some extra sys.out's in ERX to see
    relevent vars):

    <snip>
    1153 WARN [main] (extensions.eof.ERXModelGroup,
    loadModelsFromLoadedBundles, 132) -
    Clearing previous class descriptions

    ERXModelGroup:addModelWithPathURL: Adding model named 'WKPrototypes'
    of type com.webobjects.eoaccess.ERXModel
    1359 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting WKPrototypes

    1360 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 931) -
    New Connection Dictionary for WKPrototypes: {password = "<deleted for
    log>"; username = ""; URL = "jdbc:mysql://127.0.0.1/MYDATABASE"; }

    1360 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting WKPrototypes

    ERXModelGroup:addModelWithPathURL: Adding model named 'cheetah' of
    type com.webobjects.eoaccess.ERXModel
    1694 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting cheetah

    1695 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 931) -
    New Connection Dictionary for cheetah: {username = "w3b0bj3cts";
    password = "<deleted for log>"; URL = "jdbc:mysql://localhost/cheetah?
    capitalizeTypenames=true"; }

    1695 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting cheetah

    ERXModelGroup:addModelWithPathURL: Adding model named 'demography' of
    type com.webobjects.eoaccess.ERXModel
    1779 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting demography

    1779 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 931) -
    New Connection Dictionary for demography: {username = "w3b0bj3cts";
    password = "<deleted for log>"; URL = "jdbc:mysql://localhost/
    demography?capitalizeTypenames=true"; }

    1781 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting demography

    ERXModelGroup:addModelWithPathURL: Adding model named 'EmailData' of
    type com.webobjects.eoaccess.ERXModel
    1794 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting EmailData

    1794 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 931) -
    New Connection Dictionary for EmailData: {password = "<deleted for
    log>"; username = "w3b0bj3cts"; URL = "jdbc:mysql://localhost/
    emaildata?capitalizeTypenames=true"; }

    1795 DEBUG [main] (extensions.eof.ERXModelGroup,
    resetConnectionDictionaryInModel, 897) -
    Adjusting EmailData

    1805 INFO [main] (webobjects.eoaccess.ERXModel, createPrototypes, 87) -
    Creating prototypes for model: EmailData->{password = "< deleted >";
    username = "w3b0bj3cts"; URL = "jdbc:mysql://localhost/emaildata?
    capitalizeTypenames=true"; }

    ERXModel.addAttributesToPrototypesCache(EOEntity entity): entity =
    EOPrototypes
    1817 INFO [main] (webobjects.eoaccess.ERXModel, attributesFromEntity,
    77) -
    Attributes from EOPrototypes: (<EOAttribute blowfishString 5747002>,
    <EOAttribute boolean 3442227>, <EOAttribute data16Megabyte 5668579>,
    <EOAttribute data4Gigabyte 10778919>, <EOAttribute date 926873>,
    <EOAttribute dateTime 8710544>, <EOAttribute emailAddress
      129542>, <EOAttribute mutableArray 12964792>, <EOAttribute
    mutableDictionary 13568183>, <EOAttribute nsdictionaryStrings
    4547540>, <EOAttribute numBoolean 10293419>, <EOAttribute numByte127
    11635056>, <EOAttribute numDouble 11946014>, <EOAttribute numInt9Dgt2
    Billion 3720084>, <EOAttribute numIntBig18DgtQuintillion 11557212>,
    <EOAttribute numMoney 12240026>, <EOAttribute numShort32000 12685357>,
    <EOAttribute oid 14719495>, <EOAttribute phone 10517103>, <EOAttribute
    str001 12991592>, <EOAttribute str010 10998346>, <
    EOAttribute str016 14627604>, <EOAttribute str050 9608018>,
    <EOAttribute str100 1269044>, <EOAttribute str255 4992930>,
    <EOAttribute strOSType 13328362>, <EOAttribute string16Mb 403367>,
    <EOAttribute string65000 1397453>, <EOAttribute text65000 15673831>,
    <EOA
    ttribute xCreditCard 11023767>, <EOAttribute xMimeType 5658787>,
    <EOAttribute xPersonTitle 13977592>, <EOAttribute xaddress 6814623>,
    <EOAttribute xbusiness 12094761>, <EOAttribute xcassDate 3912821>,
    <EOAttribute xcity 12878851>, <EOAttribute xerrorCode 11985
    635>, <EOAttribute xfirstName 15324060>, <EOAttribute xfullName
    4437400>, <EOAttribute xlastName 4664461>, <EOAttribute xstate
    12454728>, <EOAttribute xzip 14082271>, <EOAttribute zDpcDigits
    4549785>, <EOAttribute zMoveFootnote 14474379>, <EOAttribute zRecAddT
    ime 1264369>, <EOAttribute zRecAddUser 10307467>, <EOAttribute
    zRecModTime 12848789>, <EOAttribute zRecModUser 10061111>,
    <EOAttribute zUserId 16310858>, <EOAttribute zcarRt 13661198>,
    <EOAttribute zdpBarcode 7559841>, <EOAttribute zendorsementLine
    4401482>, <
    EOAttribute zlotNum 4971724>, <EOAttribute zmatchType 9237505>,
    <EOAttribute zmoveEffective 15170110>, <EOAttribute zmoveType 697447>,
    <EOAttribute zpackageNumber 11498117>, <EOAttribute zpresortID
    8891488>, <EOAttribute ztrayNumber 4590154>, <EOAttribute zwal
    kSequence 5087418>, <EOAttribute zzip4 7543599>, <EOAttribute zzip5
    16630789>)

    ERXModel.addAttributesToPrototypesCache(EOModel model, NSArray<?
    extends EOAttribute> attributes): model = WKPrototypes
    ERXModel.addAttributesToPrototypesCache(EOModel model, NSArray<?
    extends EOAttribute> attributes): _prototypesByName = null
    1821 WARN [main] (extensions.logging.ERXNSLogLog4jBridge, appendln,
    43) -
    A fatal exception occurred: null

    [2009-06-22 06:09:21 EDT] <main> java.lang.NullPointerException
            at
    com
    .webobjects
    .eoaccess.ERXModel.addAttributesToPrototypesCache(ERXModel.java:63)
            at
    com
    .webobjects
    .eoaccess.ERXModel.addAttributesToPrototypesCache(ERXModel.java:45)
            at com.webobjects.eoaccess.ERXModel.createPrototypes(ERXModel.java:108)
            at
    com.webobjects.eoaccess.ERXModel.prototypeAttributeNamed(ERXModel.java:
    217)
            at com.webobjects.eoaccess.EOAttribute.<init>(EOAttribute.java:923)
            at com.webobjects.eoaccess.EOEntity.attributes(EOEntity.java:675)
            at
    er
    .extensions
    .eof.ERXModelGroup.modifyModelsFromProperties(ERXModelGroup.java:1085)
            at
    er
    .extensions
    .eof.ERXModelGroup.loadModelsFromLoadedBundles(ERXModelGroup.java:211)
            at er.extensions.ERXExtensions.defaultModelGroup(ERXExtensions.java:
    135)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at
    sun
    .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    39)
            at
    sun
    .reflect
    .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at
    com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:
    120)
            at com.webobjects.foundation._NSDelegate._perform(_NSDelegate.java:225)
            at com.webobjects.foundation._NSDelegate.perform(_NSDelegate.java:158)
            at
    com.webobjects.eoaccess.EOModelGroup.defaultGroup(EOModelGroup.java:365)
            at wk.cheetah.Application.<init>(Application.java:218)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    Method)
            at
    sun
    .reflect
    .NativeConstructorAccessorImpl
    .newInstance(NativeConstructorAccessorImpl.java:39)
            at
    sun
    .reflect
    .DelegatingConstructorAccessorImpl
    .newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
            at java.lang.Class.newInstance0(Class.java:350)
            at java.lang.Class.newInstance(Class.java:303)
            at com.webobjects.appserver.WOApplication.main(WOApplication.java:323)
            at er.extensions.appserver.ERXApplication.main(ERXApplication.java:632)
            at wk.cheetah.Application.main(Application.java:98)

    </snip>

    So right now, the logic is attempting to add the model entity
    WKPrototypes/EOPrototypes to the proto cache of WKPrototypes. Is that
    the intention? If so, the the proto cache needs to be lazily created
    here if null. However if your intention was to add the prototypes
    EOPrototypes from model WKPrototypes to the proto cache for the model
    EmailData, then you need to change some code to pass the model too for
    the method with current signature private static void
    addAttributesToPrototypesCache(EOEntity entity)

    What is the intention of that method?

    Regards, Kieran

    On Jun 21, 2009, at 6:40 PM, Lachlan Deck wrote:

    > Hi there,
    >
    > On 21/06/2009, at 1:14 AM, Mike Schrag wrote:
    >
    >> Ah .. here's the "why". This is a question for Lachlan ... I don't
    >> know if this was a merge problem or, if not, why he's piggy-backing
    >> on patchesModelOnLoad,
    >
    > Which I'm not btw. patchesModelOnLoad doesn't need to be true.
    >
    >> which I can't imagine ever actually wanting turned on.
    >
    > I've got:
    > er.extensions.ERXModelGroup.patchModelsOnLoad=false
    > er
    > .extensions
    > .ERXModelGroup.prototypeModelNames=ISHEOPrototypes,erprototypes
    >
    > well, okay I've also got:
    > er.extensions.defaultModelGroupClassName=ish.wonder.ISHModelGroup
    >
    > What you want is:
    > er.extensions.ERXModel.useExtendedPrototypes=true
    >
    >> You could also set er.extensions.ERXModelGroup.modelClassName to
    >> the Model class explicitly. I'm not sure we shouldn't default to
    >> that, actually?
    >>
    >> ms
    >>
    >> On Jun 20, 2009, at 11:06 AM, Kieran Kelleher wrote:
    >>
    >>> I had looked at the ERXModelGroup source to look for something that
    >>> might indicate some scheme like that, but had not noticed anything.
    >>> After getting your reply I now looked at ERXModelGroup svn history,
    >>> I see Anjo's commit of this feature to ERXModelGroup$Model on
    >>> 2/19/2009 and that you moved Anjo's logic for this over to ERXModel
    >>> subclass on 3/29/2009.
    >>>
    >>> It appears that the property
    >>> er.extensions.ERXModelGroup.patchModelsOnLoad needs to be true to
    >>> ensure that (ERXModelGroup$Model extends ERXModel extends EOModel)
    >>> is used instead of plain old EOModel.
    >
    > Not so. The old ERXModelGroup$Model already extended EOModel and was
    > used for the patching of models on load. What I added was ERXModel
    > (which ERXModelGroup$Model now also extends) to share the code between
    > them for using custom prototypes.
    >
    > So the default now is that the runtime model is always an ERXModel.
    >
    >>> What might be a cause for concern is the fact that this property is
    >>> not listed anywhere in ERXExtensions/Properties or in a new
    >>> WOnderApp/Properties and in a default Wonder integration, this
    >>> propery defaults to false. Without looking at the source just now,
    >>> I would not have realized that I have never had that property set
    >>> to true in any app.
    >>>
    >>> So, to see what happens, I put that property into two apps just now
    >>> and they blow up with NPE's and terminate on startup.
    >
    > Where's my stack trace? :-)
    >
    >>> Just started 2 new discussion threads on those so we can see if we
    >>> can solve these 2 different NPE cases. If patchesModelsOnLoad can
    >>> only be used under certain conditions, I will happily document that
    >>> along with some docs that explain the Custom protos (aka extended
    >>> protos usage) and configuration.
    >
    > Are you using a recent Wonder? There was an NPE fixed some weeks ago.
    >
    > See thread "ERAttachment and own Prototypes" with Ramsey Gurley and
    > myself.
    >
    > with regards,
    > --
    >
    > Lachlan Deck
    >
    >
    >
    >
    > ------------------------------------------------------------------------------
    > Are you an open source citizen? Join us for the Open Source Bridge
    > conference!
    > Portland, OR, June 17-19. Two days of sessions, one day of
    > unconference: $250.
    > Need another reason to go? 24-hour hacker lounge. Register today!
    > http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
    > _______________________________________________
    > Wonder-disc mailing list
    > Wonder-dis..ists.sourceforge.net
    > https://lists.sourceforge.net/lists/listinfo/wonder-disc



    This archive was generated by hypermail 2.0.0 : Mon Jun 22 2009 - 06:22:53 EDT