Package org.jboss.services.deployment.metadata

Examples of org.jboss.services.deployment.metadata.ConfigInfo


    * @throws Exception if the template does not exist
    */
   public List getTemplatePropertyInfo(String template)
      throws Exception
   {
      ConfigInfo ci = (ConfigInfo)configMap.get(template);

      if (ci == null)
      {
         throw new Exception("template does not exist: " + template);
      }
      else
      // return a copy
         List propertyList = ci.getPropertyInfoList();
         List newList = new ArrayList(propertyList.size());

         for (Iterator i = propertyList.iterator(); i.hasNext();)
         {
            newList.add(new PropertyInfo((PropertyInfo)i.next()));
View Full Code Here


         throw new Exception("not a filesystem friendly module name: " + module);

      log.info("createModule(module=" + module +
            ", template=" + template + ", properties=" + properties + ")");

      ConfigInfo ci = (ConfigInfo)configMap.get(template);

      if (ci == null)
         throw new Exception("template does not exist: " + template);

      // get optional package extension (e.g. .sar)
      // and enforce it on the output package (file or directory)
      File outputModule;

      String extension = ci.getExtension();
      if (extension == null || module.endsWith(extension))
         outputModule = new File(this.undeployDir, module);
      else
         outputModule = new File(this.undeployDir, module + extension);

      // check if module already exists in output dir
      if (outputModule.exists())
         throw new Exception("module already exist: " + outputModule);

      String vmTemplate = ci.getTemplate();

      // make sure we clean-up in case something goes wrong
      try
      {
         // simple case - single descriptor package (e.g. xxx-service.xml)
         if (vmTemplate != null )
         {
            VelocityContext ctx = createTemplateContext(ci, properties);

            BufferedWriter out = new BufferedWriter(new FileWriter(outputModule));

            try {
               boolean success = ve.mergeTemplate(template + '/' + vmTemplate, ctx, out);

               if (success == true)
               {
                  String errorMsg = (String)ctx.get(TEMPLATE_ERROR_PARAM);

                  if (errorMsg.length() > 0)
                     throw new Exception("Template error: " + errorMsg);
                  else
                     log.debug("created module '" + outputModule.getName() + "' based on template '" + template + "'");
               }
               else
                  throw new Exception("Failed to create module '" + outputModule.getName());
            }
            finally
            {
               out.close();
            }
         }
         else
         {
            // complex case - many descriptors and possibly files to copy
            // now output will be a directory instead of a plain descriptor (e.g. xxx.sar)
            VelocityContext ctx = createTemplateContext(ci, properties);

            // deep copy files if copydir specified
            String copydir = ci.getCopydir();

            File sourceDir = new File(this.templateDir, template + '/' + copydir);

            deepCopy(sourceDir, outputModule);

            // go through all declared templates
            List templateList = ci.getTemplateInfoList();

            for (Iterator i = templateList.iterator(); i.hasNext(); )
            {
               TemplateInfo ti = (TemplateInfo)i.next();
View Full Code Here

         log.debug("  xpath=" + data.getXpath());
      }

      // Get the template to use, and ensure we have it:
      String template = data.getTemplateName();
      ConfigInfo ci = (ConfigInfo)configMap.get(template);
      if (ci == null)
         throw new Exception("template does not exist: " + template);

      // Determine which configuration XML file holds the data for the
      // specified MBean:
View Full Code Here

      Map map = Collections.synchronizedMap(new TreeMap());

      // Parse each template config file and store metadata in configMap
      for (Iterator i = configFiles.iterator(); i.hasNext(); ) {
         File file = (File)i.next();
         ConfigInfo ci = parseXMLconfig(file);

         // derive template name from subdirectory name
         ci.setName(file.getParentFile().getName());

         if (log.isTraceEnabled())
            log.trace("file: " + file + " ConfigInfo: " + ci);

         Object existingValue = map.put(ci.getName(), ci);

         // make sure not two configuration templates with the same name
         if (existingValue != null)
            throw new Exception("Duplicate template configuration entry: " + ci.getName());
      }

      this.configMap = map;

      // Initialise velocity engine
View Full Code Here

      // create an instance of ObjectModelFactory
      ObjectModelFactory factory = new ConfigInfoBinding();

      // let the object model factory to create an instance of Book and populate it with data from XML
      ConfigInfo ci = (ConfigInfo)unmarshaller.unmarshal(is, factory, null);

      // close the XML stream
      is.close();

      return ci;
View Full Code Here

    * @return The full module name, with the suffix.
    * @throws Exception
    */
   private String processDataSourceChanges (String module, String template, HashMap properties) throws Exception
   {
       ConfigInfo ci = (ConfigInfo) configMap.get(template);
      if (ci == null)
         throw new Exception("template does not exist: " + template);

      // Append the extension if the module name does not contain it
      String extension = ci.getExtension();
      if (extension != null && !module.endsWith(extension))
         module += extension;

      // Build the mbean name from the jndi name.  Note that we are actually building
      // a pattern, any mbean whose name matches this pattern will do.
View Full Code Here

    * @throws Exception if the template does not exist
    */
   public List getTemplatePropertyInfo(String template)
      throws Exception
   {
      ConfigInfo ci = (ConfigInfo)configMap.get(template);

      if (ci == null)
      {
         throw new Exception("template does not exist: " + template);
      }
      else
      // return a copy
         List propertyList = ci.getPropertyInfoList();
         List newList = new ArrayList(propertyList.size());

         for (Iterator i = propertyList.iterator(); i.hasNext();)
         {
            newList.add(new PropertyInfo((PropertyInfo)i.next()));
View Full Code Here

         throw new Exception("not a filesystem friendly module name: " + module);

      log.info("createModule(module=" + module +
            ", template=" + template + ", properties=" + properties + ")");

      ConfigInfo ci = (ConfigInfo)configMap.get(template);

      if (ci == null)
         throw new Exception("template does not exist: " + template);

      // get optional package extension (e.g. .sar)
      // and enforce it on the output package (file or directory)
      File outputModule;

      String extension = ci.getExtension();
      if (extension == null || module.endsWith(extension))
         outputModule = new File(this.undeployDir, module);
      else
         outputModule = new File(this.undeployDir, module + extension);

      // check if module already exists in output dir
      if (outputModule.exists())
         throw new Exception("module already exist: " + outputModule);

      String vmTemplate = ci.getTemplate();

      // make sure we clean-up in case something goes wrong
      try
      {
         // simple case - single descriptor package (e.g. xxx-service.xml)
         if (vmTemplate != null )
         {
            VelocityContext ctx = createTemplateContext(ci, properties);

            BufferedWriter out = new BufferedWriter(new FileWriter(outputModule));

            try {
               boolean success = ve.mergeTemplate(template + '/' + vmTemplate, ctx, out);

               if (success == true)
               {
                  String errorMsg = (String)ctx.get(TEMPLATE_ERROR_PARAM);

                  if (errorMsg.length() > 0)
                     throw new Exception("Template error: " + errorMsg);
                  else
                     log.debug("created module '" + outputModule.getName() + "' based on template '" + template + "'");
               }
               else
                  throw new Exception("Failed to create module '" + outputModule.getName());
            }
            finally
            {
               out.close();
            }
         }
         else
         {
            // complex case - many descriptors and possibly files to copy
            // now output will be a directory instead of a plain descriptor (e.g. xxx.sar)
            VelocityContext ctx = createTemplateContext(ci, properties);

            // deep copy files if copydir specified
            String copydir = ci.getCopydir();

            File sourceDir = new File(this.templateDir, template + '/' + copydir);

            deepCopy(sourceDir, outputModule);

            // go through all declared templates
            List templateList = ci.getTemplateInfoList();

            for (Iterator i = templateList.iterator(); i.hasNext(); )
            {
               TemplateInfo ti = (TemplateInfo)i.next();
View Full Code Here

         log.debug("  xpath=" + data.getXpath());
      }

      // Get the template to use, and ensure we have it:
      String template = data.getTemplateName();
      ConfigInfo ci = (ConfigInfo)configMap.get(template);
      if (ci == null)
         throw new Exception("template does not exist: " + template);

      // Determine which configuration XML file holds the data for the
      // specified MBean:
View Full Code Here

      Map map = Collections.synchronizedMap(new TreeMap());

      // Parse each template config file and store metadata in configMap
      for (Iterator i = configFiles.iterator(); i.hasNext(); ) {
         File file = (File)i.next();
         ConfigInfo ci = parseXMLconfig(file);

         // derive template name from subdirectory name
         ci.setName(file.getParentFile().getName());

         if (log.isTraceEnabled())
            log.trace("file: " + file + " ConfigInfo: " + ci);

         Object existingValue = map.put(ci.getName(), ci);

         // make sure not two configuration templates with the same name
         if (existingValue != null)
            throw new Exception("Duplicate template configuration entry: " + ci.getName());
      }

      this.configMap = map;

      // Initialise velocity engine
View Full Code Here

TOP

Related Classes of org.jboss.services.deployment.metadata.ConfigInfo

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.