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:
OFD57FE101.F0847BD5-ON852575BC.005AAD17-852575BC.005B2FE4@ca.ibm.com"
type="cite">
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.
Frank Budinsky/Toronto/IBM@IBMCA
Frank Budinsky/Toronto/IBM@IBMCA
05/19/2009 05:51 PM
|
|
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.
blaise.doughan@oracle.com
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<String,
Object> instead of Map<Object, Object>.
- 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
|