Examples of ConfigurationElement


Examples of org.jpox.plugin.ConfigurationElement

                        throw new JDODataStoreException(msg, e);
                    }
                }
            };
        Class cls = null;
        ConfigurationElement elem =
            objectMgr.getOMFContext().getPluginManager().getConfigurationElementForExtension("org.jpox.store_valuegenerator",
                new String[]{"name", "datastore"}, new String[] {poidGeneratorName, storeManager.getStoreManagerKey()});
        if (elem != null)
        {
            cls = objectMgr.getOMFContext().getPluginManager().loadClass(elem.getExtension().getPlugin().getSymbolicName(), elem.getAttribute("class-name"));
        }
        if( cls == null )
        {
            throw new JPOXException("Cannot create Poid Generator for strategy "+poidGeneratorName);
        }
View Full Code Here

Examples of org.jpox.plugin.ConfigurationElement

            strategyName = cmd.getIdentityMetaData().getValueStrategy().getCustomName();
        }

        // Check the POID type being stored
        Class poidClass = Long.class;
        ConfigurationElement elem =
            storeMgr.getOMFContext().getPluginManager().getConfigurationElementForExtension(
                "org.jpox.store_valuegenerator",
                new String[]{"name", "unique"}, new String[] {strategyName, "true"});
        if (elem == null)
        {
            // Not datastore-independent, so try for this datastore
            elem = storeMgr.getOMFContext().getPluginManager().getConfigurationElementForExtension(
                    "org.jpox.store_valuegenerator",
                    new String[]{"name", "datastore"}, new String[] {strategyName, storeMgr.getStoreManagerKey()});
        }
        if (elem != null)
        {
            // Set the generator name (for use by the PoidManager)
            String generatorClassName = elem.getAttribute("class-name");
            Class generatorClass =
                getStoreManager().getOMFContext().getClassLoaderResolver(null).classForName(generatorClassName);
            try
            {
                Method storageClassMethod = generatorClass.getMethod("getStorageClass", null);
View Full Code Here

Examples of org.jpox.plugin.ConfigurationElement

     * @param clr ClassLoader resolver for resolving the adapter class
     * @return the adapater class
     */
    protected Class getAdapterClass(PluginManager pluginMgr, String adapterClassName, String productName, ClassLoaderResolver clr)
    {
        ConfigurationElement highestMatchingAdapter = null;
        int highestPriority = Integer.MIN_VALUE;
        Extension[] ex = pluginMgr.getExtensionPoint("org.jpox.store_datastoreadapter").getExtensions();
        for (int i = 0; i < ex.length; i++)
        {
            ConfigurationElement[] confElm = ex[i].getConfigurationElements();
            for (int c = 0; c < confElm.length; c++)
            {
                if (adapterClassName != null)
                {
                    //if the user selected adapter is defined by one of the plug-ins use the classloader of the plug-in
                    if (confElm[c].getAttribute("class-name").equals(adapterClassName))
                    {
                        return pluginMgr.loadClass(confElm[c].getExtension().getPlugin().getSymbolicName(), confElm[c].getAttribute("class-name"));
                    }
                }
                else
                {
                    String vendorId = confElm[c].getAttribute("vendor-id");
                    if (productName.toLowerCase().indexOf(vendorId.toLowerCase()) >= 0)
                    {
                        int priority = Integer.parseInt(confElm[c].getAttribute("priority"));
                        if (priority >= highestPriority)
                        {
                            if (priority > highestPriority && highestMatchingAdapter != null)
                            {
                                JPOXLogger.DATASTORE.warn(LOCALISER.msg("051002",
                                    highestMatchingAdapter.getAttribute("class-name"), highestMatchingAdapter.getAttribute("vendor-id"),
                                    String.valueOf(priority), confElm[c].getAttribute("class-name")));
                            }
                            highestMatchingAdapter = confElm[c];
                            highestPriority = priority;
                        }
                    }
                }
            }
        }

        if (adapterClassName != null)
        {
            //if the user selected adapter was not found in one of the plug-ins, load from the ClassLoaderResolver
            return clr.classForName(adapterClassName, false);
        }

        if (highestMatchingAdapter != null)
        {
            return pluginMgr.loadClass(highestMatchingAdapter.getExtension().getPlugin().getSymbolicName(), highestMatchingAdapter.getAttribute("class-name"));                       
        }

        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.