OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sdo message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [sdo] Groups - HelperContext Creation - Version 8 (HelperContextCreation-v8.zip) uploaded


Hi Blaise,

You're right that the Environment impl could just pass in the right classloader, but I thought that a generalized implementation would want to try both the contextClassLoader and the EnvironmentImpl class loader, so just doing it there was very convenient. I suppose the implementation of getHelperContextFactory() could easily try calling createHelperContextFactory(ClassLoader) twice if the first CL fails.

Since createHelperContextFactory(ClassLoader) isn't going to leverage anything from "this" and since it's really just a helper method, maybe you should make it "static" and "protected".

Yes, I have been trying this in the OSGi environment. The only other thing I added to make it work in OSGi was an Environement.setInstance() method. If you come up with a better approach, let me know and I'll give it a try.

Thanks,
Frank

Inactive hide details for Blaise Doughan <blaise.doughan@oracle.com>Blaise Doughan <blaise.doughan@oracle.com>


          Blaise Doughan <blaise.doughan@oracle.com>

          05/21/2009 10:39 AM


To

Frank Budinsky/Toronto/IBM@IBMCA

cc


Subject

Re: [sdo] Groups - HelperContext Creation - Version 8 (HelperContextCreation-v8.zip) uploaded

Hi Frank,

Since getHelperContextFactory(ClassLoader) is a utility method in Environment, couldn't the implementation of Environment just call the method with the correct class loader? Also wouldn't classLoader be a child of (or possibly the same as) Environment.getClass().getClasLoader() anyways? Did you see this particular problem when trying this API out in an OSGi environment?

-Blaise

Frank Budinsky wrote:

      Hi Blaise,

      One more thing. It would be good if something like the following (
      red) could be added to Environment.getHelperContextFactory():

      public
      HelperContextFactory getHelperContextFactory(ClassLoader classLoader) {
      String impl =
      getImplementationName(HELPER_CONTEXT_FACTORY);
      if
      (null == impl) {
      try
      {
      impl =
      getImplementationName(classLoader, HELPER_CONTEXT_FACTORY);
      if
      (null == impl) {
      classLoader =
      this.getClass().getClassLoader();
      impl =
      getImplementationName(classLoader, HELPER_CONTEXT_FACTORY);
      if
      (null == impl) {
      throw
      new RuntimeException("HelperContextFactory implementation not found.");
      }
      }
      }
      catch (IOException e) {
      throw
      new RuntimeException(e);
      }
      }

      try
      {
      return
      (HelperContextFactory) classLoader.loadClass(impl).newInstance();
      }
      catch(Exception e) {
      throw
      new RuntimeException(e);
      }
      }


      This accommodates the OSGi case where the Environment and HelperContextFactory impl classes are both in the same OSGi bundle, but are hidden from the client bundle.

      Thanks,
      Frank.

      Inactive hide details for Frank Budinsky/Toronto/IBM@IBMCAFrank Budinsky/Toronto/IBM@IBMCA

                      Frank Budinsky/Toronto/IBM@IBMCA

                      05/19/2009 05:51 PM

      To

      sdo@lists.oasis-open.org
      cc
      Subject

      Re: [sdo] Groups - HelperContext Creation - Version 8 (HelperContextCreation-v8.zip) uploaded

      Hi Blaise,

      There are a couple of problems with the latest drop.

      1, The SDO JavaDoc is still not quite right. Specifically, this appears in both the SDO.getHelperContextFactory() methods:


      *
      <pre>
      *
      SDO.getHelperContextFactory() == SDO.getHelperContextFactory();
      *
      </pre>

      Also, the getDefaultHelperContext() methods has no JavaDoc.

      2. Environment.getInstance() has a bug. This part:


      try
      {
      return
      (Environment) classLoader.loadClass(impl).newInstance();
      }
      catch(Exception e) {
      throw
      new RuntimeException(e);
      }


      should be changed to this:


      try
      {
      INSTANCE
      = (Environment) classLoader.loadClass(impl).newInstance();
      }
      catch(Exception e) {
      throw
      new RuntimeException(e);
      }


      3. The Environment.getHelperContextFactory() method is called by SDO.getHelperContextFactory(), which is expecting the default HelperContextFactory to be returned, but Environement.getHelperContextFactory() is just returning a new instance. It can be overridden in a subclass to cache the first one that super returns, but that seems kind of confusing. I'd suggest making Environement.getHelperContextFactory() abstract, and renaming the two existing Environment.getHelperContextFactory() methods to createHelperContextFactory() instead.

      Thanks,
      Frank.

      Inactive hide details for blaise.doughan@oracle.comblaise.doughan@oracle.com
      To

      sdo@lists.oasis-open.org
      cc
      Subject

      [sdo] Groups - HelperContext Creation - Version 8 (HelperContextCreation-v8.zip) uploaded

      Hello All,

      This revision reflects the results of today's conference call (May 19th).
      One new item of note is that some work needs to be done improving the
      exceptions that are thrown, feedback welcome.

      -Blaise

      -- Mr. Blaise Doughan

      The document revision named HelperContext Creation - Version 8
      (HelperContextCreation-v8.zip) has been submitted by Mr. Blaise Doughan to
      the OASIS Service Data Objects (SDO) TC document repository.  This document
      is revision #7 of HelperContextCreation.zip.

      Document Description:
      As discussed in todays meeting:
      - Change the Map properties on HelperContextFactory to be Map&lt;String,
      Object&gt; instead of Map&lt;Object, Object&gt;.
      - Fixed the null checking on a couple of methods in Environment.
      - Fixed some java doc comments in the SDO class.

      Recap of all changes:
      - New Classes:
      - commonj.sdo.helper.SDO
      - commonj.sdo.helper.HelperContextFactory
      - commonj.sdo.impl.Resolvable
      - commonj.sdo.impl.Environment
      - New API:
      - HelperContext.getIdentifier():  String
      - Type.getHelperContext():  HelperContext
      - Deprecation:
      - commonj.sdo.impl.HelperProvider
      - commonj.sdo.impl.ExternalizableDelegator

      Outstanding items:
      - OSGi: Do we need a setInstance method on Environment.
      - Thrown Exceptions:  Currently the proposed code makes some use of
      RuntimeException with either a simple nested exception or a
      non-internationalized string.  This needs to be fixed, any ideas?

      View Document Details:

      http://www.oasis-open.org/committees/document.php?document_id=32593

      Download Document:  

      http://www.oasis-open.org/committees/download.php/32593/HelperContextCreation-v8.zip

      Revision:
      This document is revision #7 of HelperContextCreation.zip.  The document
      details page referenced above will show the complete revision history.


      PLEASE NOTE:  If the above links do not work for you, your email application
      may be breaking the link into two pieces.  You may be able to copy and paste
      the entire link address into the address field of your web browser.

      -OASIS Open Administration


GIF image



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]