6 Replies Latest reply on Jun 13, 2016 8:15 PM by Steven Hawkins

    Add a new ModelMetaData to a deployed VDB in teiid-embedded without undeploy/redeploy of the VDB

    John Rodrigues Novice

      Hi,

       

      I want to know if it is possible to add a new ModelMetaData to a deployed VDB in teiid-embedded, without having to undeploy/redeploy the VDB.

       

      So, currently my code does this:

       

      public void defineView(ViewDefinitionTO viewDefinitionTO) {

         logger.info(String.format("Defining view [%s] for model [%s]", viewDefinitionTO.getViewName(), viewDefinitionTO.getModelName()));
        try {

         final VDB vdb = server.getAdmin().getVDB(VDB_NAME, VDB_VERSION);
         ModelMetaData[] models = getModelsFromVDB(vdb);
        final String vdbName = vdb.getName();
         ModelMetaData[] newModels = new ModelMetaData[models.length + 1];
         System.arraycopy(models, 0, newModels, 0, models.length);
         newModels[models.length] = getModel(viewDefinitionTO);
         server.undeployVDB(vdbName);
         server.deployVDB(vdbName, newModels);
         } catch (Exception ex) {

         logger.error(String.format("Exception [%s] occurred", ex.getMessage()), ex);
        throw new RuntimeException(ex.getMessage());
         }

      }

       

      My concern is that consumers attached to the VDB should not be impacted anytime I dynamically deploy a new ModelMetaData.

       

      Thanks,

      John