Package org.jboss.forge.parser.xml

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


      moduleXml.delete();
      moduleXml.createNewFile();

      // <resource-root path="maven-dependency.jar" />
      Node module = XMLParser.parse(getClass().getResourceAsStream(MODULE_TEMPLATE_XML));
      module.attribute("name", pluginName);
      module.attribute("slot", pluginSlot);
      Node resources = module.getSingle("resources");

      resources.createChild("resource-root").attribute("path", dep.getArtifactId() + ".jar");

      // Copy the compiled JAR into the module directory
      FileResource<?> jar = moduleDir.getChild(dep.getArtifactId() + ".jar").reify(FileResource.class);
      jar.createNewFile();
      jar.setContents(artifact.getResourceInputStream());

      // <module name="org.jboss.forge:main" />
      Node dependencies = module.getSingle("dependencies");
      dependencies.createChild("module").attribute("name", pluginName + ".dependencies").attribute("slot", pluginSlot);
      dependencies.createChild("module").attribute("name", "org.jboss.forge.javaee.api")
               .attribute("services", "import");
      dependencies.createChild("module").attribute("name", "org.jboss.forge.maven.api").attribute("services", "import");
      dependencies.createChild("module").attribute("name", "org.jboss.forge.scaffold.api")
               .attribute("services", "import");
      dependencies.createChild("module").attribute("name", "org.jboss.forge.shell.api").attribute("services", "import");
      dependencies.createChild("module").attribute("name", "javax.api");

      moduleXml.setContents(XMLParser.toXMLString(module));

      createDependenciesModule(project, dep);
View Full Code Here


      FileResource<?> moduleXml = (FileResource<?>) dependencyDir.getChild("module.xml");
      moduleXml.delete();
      moduleXml.createNewFile();

      // <resource-root path="maven-dependency.jar" />
      Node module = XMLParser.parse(getClass().getResourceAsStream(MODULE_TEMPLATE_XML));
      module.attribute("name", pluginName + ".dependencies");
      module.attribute("slot", pluginSlot);
      Node resources = module.getSingle("resources");

      // <module name="org.jboss.forge:main" />
      Node dependencies = module.getSingle("dependencies");
      dependencies.createChild("module").attribute("name", "javax.api");
      dependencies.createChild("module").attribute("name", "org.jboss.forge.shell.api");

      List<DependencyResource> pluginDependencies = new ArrayList<DependencyResource>();
      List<Dependency> effectiveDependenciesInScopes = deps.getEffectiveDependenciesInScopes(ScopeType.COMPILE,
               ScopeType.RUNTIME);
      for (Dependency d : effectiveDependenciesInScopes) {
View Full Code Here

   public static List<String> getInstalledPlugins()
   {
      List<String> result = new ArrayList<String>();
      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      try {
         Node installed = XMLParser.parse(new FileInputStream(registryFile));
         List<Node> list = installed.get("plugin");
         for (Node plugin : list) {
            result.add(plugin.getAttribute("name") + ":" + plugin.getAttribute("slot"));
         }
      }
      catch (XMLParserException e) {
View Full Code Here

      if (Strings.isNullOrEmpty(slot))
      {
         slot = "main";
      }

      Node installed = null;
      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      try {

         if (registryFile.exists())
         {
            installed = XMLParser.parse(new FileInputStream(registryFile));
         }
         else
         {
            registryFile.mkdirs();
            registryFile.delete();
            registryFile.createNewFile();

            installed = XMLParser.parse("<installed></installed>");
         }

         installed.getOrCreate("plugin@name=" + plugin).attribute("slot", slot);
         Streams.write(XMLParser.toXMLInputStream(installed), new FileOutputStream(registryFile));
      }
      catch (FileNotFoundException e) {
         throw new RuntimeException("Could not read [" + registryFile.getAbsolutePath()
                  + "] - ", e);
View Full Code Here

      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      if (registryFile.exists())
      {
         try {
            Node installed = XMLParser.parse(new FileInputStream(registryFile));

            Node child = installed.getSingle("plugin@name=" + plugin);
            installed.removeChild(child);
            Streams.write(XMLParser.toXMLInputStream(installed), new FileOutputStream(registryFile));
         }
         catch (FileNotFoundException e) {
            // already removed
View Full Code Here

      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      if (registryFile.exists())
      {
         try {
            Node installed = XMLParser.parse(new FileInputStream(registryFile));

            Node child = installed.getSingle("plugin@name=" + plugin);
            if (child != null)
            {
               return true;
            }
         }
View Full Code Here

   public static List<String> getInstalledPlugins()
   {
      List<String> result = new ArrayList<String>();
      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      try {
         Node installed = XMLParser.parse(new FileInputStream(registryFile));
         List<Node> list = installed.get("plugin");
         for (Node plugin : list) {
            result.add(plugin.getAttribute("name") + ":" + plugin.getAttribute("slot"));
         }
      }
      catch (XMLParserException e) {
View Full Code Here

      if (Strings.isNullOrEmpty(slot))
      {
         slot = "main";
      }

      Node installed = null;
      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      try {

         if (registryFile.exists())
         {
            installed = XMLParser.parse(new FileInputStream(registryFile));
         }
         else
         {
            registryFile.mkdirs();
            registryFile.delete();
            registryFile.createNewFile();

            installed = XMLParser.parse("<installed></installed>");
         }

         installed.getOrCreate("plugin@name=" + plugin).attribute("slot", slot);
         Streams.write(XMLParser.toXMLInputStream(installed), new FileOutputStream(registryFile));
      }
      catch (FileNotFoundException e) {
         throw new RuntimeException("Could not read [" + registryFile.getAbsolutePath()
                  + "] - ", e);
View Full Code Here

      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      if (registryFile.exists())
      {
         try {
            Node installed = XMLParser.parse(new FileInputStream(registryFile));

            Node child = installed.getSingle("plugin@name=" + plugin);
            installed.removeChild(child);
            Streams.write(XMLParser.toXMLInputStream(installed), new FileOutputStream(registryFile));
         }
         catch (FileNotFoundException e) {
            // already removed
View Full Code Here

      File registryFile = new File(OSUtils.getUserHomePath() + REGISTRY);
      if (registryFile.exists())
      {
         try {
            Node installed = XMLParser.parse(new FileInputStream(registryFile));

            Node child = installed.getSingle("plugin@name=" + plugin);
            if (child != null)
            {
               return true;
            }
         }
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.