You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "David T. Adcox (JIRA)" <tu...@ws.apache.org> on 2007/07/12 18:08:05 UTC

[jira] Updated: (TUSCANY-1143) Generated code should separate metadata creation from registration to permit proper scoping

     [ https://issues.apache.org/jira/browse/TUSCANY-1143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David T. Adcox updated TUSCANY-1143:
------------------------------------

    Attachment: 1143.patch

Working through this problem I have found some issues that warrant a discussion.  I've made some 'executive' decisions on these matters, but I think they still are valid discussion points.

1) One of the design points was to move the dependent package registration from the init() method up into the register(HelperContext) method.  That went well, but I found initializing each dependent package triggered a need for the dependent factories static factory.  This wasn't good, since we can't retrieve that until the package has registered with the provided scope.  So, a portion of the metadata initialization can not take place UNTIL the register(HC) is called.  

2) FactoryBase still contained calls to the global registry.  Specifically, it contained three such calls.  I've commented out two of the registration calls, since this activity is accomplished in the generated code now using the provided HC scope.  The third reference will need to remain as it is part of a public static method used to retrieve a static factory.  I didn't deprecate this method, but it would seem logical that we should.  Additionally, I created a new Instance method that performs a similar action using the instance scope rather than the global one.

3) The current method for tracking whether or not the package was initialized was via a boolean.  If this was true, the init() method would return the created instance by calling the global registry.  This needed to be changed and since I don't really have access to any registry during init() time under this new design, I changed the way the instance retrieval logic works.  Now, I create a class static instance that is used to track whether or not the init has been executed.  This class static is used to keep that object available for retrieval on subsequent init() calls. 

Take a look over what I've done, let me know if we need to clean up anything and whether or not you'd like to see the old FactoryBase.getStaticFactory(URI) method deprecated.


> Generated code should separate metadata creation from registration to permit proper scoping
> -------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1143
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1143
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Tools
>    Affects Versions: Java-SDO-beta1
>            Reporter: Kelvin Goodson
>             Fix For: Java-SDO-1.0
>
>         Attachments: 1143.patch
>
>
> The switch to registration of metadata from the global scope to selected scopes is not complete yet, although for all current test cases there are no failures.
> Currently the generated init() method for a factory calls the deprecated SDOUtil.registerStaticTypes for its simple dependencies.
> In the simple case this is just ModelFactory and SDOFactory,  but could contain other user generated dependencies if for example
> there were to be an xsd import of another namespace (exposed a gap in our test case set).  This would mean that the user generated model dependency
> would also be registered against the global registry.
> It is proposed that all registrations, including the built in models, are made against the helper context provided to the Factory's register method.
> I.e. a state invariant that no models are ever registered against the global registry.
> The pattern of looking up models from within packages is not required, since the code can just refer to each model's singleton INSTANCE (see below for the exception SDOFactoryImpl).  Creation of the metadata should be done in the init
> method, and the registration of all metadata (built-in or otherwise) should be done in the register method. It would appear on inspection that no reference to the simple dependencies of a factory need be made in its init method,  and simple reference to the dependencies INSTANCE in the register will be enough to ensure that those dependencies are initialised before being registered against the provided scope. 
> SDOFactoryImpl does not have an INSTANCE currently.  The current proposed solution is to modify SDOFactory to have an INSTANCE, in order that it can behave like an ordinary generated dependency in this new approach.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org