Package nexj.core.meta.persistence

Examples of nexj.core.meta.persistence.DataSourceAdapter


   }

   public void testUpgradeValidation()
   {
      StringWriter buf = new StringWriter();
      DataSourceAdapter invalid = new DataSourceAdapter("InvalidAdapter");
      DataSourceAdapter valid = new DataSourceAdapter("ValidAdapter");
      RelationalDatabase ds = new RelationalDatabase("DataSource");
      RelationalSchema schema = new RelationalSchema();
      final Upgrade upgrade = new Upgrade(null);
      XMLMetadata metadata = new XMLMetadata(null, null, null, null, null)
      {
View Full Code Here


         // check for adapter compatibility limiting just to the requested datasource
         if (version instanceof RelationalSchemaUpgrade &&
             ((RelationalSchemaUpgrade)version).getDataSource() == rdb)
         {
            RelationalSchemaUpgrade upgradeVersion = (RelationalSchemaUpgrade)version;
            DataSourceAdapter adapter = upgradeVersion.getDataSource().getAdapter();

            // state already supports adapter
            if (((RelationalSchemaUpgradeState)state).containsAdapter(adapter))
            {
               return version;
View Full Code Here

         });
      }

      db.setDefaultProperties(loader.getContainer()); // done after loading config from XML Element

      DataSourceAdapter adapter = source.getAdapter();

      if (adapter == null)
      {
         return; // no RDBMS mapping defined for "optional" DataSource, hence no component required
      }

      final Component component =
         new Component(source.getName(), adapter.getClassObject(), Component.CONTEXT);

      component.setMetadata(loader.getMetadata());

      if (element != null)
      {
         XMLUtil.withFirstChildElement(element, "SQLHook", false, new ElementHandler()
         {
            public void handleElement(Element componentElement)
            {
               Component hook = new Component("<SQLHook:" + source.getName() + ">");

               m_loader.loadComponent(componentElement, hook);
               component.addComponentPropertyInitializer("SQLHook", hook);
            }
         });
      }

      db.setComponent(component);

      if (adapter.getVersion() != null)
      {
         component.addPrimitivePropertyInitializer("version", adapter.getVersion());
      }

      if (!db.isUnicode())
      {
         component.addPrimitivePropertyInitializer("unicode", Boolean.FALSE);
View Full Code Here

      }

      // ensure there is a statement for every requested adapter
      if (adapterArray == null)
      {
         DataSourceAdapter adapter = schema.getDataSource().getAdapter();

         if (adapter != null)
         {
            try
            {
View Full Code Here

            XMLUtil.forEachChildElement(adaptersElement, "Adapter",
               m_helper.new ElementHandler("adapter")
            {
               public void handleElement(Element adapterElement, String sAdapterName)
               {
                  DataSourceAdapter adapter = new DataSourceAdapter(sAdapterName);

                  try
                  {
                     adapter.setType(type);
                     adapter.setClassObject(m_helper.getClassObject(XMLUtil.getReqStringAttr(adapterElement, "class")));
                     adapter.setVersion(XMLUtil.getStringAttr(adapterElement, "version"));
                     type.addAdapter(adapter);
                  }
                  catch (MetadataException e)
                  {
                     if (!(e.getCause() instanceof ClassNotFoundException) &&
                        !(e.getCause() instanceof NoClassDefFoundError))
                     {
                        throw e;
                     }

                     // if data source type can't be loaded, don't add it to the metadata, but don't fail.
                     s_logger.debug("Cannot load DataSourceAdapter: " + adapter.getName() + " " + XMLUtil.getReqStringAttr(adapterElement, "class"));
                  }
               }
            });
         }
      });
View Full Code Here

         // build a list of DataSourceAdapter supported by this state
         for (Iterator/*<DataSourceAdapter>*/ itr =
                 m_schema.getDataSource().getType().getAdapterIterator();
              itr.hasNext();)
         {
            DataSourceAdapter adapter = (DataSourceAdapter)itr.next();

            if (containsAdapter(adapter))
            {
               adapterList.add(adapter);
            }
View Full Code Here

               eh = ((ColumnUpgradeInfo)colItr.next()).getStep().addException(eh, e);
            }
         }
      }

      DataSourceAdapter currentAdapter = m_schema.getDataSource().getAdapter();

      // set all adapters lacking explicit support as unsupported unless its the current adapter
      // i.e. fallback to original validation behaviour
      for (Iterator/*<DataSourceAdapter>*/ itr =
              m_schema.getDataSource().getType().getAdapterIterator();
View Full Code Here

      RelationalDatabase jmsDB = new RelationalDatabase(sJMSDBName);
      RelationalDatabaseFragment jmsDBFragment = (RelationalDatabaseFragment)jmsDB.getDefaultFragment();

      jmsDB.setAlias(sJMSDBName);
      jmsDB.setUnicode(false);
      jmsDB.setAdapter(new DataSourceAdapter(jdbcInfo.getDBTypeName()));
      jmsDBFragment.setAlias(sJMSDBName + jmsDBFragment.getSuffix());
      jmsDBFragment.setUser(sJMSDBUser);
      jmsDBFragment.setPassword(sJMSDBPassword);

      int nMinPoolSize;
View Full Code Here

TOP

Related Classes of nexj.core.meta.persistence.DataSourceAdapter

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.