Package org.datanucleus.plugin

Examples of org.datanucleus.plugin.ExtensionPoint


        assertEquals(2,mgr.getExtensionPoints().length);
        assertNull(mgr.getExtensionPoint("testID"));
        assertNull(mgr.getExtensionPoint("testID2"));
        assertNotNull(mgr.getExtensionPoint("org.datanucleus.testID"));
        assertNotNull(mgr.getExtensionPoint("org.datanucleus.testID2"));
        ExtensionPoint point = mgr.getExtensionPoint("org.datanucleus.testID");
        assertEquals("testID", point.getId());
        assertEquals("org.datanucleus.testID", point.getUniqueId());
        assertEquals("testName", point.getName());
        assertNotNull(clr.getResource("/org/datanucleus/samples/plugin/plugin1.xsd",null));
        assertEquals(clr.getResource("/org/datanucleus/samples/plugin/plugin1.xsd",null), point.getSchema());
        assertEquals(0,point.getExtensions().length);

        mgr.registerExtensionsForPlugin(clr.getResource("/org/datanucleus/samples/plugin/plugin1.xml",null),bundle0);
        assertEquals(2,point.getExtensions().length);       
        Extension[] exts = point.getExtensions();
        assertEquals(exts[0].getPlugin(),exts[1].getPlugin());
        assertEquals(2,exts[0].getConfigurationElements().length);
       
        ConfigurationElement[] level1 = exts[0].getConfigurationElements();
        assertEquals(2,level1[0].getChildren().length);
View Full Code Here


  DatastorePluginRegistry(PluginRegistry delegate) {
    this.delegate = delegate;
  }

  public ExtensionPoint getExtensionPoint(String id) {
    ExtensionPoint ep = delegate.getExtensionPoint(id);
    if (id.equals("org.datanucleus.callbackhandler")) {
      boolean replaced = false;
      for (Extension ext : ep.getExtensions()) {
        for (ConfigurationElement cfg : ext.getConfigurationElements()) {
          if (cfg.getAttribute("name").equals("JPA")) {
            // override with our own callback handler
            // See DatastoreJPACallbackHandler for the reason why we do this.
            threadsafePutAttribute(cfg, "class-name", DatastoreJPACallbackHandler.class.getName());
            replaced = true;
          }
        }
      }

      if (!replaced) {
        throw new RuntimeException("Unable to replace JPACallbackHandler.");
      }
    }

    if (id.equals("org.datanucleus.metadata_manager")) {
      boolean replaced = false;
      for (Extension ext : ep.getExtensions()) {
        for (ConfigurationElement cfg : ext.getConfigurationElements()) {
          if (cfg.getAttribute("name").equals("JDO")) {
            // override with our own metadata manager
            // See DatastoreMetaDataManager for the reason why we do this.
            threadsafePutAttribute(cfg, "class", DatastoreJDOMetaDataManager.class.getName());
View Full Code Here

        assertEquals(2,mgr.getExtensionPoints().length);
        assertNull(mgr.getExtensionPoint("testID"));
        assertNull(mgr.getExtensionPoint("testID2"));
        assertNotNull(mgr.getExtensionPoint("org.datanucleus.testID"));
        assertNotNull(mgr.getExtensionPoint("org.datanucleus.testID2"));
        ExtensionPoint point = mgr.getExtensionPoint("org.datanucleus.testID");
        assertEquals("testID", point.getId());
        assertEquals("org.datanucleus.testID", point.getUniqueId());
        assertEquals("testName", point.getName());
        assertNotNull(clr.getResource("/org/datanucleus/samples/plugin/plugin1.xsd",null));
        assertEquals(clr.getResource("/org/datanucleus/samples/plugin/plugin1.xsd",null), point.getSchema());
        assertEquals(0,point.getExtensions().length);
        mgr.registerPluginExtensions(clr.getResource("/org/datanucleus/samples/plugin/plugin1.xml",null),bundle0);
        assertEquals(2,point.getExtensions().length);       
        Extension[] exts = point.getExtensions();
        assertEquals(exts[0].getPlugin(),exts[1].getPlugin());
        assertEquals(2,exts[0].getConfigurationElements().length);
       
        ConfigurationElement[] level1 = exts[0].getConfigurationElements();
        assertEquals(2,level1[0].getChildren().length);
View Full Code Here

     * @param mgr the PluginManager
     * @param clr the ClassLoaderResolver
     */
    private void loadJavaTypes(PluginManager mgr, ClassLoaderResolver clr)
    {
        ExtensionPoint exPoint = mgr.getExtensionPoint("org.datanucleus.java_type");
        for (int i = 0; i < exPoint.getExtensions().length; i++)
        {
            ConfigurationElement[] elms = exPoint.getExtensions()[i].getConfigurationElements();
            for (int elemNo = 0; elemNo < elms.length; elemNo++)
            {
                String javaName = elms[elemNo].getAttribute("name").trim();
                String persistentString = elms[elemNo].getAttribute("persistent");
                String embeddedString = elms[elemNo].getAttribute("embedded");
View Full Code Here

     * @param mgr the PluginManager
     * @param clr the ClassLoaderResolver
     */
    private void loadMappings(PluginManager mgr, ClassLoaderResolver clr)
    {
        ExtensionPoint exPoint = mgr.getExtensionPoint("org.datanucleus.store_mapping");
        for (int i = 0; i < exPoint.getExtensions().length; i++)
        {
            ConfigurationElement[] elms = exPoint.getExtensions()[i].getConfigurationElements();
            for (int e = 0; e < elms.length; e++)
            {
                String javaName = elms[e].getAttribute("java-type").trim();
                String mappingClassName = elms[e].getAttribute("mapping-class");
                String javaVersionRestrict = elms[e].getAttribute("java-version-restricted");
View Full Code Here

TOP

Related Classes of org.datanucleus.plugin.ExtensionPoint

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.