Package org.datanucleus.plugin

Examples of org.datanucleus.plugin.PluginManager


    public void initialiseTypes(StoreSchemaHandler handler, ManagedConnection mconn)
    {
        // Initialise the mappings available. Load all possible, and remove unsupported for this datastore
        RDBMSStoreManager storeMgr = (RDBMSStoreManager)handler.getStoreManager();
        ClassLoaderResolver clr = storeMgr.getNucleusContext().getClassLoaderResolver(null);
        PluginManager pluginMgr = storeMgr.getNucleusContext().getPluginManager();
        MappingManager mapMgr = storeMgr.getMappingManager();
        mapMgr.loadDatastoreMapping(pluginMgr, clr, getVendorID());

        // Load the types from plugin(s)
        handler.getSchemaData(mconn.getConnection(), "types", null);
View Full Code Here


    public SQLExpressionFactory(RDBMSStoreManager storeMgr)
    {
        this.storeMgr = storeMgr;
        this.clr = storeMgr.getNucleusContext().getClassLoaderResolver(null);

        PluginManager pluginMgr = storeMgr.getNucleusContext().getPluginManager();
        ConfigurationElement[] methodElems =
            pluginMgr.getConfigurationElementsForExtension("org.datanucleus.store.rdbms.sql_method", null, null);
        if (methodElems != null)
        {
            for (int i=0;i<methodElems.length;i++)
            {
                String datastoreName = methodElems[i].getAttribute("datastore");
                String className = methodElems[i].getAttribute("class");
                String methodName = methodElems[i].getAttribute("method").trim();
                String sqlMethodName = methodElems[i].getAttribute("evaluator").trim();

                String key = getSQLMethodKey(datastoreName, className, methodName);
                methodClassByDatastoreMethodName.put(key, sqlMethodName);
            }
        }

        ConfigurationElement[] operationElems =
            pluginMgr.getConfigurationElementsForExtension("org.datanucleus.store.rdbms.sql_operation", null, null);
        if (operationElems != null)
        {
            for (int i=0;i<operationElems.length;i++)
            {
                String datastoreName = operationElems[i].getAttribute("datastore");
View Full Code Here

    protected void setUp() throws Exception
    {
        ClassLoaderResolver clr = new JDOClassLoaderResolver();
        Properties props = new Properties();
        props.setProperty("bundle-check-action", "EXCEPTION");
        PluginManager pluginMgr = new PluginManager(null, clr, props);

        typeMgr = new TypeManager(null, pluginMgr, clr);
    }
View Full Code Here

     */
    public AnnotationManagerImpl(MetaDataManager metadataMgr)
    {
        this.metadataMgr = metadataMgr;

        PluginManager pluginMgr = metadataMgr.getNucleusContext().getPluginManager();

        // Load up the registry of available annotation readers
        ConfigurationElement[] elems = pluginMgr.getConfigurationElementsForExtension("org.datanucleus.annotations", null, null);
        if (elems != null)
        {
            for (int i=0;i<elems.length;i++)
            {
                annotationReaderLookup.put(elems[i].getAttribute("annotation-class"), elems[i].getAttribute("reader"));
            }
        }

        // Load up the registry of available class annotation handlers
        elems = pluginMgr.getConfigurationElementsForExtension("org.datanucleus.class_annotation_handler", null, null);
        if (elems != null && elems.length > 0)
        {
            classAnnotationHandlerAnnotations = new HashSet<String>(elems.length);
            classAnnotationHandlers = new HashMap<String, ClassAnnotationHandler>(elems.length);
            for (int i=0; i<elems.length; i++)
            {
                classAnnotationHandlerAnnotations.add(elems[i].getAttribute("annotation-class"));
            }
        }

        // Load up the registry of available member annotation handlers
        elems = pluginMgr.getConfigurationElementsForExtension("org.datanucleus.member_annotation_handler", null, null);
        if (elems != null && elems.length > 0)
        {
            memberAnnotationHandlerAnnotations = new HashSet<String>(elems.length);
            memberAnnotationHandlers = new HashMap<String, MemberAnnotationHandler>(elems.length);
            for (int i=0; i<elems.length; i++)
View Full Code Here

            // Try to create this AnnotationReader
            try
            {
                Class[] ctrArgs = new Class[] {MetaDataManager.class};
                Object[] ctrParams = new Object[] {metadataMgr};
                PluginManager pluginMgr = metadataMgr.getNucleusContext().getPluginManager();
                reader = (AnnotationReader)pluginMgr.createExecutableExtension("org.datanucleus.annotations",
                    "reader", readerClassName, "reader", ctrArgs, ctrParams);
                annotationReaders.put(readerClassName, reader); // Save the annotation reader in case we have more of this type
            }
            catch (Exception e)
            {
View Full Code Here

        if (handler == null)
        {
            // Try to create this ClassAnnotationHandler
            try
            {
                PluginManager pluginMgr = metadataMgr.getNucleusContext().getPluginManager();
                handler = (ClassAnnotationHandler)pluginMgr.createExecutableExtension("org.datanucleus.class_annotation_handler",
                    "annotation-class", annotationName, "handler", null, null);
                classAnnotationHandlers.put(annotationName, handler);
            }
            catch (Exception e)
            {
View Full Code Here

        if (handler == null)
        {
            // Try to create this MemberAnnotationHandler
            try
            {
                PluginManager pluginMgr = metadataMgr.getNucleusContext().getPluginManager();
                handler = (MemberAnnotationHandler)pluginMgr.createExecutableExtension("org.datanucleus.member_annotation_handler",
                    "annotation-class", annotationName, "handler", null, null);
                memberAnnotationHandlers.put(annotationName, handler);
            }
            catch (Exception e)
            {
View Full Code Here

            {
                pluginProps.setProperty("validate-plugins",
                    (String)startupProps.get("datanucleus.plugin.validatePlugins"));
            }
        }
        this.pluginManager = new PluginManager(registryClassName, clr, pluginProps);

        // Load up any default properties from the plugins, and superimpose startup props
        config.setDefaultProperties(pluginManager);
        if (startupProps != null && !startupProps.isEmpty())
        {
View Full Code Here

        }
        else
        {
            // Not yet loaded anything for this method
            ClassLoaderResolver clr = nucleusCtx.getClassLoaderResolver(type != null ? type.getClassLoader() : null);
            PluginManager pluginMgr = nucleusCtx.getPluginManager();
            ConfigurationElement[] elems = pluginMgr.getConfigurationElementsForExtension(
                "org.datanucleus.query_method_evaluators", "method", methodName);
            Map<Object, InvocationEvaluator> evaluators = new HashMap();
            InvocationEvaluator requiredEvaluator = null;
            if (elems == null)
            {
                return null;
            }

            for (int i=0;i<elems.length;i++)
            {
                try
                {
                    String evalName = elems[i].getAttribute("evaluator");
                    InvocationEvaluator eval =
                        (InvocationEvaluator)pluginMgr.createExecutableExtension(
                        "org.datanucleus.query_method_evaluators", new String[] {"method", "evaluator"},
                        new String[] {methodName, evalName}, "evaluator", null, null);

                    String elemClsName = elems[i].getAttribute("class");
                    if (elemClsName != null && StringUtils.isWhitespace(elemClsName))
View Full Code Here

  }

  private void setCustomPluginManager() throws NoSuchFieldException, IllegalAccessException {
    // Replaces the configured plugin registry with our own implementation.
    // Reflection is required because there's no public mutator for this field.
    PluginManager pluginMgr = omfContext.getPluginManager();
    Field registryField = PluginManager.class.getDeclaredField("registry");
    registryField.setAccessible(true);
    registryField.set(
        pluginMgr, new DatastorePluginRegistry((PluginRegistry) registryField.get(pluginMgr)));
  }
View Full Code Here

TOP

Related Classes of org.datanucleus.plugin.PluginManager

Copyright © 2018 www.massapicom. 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.