[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: AW: [sdo] New HelperProvider implementation
Hi Frank, I agree with the points that HelperProvider should continue to work and that introducing (or at least re-purposing) HelperProviderImpl is wrong. I do not see a benefit in having HelperProvider extend HelperContextFactory as SDO implementors would just need to extend their implementations of HelperProvider, instead they should be creating implementations of HelperContextFactory. Instead I have attached a new version of HelperProvider that I feel is very compatible with the new cleaner model. -Blaise Frank Budinsky wrote: > Hi Blaise, > > I think it is necessary for the deprecated HelperProvider to still > continue to work. I don't think your proposal to add a new subclass > (HelperProviderImpl) to the spec is the right approach though. I think a > better approach would be to change HelperProvider to extend > HelperContextFactory, similar to the way I had proposed making it a > subclass of SDOImplementation (see my earlier attachments). I think this > way, if an implementation has a HelperProvider implementation subclass of > its own, it will continue to work until they decide to switch to the > cleaner model. > > Frank > > > > > Blaise Doughan <blaise.doughan@oracle.com> > 02/12/2009 03:41 PM > > To > "sdo@lists.oasis-open.org >> \"sdo@lists.oasis-open.org\"" > <sdo@lists.oasis-open.org> > cc > > Subject > Re: AW: [sdo] New HelperProvider implementation > > > > > > > Hello All, > > If there are expectations that even though deprecated HelperProvider still > continue to work in a reasonable manner, then the attached version of > HelperProviderImpl could be used. > > I have also attached slightly updated versions of SDO and > HelperContextFactory. > > -Blaise > > Blaise Doughan wrote: > Hi Frank, > > Attached is a variant of SDOImplementation. I have taken this class and > split it into two classes: SDO and HelperContextFactory (in > commonj.sdo.helper). SDO implementors would be responsible for providing > a subclass of HelperContextFactory. > > To create a HelperContext, a user would need to do the following: > HelperContext hc = > SDO.getHelperContextFactory(String).createHelperContext(); > > This has a similar feel to JPA where users do the following: > EntityManager em = > Persistence.createEntityManagerFactory(String).createEntityManager(); > > -Blaise > > > Blaise Doughan wrote: > Hi Frank, > > I'm still looking for ways to have the default resolver handle OSGi > (nothing to propose yet). The pluggable resolver approach is something I > have borrowed from the EclipseLink JPA team. > > Thinking about the SDOImplementation class more, I think it requires some > additional createHelperContext methods. I have attached the updated > class, the new create methods are also shown below: > > /** > * Create a new HelperContext in this implementation. > * @param properties - Properties required to initialize the > HelperContext. > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(Map properties); > > /** > * Create a new HelperContext in this implementation. > * @param classLoader - The class loader for the generated static classes > (if any). > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(ClassLoader > classLoader); > > /** > * Create a new HelperContext in this implementation. > * @param classLoader - The class loader for the generated static classes > (if any). > * @param properties - Properties required to initialize the > HelperContext. > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(ClassLoader > classLoader, Map properties); > > > -Blaise > > Frank Budinsky wrote: > Hi Blaise, > > I think that the added flexibility of a pluggable resolver approach sounds > good. I also think we should also try to make the default resolver handle > all the cases we can think of so that needing to plug in a custom resolver > will be less likely. Is there something else that we should/could do in > the default resolver to handle the OSGi case? > > Thanks, > Frank > > > > > Blaise Doughan <blaise.doughan@oracle.com> 02/06/2009 12:13 PM > > To > Frank Budinsky/Toronto/IBM@IBMCA > cc > sdo@lists.oasis-open.org > Subject > Re: AW: [sdo] New HelperProvider implementation > > > > > > > Hi Frank, > > What about making the implementation look-up more pluggable? Attached is > a modified version of SDOImplementation that provides a plug-in mechanism > for looking up implementations (ImplmentationResolver). By default it > behaves exactly as what you proposed. The plugin-mechanism would allow > the behaviour to be changed for other environments such as OSGi. > > -Blaise > > Blaise Doughan wrote: Hi Frank, > > Along with your proposed changes the following would be required to > ExternalizableDelegator (also attached). > > public ExternalizableDelegator() > { > delegate = SDOImplementation.getInstance().resolvable(); > } > > public ExternalizableDelegator(Object target) > { > delegate = SDOImplementation.getInstance().resolvable(target); > } > > > I think in general this means that the HelperContext used for > deserialization will become: > SDOImplementation.getInstance().getDefaultContext(); > > As opposed to: > HelperProvider.getDefaultContext(); > > -Blaise > > > > Frank Budinsky wrote: Hi Guys, > > Since we'd like to get rid of all the INSTANCE fields for SDO-96, I was > thinking that all the static getXXXHelper() methods in HelperProvider > should also go. Once we remove all this, I think we're not left with much > interesting content in HelperProvider, so I think that maybe we should > just deprecate the entire class HelperProvider, and replace it with a > clean new API. I've attached my first pass at this, class > SDOImplementation. I've deprecated HelperProvider, but made it a subclass > of SDOImplementation, for backward compatibility. Comments welcome. > > Thanks, > Frank. > > > > > > > > Frank Budinsky/Toronto/IBM@IBMCA 01/13/2009 10:51 AM > > To > sdo@lists.oasis-open.org > cc > > Subject > Re: AW: [sdo] New HelperProvider implementation > > > > > > > Hi Ron, > Thanks for looking at it. You're right that is is a partial resolution to > SDO-96. My thinking was that SDO-96 is one of the issues that we can > resolve in the virtual F2F, but I wanted to get some starting material for > > > discussion on the table before that. I think there are several aspects to > the issue that we'll want to discuss in detail. > One thing that I definitely had intended this class to do, but forgot, was > > > to allow more that one impl/service to be located. I've attached a > slightly modified version here. > > > > Thanks, > Frank. > > > > > "Barack, Ron" <ron.barack@sap.com> 01/13/2009 10:01 AM > > To > Frank Budinsky/Toronto/IBM@IBMCA, <sdo@lists.oasis-open.org> > cc > > Subject > AW: [sdo] New HelperProvider implementation > > > > > > > Hi Frank, > > I'm guessing that this is a partial resolution to SDO-96, is that right? > If not, what is the issue that is being addressed here. > > I think holding the information in a file in meta-inf is OK, certainly an > improvement over what we have now, but in order to handle the > bootstrapping problem, I think we need some additional options. The > problem with having things in a file in meta-inf is that it doesn't really > > > change the situation about having only one SDO on the classpath, which the > > > user always gets, no matter what. > > A lot of systems allow specifying the implementation class through the > API... InitialContext is a famous example of this. Others allow > configuration through system properties ("-D"s). I think SDO should allow > > > for all 3 configuration options, with the API given highest priority, > System properties second, the mechanism which you provide third, and the > fallback solution should be the fixed class name constant, as you have > given it. > > Best Regards, > Ron > > > -----Ursprüngliche Nachricht----- > Von: Frank Budinsky [mailto:frankb@ca.ibm.com] Gesendet: Montag, 12. > Januar 2009 22:57 > An: sdo@lists.oasis-open.org > Betreff: [sdo] New HelperProvider implementation > > Hi Guys, > > Attached is a proposed new implementation for class HelperProvider. The > advantages of this impl are: > > 1. It allows SDO implementations be registered as a Java Service Provider > - > http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider > 2. Implementations should not need to replace this impl, but instead > simply plug in an subclass with necessary overrides. > 3. I believe it's backward compatible with the previous version. > > Please take a look at this impl, and let me know what you think. Maybe we > can discuss in tomorrow's call? > > Thanks, > Frank. > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > > [attachment "HelperProvider.java" deleted by Frank Budinsky/Toronto/IBM] > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php /** > > * <copyright> > * > * Service Data Objects > * Version 3.0 > * Licensed Materials > * > * (c) Copyright BEA Systems, Inc., International Business Machines > Corporation, > * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, > SAP AG., > * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, > > * 2005-2008. All rights reserved. > * > * </copyright> > * > */ > > package commonj.sdo.impl; > > import java.io.BufferedReader; > import java.io.IOException; > import java.io.InputStream; > import java.io.InputStreamReader; > import java.security.AccessController; > import java.security.PrivilegedAction; > import java.util.HashMap; > > import commonj.sdo.helper.HelperContext; > import commonj.sdo.impl.ExternalizableDelegator.Resolvable; > > /** > * Central access to an implementation of SDO. > */ > public abstract class SDOImplementation > { > /** > * Gets the implementation's default HelperContext. > * @return a HelperContext object > */ > public abstract HelperContext getDefaultHelperContext(); > > /** > * Create a new HelperContext in this implementation. > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(); > > private static ImplementationResolver implementationResolver; > > public static ImplementationResolver getImplementationResolver() { > if(null == implementationResolver) { > implementationResolver = new DefaultImplementationResolver(); > } > return implementationResolver; > } > > public static void setImplementationResolver(ImplementationResolver > anImplementationResolver) { > implementationResolver = anImplementationResolver; > } > > public static SDOImplementation getInstance() { > return getImplementationResolver().getInstance(); > } > > public static SDOImplementation getInstance(String implName) { > return getImplementationResolver().getInstance(implName); > } > > protected SDOImplementation() > { > } > > protected abstract Resolvable resolvable(); > > protected abstract Resolvable resolvable(Object target); > > public static interface ImplementationResolver { > > /** > * The name of the system property that will be checked for an > implementation name. > */ > static final String PROPERTY_NAME = > "commonj.sdo.impl.SDOImplementation"; > > /** > * The name of the resource that is used for service location. > */ > static final String SERVICE_RESOURCE_NAME = > "META-INF/services/commonj.sdo.impl.SDOImplementation"; > > SDOImplementation getInstance(); > > SDOImplementation getInstance(String implName); > > } > > private static class DefaultImplementationResolver implements > ImplementationResolver { > > /** > * Locate and instantiate the default SDOImplementation. > * @see getInstance(String) > */ > public SDOImplementation getInstance() > { > return getInstance(null); > } > > /** > * Locate and instantiate an SDOImplementation. > * <p/> > * If the specified implName is not null, attempt to instantiate an > implementation > * class with that name. If implName is null, then the name of the > implementation to use > * is determined by the value of the > "commonj.sdo.impl.SDOImplementation" system property. > * If this is not set or this code does not have permission to read > it then the name > * will be retrieved from the > META-INF/services/commonj.sdo.impl.SDOImplementation resource. > * <p/> > * Name lookup and class loading is done using first the Thread's > current context classloader > * and then, if that is not set, not readable, or does not provide > an implementation, > * using the classloader used to load the SDOImplementation class > itself. > * <p/> > * @param implName The name of the implementation class. > * @return A singleton instance of the selected SDOImplementation. > */ > public SDOImplementation getInstance(String implName) > { > if (implName == null) { > implName = getImplementationName(); > } > ClassLoader cl = getContextClassLoader(); > if (cl != null) { > SDOImplementation impl = getInstance(cl, implName); > if (impl != null) { > return impl; > } > } > cl = SDOImplementation.class.getClassLoader(); > SDOImplementation impl = getInstance(cl, implName); > if (impl != null) { > return impl; > } > return null; > } > > /** > * Map from implementation classes to their corresponding singleton > instances. > */ > protected final HashMap<Class, SDOImplementation> instanceMap = new > HashMap<Class, SDOImplementation>(); > > protected SDOImplementation getInstance(ClassLoader cl, String > implName) > { > try { > if (implName == null) { > implName = getImplementationName(cl); > if (implName == null) > return null; > } > Class instanceClass = cl.loadClass(implName); > SDOImplementation instance = instanceMap.get(instanceClass); > > if (instance == null) { > instance = > (SDOImplementation)instanceClass.newInstance(); > instanceMap.put(instanceClass, instance); > } > return instance; > } > catch (Exception e) > { > return null; > } > } > > protected String getImplementationName(ClassLoader cl) throws > IOException > { > InputStream is = cl.getResourceAsStream(SERVICE_RESOURCE_NAME); > if (is == null) return null; > InputStreamReader in = new InputStreamReader(is, "UTF-8"); > BufferedReader reader = new BufferedReader(in, 128); > try { > String line; > while ((line = reader.readLine()) != null) { > int i = line.indexOf('#'); > if (i != -1) { > line = line.substring(0, i); > } > line = line.trim(); > if (line.length() > 0) return line; > } > return null; > } finally { > reader.close(); > } > } > > protected String getImplementationName() { > try { > return (String)AccessController.doPrivileged(new > PrivilegedAction() { > public Object run() { > return System.getProperty(PROPERTY_NAME); > } > }); > } catch (SecurityException e) { > return null; > } > } > > protected ClassLoader getContextClassLoader() { > try { > return (ClassLoader)AccessController.doPrivileged(new > PrivilegedAction() { > public Object run() { > return > Thread.currentThread().getContextClassLoader(); > } > }); > } catch (SecurityException e) { > return null; > } > } > > } > > } > > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php /** > * <copyright> > * > * Service Data Objects > * Version 3.0 > * Licensed Materials > * > * (c) Copyright BEA Systems, Inc., International Business Machines > Corporation, > * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, > SAP AG., > * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, > * 2005-2008. All rights reserved. > * > * </copyright> > * > */ > package commonj.sdo.helper; > > import java.io.BufferedReader; > import java.io.IOException; > import java.io.InputStream; > import java.io.InputStreamReader; > import java.security.AccessController; > import java.security.PrivilegedAction; > import java.util.HashMap; > > public class SDO { > > private static ImplementationResolver implementationResolver; > > public static ImplementationResolver getImplementationResolver() { > if (null == implementationResolver) { > implementationResolver = new DefaultImplementationResolver(); > } > return implementationResolver; > } > > public static void setImplementationResolver(ImplementationResolver > anImplementationResolver) { > implementationResolver = anImplementationResolver; > } > > public static HelperContextFactory getHelperContextFactory() { > return getImplementationResolver().getHelperContextFactory(); > } > > public static HelperContextFactory getHelperContextFactory(String > implName) { > return > getImplementationResolver().getHelperContextFactory(implName); > } > > public static interface ImplementationResolver { > > /** > * The name of the system property that will be checked for an > implementation name. > */ > static final String PROPERTY_NAME = > "commonj.sdo.helper.HelperContextFactory"; > > /** > * The name of the resource that is used for service location. > */ > static final String SERVICE_RESOURCE_NAME = "META-INF/services/" + > PROPERTY_NAME; > > HelperContextFactory getHelperContextFactory(); > > HelperContextFactory getHelperContextFactory(String implName); > > } > > private static class DefaultImplementationResolver implements > ImplementationResolver { > > /** > * Locate and instantiate the default HelperContextFactory. > * > * @see getInstance(String) > */ > public HelperContextFactory getHelperContextFactory() { > return getHelperContextFactory(null); > } > > /** > * Locate and instantiate a HelperContextFactory. <p/> If the > specified > * implName is not null, attempt to instantiate an implementation > class > * with that name. If implName is null, then the name of the > * implementation to use is determined by the value of the > * "commonj.sdo.helper.HelperContextFactory" system property. If > this is not > * set or this code does not have permission to read it then the > name > * will be retrieved from the > * META-INF/services/commonj.sdo.helper.HelperContextFactory > resource. <p/> > * Name lookup and class loading is done using first the Thread's > * current context classloader and then, if that is not set, not > * readable, or does not provide an implementation, using the > * classloader used to load the HelperContextFactory class itself. > <p/> > * > * @param implName > * The name of the implementation class. > * @return A singleton instance of the selected > HelperContextFactory. > */ > public HelperContextFactory getHelperContextFactory(String > implName) { > if (implName == null) { > implName = getImplementationName(); > } > ClassLoader cl = getContextClassLoader(); > if (cl != null) { > HelperContextFactory impl = getHelperContextFactory(cl, > implName); > if (impl != null) { > return impl; > } > } > cl = HelperContextFactory.class.getClassLoader(); > HelperContextFactory impl = getHelperContextFactory(cl, > implName); > if (impl != null) { > return impl; > } > return null; > } > > /** > * Map from implementation classes to their corresponding > singleton instances. > */ > protected final HashMap<Class, HelperContextFactory> instanceMap = > new HashMap<Class, HelperContextFactory>(); > > protected HelperContextFactory getHelperContextFactory(ClassLoader > cl, String implName) { > try { > if (implName == null) { > implName = getImplementationName(cl); > if (implName == null) > return null; > } > Class instanceClass = cl.loadClass(implName); > HelperContextFactory instance = > instanceMap.get(instanceClass); > if (instance == null) { > instance = (HelperContextFactory) > instanceClass.newInstance(); > instanceMap.put(instanceClass, instance); > } > return instance; > } catch (Exception e) { > return null; > } > } > > protected String getImplementationName(ClassLoader cl) throws > IOException { > InputStream is = > cl.getResourceAsStream(SERVICE_RESOURCE_NAME); > if (is == null) return null; > InputStreamReader in = new InputStreamReader(is, "UTF-8"); > BufferedReader reader = new BufferedReader(in, 128); > try { > String line; > while ((line = reader.readLine()) != null) { > int i = line.indexOf('#'); > if (i != -1) { > line = line.substring(0, i); > } > line = line.trim(); > if (line.length() > 0) return line; > } > return null; > } finally { > reader.close(); > } > } > > protected String getImplementationName() { > try { > return (String)AccessController.doPrivileged(new > PrivilegedAction() { > public Object run() { > return System.getProperty(PROPERTY_NAME); > } > }); > } catch (SecurityException e) { > return null; > } > } > > protected ClassLoader getContextClassLoader() { > try { > return (ClassLoader)AccessController.doPrivileged(new > PrivilegedAction() { > public Object run() { > return > Thread.currentThread().getContextClassLoader(); > } > }); > } catch (SecurityException e) { > return null; > } > } > > } > > } > /** > * <copyright> > * > * Service Data Objects > * Version 3.0 > * Licensed Materials > * > * (c) Copyright BEA Systems, Inc., International Business Machines > Corporation, > * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, > SAP AG., > * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, > * 2005-2008. All rights reserved. > * > * </copyright> > * > */ > package commonj.sdo.helper; > > import java.util.Map; > > import commonj.sdo.helper.HelperContext; > import commonj.sdo.impl.ExternalizableDelegator.Resolvable; > > public abstract class HelperContextFactory { > > public HelperContextFactory() { > } > > /** > * Gets the implementation's default HelperContext. > * @return a HelperContext object > */ > public abstract HelperContext getDefaultHelperContext(); > > /** > * Create a new HelperContext in this implementation. > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(); > > /** > * Create a new HelperContext in this implementation. > * @param properties - Properties required to initialize the > HelperContext. > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(Map properties); > > /** > * Create a new HelperContext in this implementation. > * @param classLoader - The class loader for the generated static > classes (if any). > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(ClassLoader > classLoader); > > /** > * Create a new HelperContext in this implementation. > * @param classLoader - The class loader for the generated static > classes (if any). > * @param properties - Properties required to initialize the > HelperContext. > * @return a HelperContext object > */ > public abstract HelperContext createHelperContext(ClassLoader > classLoader, Map properties); > > public abstract Resolvable createResolvable(); > > public abstract Resolvable createResolvable(Object target); > > } > /** > * <copyright> > * > * Service Data Objects > * Version 3.0 > * Licensed Materials > * > * (c) Copyright BEA Systems, Inc., International Business Machines > Corporation, > * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, > SAP AG., > * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, > * 2005-2008. All rights reserved. > * > * </copyright> > * > */ > package commonj.sdo.impl; > > import commonj.sdo.helper.CopyHelper; > import commonj.sdo.helper.DataFactory; > import commonj.sdo.helper.DataHelper; > import commonj.sdo.helper.EqualityHelper; > import commonj.sdo.helper.HelperContext; > import commonj.sdo.helper.SDO; > import commonj.sdo.helper.TypeHelper; > import commonj.sdo.helper.XMLHelper; > import commonj.sdo.helper.XSDHelper; > > public class HelperProviderImpl extends HelperProvider { > > private static final HelperContext defaultHelperContext = > SDO.getHelperContextFactory().getDefaultHelperContext(); > > public HelperProviderImpl() { > super(); > } > > public CopyHelper copyHelper() { > return defaultHelperContext.getCopyHelper(); > } > > public DataFactory dataFactory() { > return defaultHelperContext.getDataFactory(); > } > > public DataHelper dataHelper() { > return defaultHelperContext.getDataHelper(); > } > > public EqualityHelper equalityHelper() { > return defaultHelperContext.getEqualityHelper(); > } > > public TypeHelper typeHelper() { > return defaultHelperContext.getTypeHelper(); > } > > public XMLHelper xmlHelper() { > return defaultHelperContext.getXMLHelper(); > } > > public XSDHelper xsdHelper() { > return defaultHelperContext.getXSDHelper(); > } > > public ExternalizableDelegator.Resolvable resolvable() { > return SDO.getHelperContextFactory().createResolvable(); > } > > public ExternalizableDelegator.Resolvable resolvable(Object target) { > return SDO.getHelperContextFactory().createResolvable(target); > } > } > /** > * <copyright> > * > * Service Data Objects > * Version 2.1.1 > * Licensed Materials > * > * (c) Copyright BEA Systems, Inc., International Business Machines > Corporation, > * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, > SAP AG., > * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, > > * 2005-2008. All rights reserved. > * > * </copyright> > * > */ > > package commonj.sdo.impl; > > > import commonj.sdo.helper.CopyHelper; > import commonj.sdo.helper.DataFactory; > import commonj.sdo.helper.DataHelper; > import commonj.sdo.helper.EqualityHelper; > import commonj.sdo.helper.HelperContext; > import commonj.sdo.helper.TypeHelper; > import commonj.sdo.helper.XMLHelper; > import commonj.sdo.helper.XSDHelper; > import commonj.sdo.impl.ExternalizableDelegator.Resolvable; > > /** > * This class instantiates a HelperProviderImpl that returns concrete > helpers. > * This class may be replaced by another implementation. > * @deprecated > */ > public abstract class HelperProvider > { > static HelperProvider INSTANCE = getHelperProviderImpl(); > > static HelperProvider getHelperProviderImpl() > { > try > { > return > (HelperProvider)Class.forName("commonj.sdo.impl.HelperProviderImpl").newInstance(); > } catch (Exception e) > { > throw new RuntimeException(e); > } > } // end method getHelperProvider() > > HelperProvider() > { > } > > /** > * Gets a CopyHelper > * @return a CopyHelper object > */ > public static CopyHelper getCopyHelper() > { > return INSTANCE.copyHelper(); > } > > /** > * Gets a DataFactory > * @return a DataFactory object > */ > public static DataFactory getDataFactory() > { > return INSTANCE.dataFactory(); > } > > /** > * Gets a DataHelper > * @return a DataHelper object > */ > public static DataHelper getDataHelper() > { > return INSTANCE.dataHelper(); > } > > /** > * Gets an EqualityHelper > * @return an EqualityHelper object > */ > public static EqualityHelper getEqualityHelper() > { > return INSTANCE.equalityHelper(); > } > > /** > * Gets a TypeHelper > * @return a TypeHelper object > */ > public static TypeHelper getTypeHelper() > { > return INSTANCE.typeHelper(); > } > > /** > * Gets an XMLHelper > * @return an XMLHelper object > */ > public static XMLHelper getXMLHelper() > { > return INSTANCE.xmlHelper(); > } > > /** > * Gets an XSDHelper > * @return an XSDHelper object > */ > public static XSDHelper getXSDHelper() > { > return INSTANCE.xsdHelper(); > } > > /** > * Gets a Resolvable > * @return a Resolvable object > * @see ExternalizableDelegator > */ > public static Resolvable createResolvable() > { > return INSTANCE.resolvable(); > } > > /** > * Gets a Resolvable > * @param target the target object for the Resolvable > * @return a Resolvable object > * @see ExternalizableDelegator > */ > public static Resolvable createResolvable(Object target) > { > return INSTANCE.resolvable(target); > } > > abstract CopyHelper copyHelper(); > abstract DataFactory dataFactory(); > abstract DataHelper dataHelper(); > abstract EqualityHelper equalityHelper(); > abstract TypeHelper typeHelper(); > abstract XMLHelper xmlHelper(); > abstract XSDHelper xsdHelper(); > abstract Resolvable resolvable(); > abstract Resolvable resolvable(Object target); > > > //////////////////////////////////////////////////////////////////////////////////////////////////// > // New in SDO 2.1 > > //////////////////////////////////////////////////////////////////////////////////////////////////// > > /** > * Gets the default HelperContext > * @return a HelperContext object > */ > public static HelperContext getDefaultContext() > { > return INSTANCE.helperContext(); > } > > HelperContext helperContext() > { > return defaultContext; > } > > static HelperContext defaultContext = new DefaultHelperContext(); > > static class DefaultHelperContext implements HelperContext > { > public CopyHelper getCopyHelper() { return INSTANCE.copyHelper(); } > public DataFactory getDataFactory() { return INSTANCE.dataFactory(); } > public DataHelper getDataHelper() { return INSTANCE.dataHelper(); } > public EqualityHelper getEqualityHelper() { return > INSTANCE.equalityHelper(); } > public TypeHelper getTypeHelper() { return INSTANCE.typeHelper(); } > public XMLHelper getXMLHelper() { return INSTANCE.xmlHelper(); } > public XSDHelper getXSDHelper() { return INSTANCE.xsdHelper(); } > } > > } > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > > > --------------------------------------------------------------------- > To unsubscribe from this mail list, you must leave the OASIS TC that > generates this mail. Follow this link to all your TCs in OASIS at: > https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php > >
/** * <copyright> * * Service Data Objects * Version 2.1.1 * Licensed Materials * * (c) Copyright BEA Systems, Inc., International Business Machines Corporation, * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG., * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, * 2005-2008. All rights reserved. * * </copyright> * */ package commonj.sdo.impl; import commonj.sdo.helper.CopyHelper; import commonj.sdo.helper.DataFactory; import commonj.sdo.helper.DataHelper; import commonj.sdo.helper.EqualityHelper; import commonj.sdo.helper.HelperContext; import commonj.sdo.helper.SDO; import commonj.sdo.helper.TypeHelper; import commonj.sdo.helper.XMLHelper; import commonj.sdo.helper.XSDHelper; import commonj.sdo.impl.ExternalizableDelegator.Resolvable; /** * This class instantiates a HelperProviderImpl that returns concrete helpers. * This class may be replaced by another implementation. * @deprecated */ public class HelperProvider { static final HelperContext DEFAULT_HELPER_CONTEXT = SDO.getHelperContextFactory().getDefaultHelperContext(); HelperProvider() { } /** * Gets a CopyHelper * @return a CopyHelper object */ public static CopyHelper getCopyHelper() { return DEFAULT_HELPER_CONTEXT.getCopyHelper(); } /** * Gets a DataFactory * @return a DataFactory object */ public static DataFactory getDataFactory() { return DEFAULT_HELPER_CONTEXT.getDataFactory(); } /** * Gets a DataHelper * @return a DataHelper object */ public static DataHelper getDataHelper() { return DEFAULT_HELPER_CONTEXT.getDataHelper(); } /** * Gets an EqualityHelper * @return an EqualityHelper object */ public static EqualityHelper getEqualityHelper() { return DEFAULT_HELPER_CONTEXT.getEqualityHelper(); } /** * Gets a TypeHelper * @return a TypeHelper object */ public static TypeHelper getTypeHelper() { return DEFAULT_HELPER_CONTEXT.getTypeHelper(); } /** * Gets an XMLHelper * @return an XMLHelper object */ public static XMLHelper getXMLHelper() { return DEFAULT_HELPER_CONTEXT.getXMLHelper(); } /** * Gets an XSDHelper * @return an XSDHelper object */ public static XSDHelper getXSDHelper() { return DEFAULT_HELPER_CONTEXT.getXSDHelper(); } /** * Gets a Resolvable * @return a Resolvable object * @see ExternalizableDelegator */ public static Resolvable createResolvable() { return SDO.getHelperContextFactory().createResolvable(); } /** * Gets a Resolvable * @param target the target object for the Resolvable * @return a Resolvable object * @see ExternalizableDelegator */ public static Resolvable createResolvable(Object target) { return SDO.getHelperContextFactory().createResolvable(target); } //////////////////////////////////////////////////////////////////////////////////////////////////// // New in SDO 2.1 //////////////////////////////////////////////////////////////////////////////////////////////////// /** * Gets the default HelperContext * @return a HelperContext object */ public static HelperContext getDefaultContext() { return DEFAULT_HELPER_CONTEXT; } }
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]