Package org.jboss.forge.parser.xml

Examples of org.jboss.forge.parser.xml.Node


            if (mapping.equals(servletMapping.getSingle("url-pattern").getText())) {
               return false; // mapping already exists; not created
            }
         }
      }
      Node servletMapping = root.createChild("servlet-mapping");
      servletMapping.createChild("servlet-name").text(servletName);
      servletMapping.createChild("url-pattern").text(mapping);
      return true;
   }
View Full Code Here


   {
      Map<String, ConnectionProfile> result = new LinkedHashMap<String, ConnectionProfile>();
      String connectionProfiles = config.getString("connection-profiles");
      if (connectionProfiles != null)
      {
         Node node = XMLParser.parse(connectionProfiles);
         for (Node child : node.getChildren())
         {
            if (!child.getName().equals("connection-profile"))
               continue; // Only profile elements are valid

            ConnectionProfile descriptor = new ConnectionProfile();
View Full Code Here

   }

   @Override
   public void saveConnectionProfiles(Collection<ConnectionProfile> connectionProfiles)
   {
      Node root = new Node("connection-profiles");
      for (ConnectionProfile descriptor : connectionProfiles)
      {
         Node child = root.createChild("connection-profile");
         child.attribute(CONFIG_KEY_NAME, descriptor.getName());
         child.attribute(CONFIG_KEY_DIALECT, descriptor.getDialect());
         child.attribute(CONFIG_KEY_DRIVER, descriptor.getDriver());
         child.attribute(CONFIG_KEY_PATH_TO_DRIVER, descriptor.getPath());
         child.attribute(CONFIG_KEY_URL, descriptor.getUrl());
         child.attribute(CONFIG_KEY_USER, descriptor.getUser());
         child.attribute(CONFIG_KEY_SAVE_PASSWORD, descriptor.isSavePassword());
         if (descriptor.isSavePassword() && !Strings.isNullOrEmpty(descriptor.getPassword()))
         {
            String encryptedPassword = encodePassword(descriptor.getPassword());
            child.attribute(CONFIG_KEY_PASSWORD, encryptedPassword);
            child.attribute(CONFIG_KEY_ENCRYPTED_PASSWORD, "true");
         }
      }
      if (root.getChildren().isEmpty())
      {
         config.clearProperty("connection-profiles");
View Full Code Here

                  }
               }
               /*
                * Write out the addon module dependency configuration
                */
               Node addonXml = getXmlRoot(descriptor);
               Node dependenciesNode = addonXml.getOrCreate(DEPENDENCIES_TAG_NAME);

               for (AddonDependencyEntry dependency : dependencies)
               {
                  String name = dependency.getId().getName();
                  Node dep = null;
                  for (Node node : dependenciesNode.get(DEPENDENCY_TAG_NAME))
                  {
                     if (name.equals(node.getAttribute(ATTR_NAME)))
                     {
                        dep = node;
                        break;
                     }
                  }
                  if (dep == null)
                  {
                     dep = dependenciesNode.createChild(DEPENDENCY_TAG_NAME);
                     dep.attribute(ATTR_NAME, name);
                  }
                  dep.attribute(ATTR_VERSION, dependency.getId().getVersion());
                  dep.attribute(ATTR_EXPORT, dependency.isExported());
                  dep.attribute(ATTR_OPTIONAL, dependency.isOptional());
               }

               FileOutputStream fos = null;
               try
               {
View Full Code Here

            File registryFile = getRepositoryRegistryFile();
            if (registryFile.exists())
            {
               try
               {
                  Node installed = getXmlRoot(registryFile);

                  Node child = installed.getSingle("addon@" + ATTR_NAME + "=" + addon.getName() + "&"
                           + ATTR_VERSION + "=" + addon.getVersion());
                  installed.removeChild(child);
                  saveRegistryFile(installed);
                  return true;
               }
View Full Code Here

            }

            File registryFile = getRepositoryRegistryFile();
            try
            {
               Node installed = getXmlRoot(registryFile);

               installed.getOrCreate("addon@" + ATTR_NAME + "=" + (addon.getName() == null ? "" : addon.getName()) +
                        "&" + ATTR_VERSION + "=" + addon.getVersion())
                        .attribute(ATTR_API_VERSION, (addon.getApiVersion() == null ? "" : addon.getApiVersion()));

               saveRegistryFile(installed);
               return true;
View Full Code Here

            Set<AddonDependencyEntry> result = new HashSet<AddonDependencyEntry>();
            File descriptor = getAddonDescriptor(addon);

            try
            {
               Node installed = getXmlRoot(descriptor);

               List<Node> children = installed.get("dependencies/dependency");
               for (final Node child : children)
               {
                  if (child != null)
                  {
                     result.add(AddonDependencyEntry.create(AddonId.from(child.getAttribute(ATTR_NAME),
View Full Code Here

            }

            File registryFile = getRepositoryRegistryFile();
            try
            {
               Node installed = getXmlRoot(registryFile);

               List<Node> children = installed.get("addon@" + ATTR_NAME + "=" + addon.getName());
               for (Node child : children)
               {
                  if (child != null)
                  {
                     if ((addon.getApiVersion() == null)
View Full Code Here

         {
            List<AddonId> result = new ArrayList<AddonId>();
            File registryFile = getRepositoryRegistryFile();
            try
            {
               Node installed = getXmlRoot(registryFile);
               if (installed == null)
               {
                  return Collections.emptyList();
               }
               List<Node> list = installed.get("addon");
               for (Node addon : list)
               {
                  AddonId entry = AddonId.from(addon.getAttribute(ATTR_NAME),
                           addon.getAttribute(ATTR_VERSION),
                           addon.getAttribute(ATTR_API_VERSION));
View Full Code Here

      });
   }

   private Node getXmlRoot(File registryFile) throws FileNotFoundException, InterruptedException
   {
      Node installed = null;

      while (installed == null)
      {
         try
         {
View Full Code Here

TOP

Related Classes of org.jboss.forge.parser.xml.Node

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.