Package org.jboss.forge.resources

Examples of org.jboss.forge.resources.DirectoryResource


   {
      Project project = null;
      List<ProjectLocator> locators = getLocators();
      for (ProjectLocator locator : locators)
      {
         DirectoryResource root = locateRecursively(startingPath, locator);

         if ((root != null) && locator.containsProject(root))
         {
            project = locator.createProject(root);
            if (project != null)
View Full Code Here


      {
         File homeDir = new File(System.getProperty("user.home")).getAbsoluteFile();

         if (path.length() == 1)
         {
            return singleResult(new DirectoryResource(factory, homeDir));
         }
         else
         {
            cursor++;
            r = new DirectoryResource(factory, homeDir);
         }
      }
      // for windows, support drive letter prefixes here.
      else if (isWindows && path.matches("^[a-zA-Z]{1,1}:(/|\\\\).*"))
      {
         int idx = path.lastIndexOf(slashChar) + 1;
         r = new DirectoryResource(factory, new File(path.substring(0, idx)).getAbsoluteFile());
         cursor = idx;
      }
      // Is an URL ?
      else if (path.matches(".*://.*"))
      {
View Full Code Here

            final PipeOut out,
            @Option(name = "bundleName", description = "Bundle Name", defaultValue = "messages") final String bundleName)
            throws Exception
   {
      String fullBundleFile = bundleName.endsWith(".properties") ? bundleName : bundleName + ".properties";
      DirectoryResource resourceFolder = project.getFacet(ResourceFacet.class).getResourceFolder();

      PropertiesFileResource bundleFile = resourceFolder.getChildOfType(PropertiesFileResource.class, fullBundleFile);
      if (!bundleFile.exists())
      {
         bundleFile.createNewFile();
      }
View Full Code Here

       * First try resolving the artifact directly from the local repository - then fall back to aether. This may be a
       * bad practice but we can revisit if problems arise.
       */
      if (dep.getVersion() != null)
      {
         DirectoryResource dir = (DirectoryResource) factory.getResourceFrom(new File(container.getSettings()
                  .getLocalRepository()));
         if ((dir != null) && dir.exists())
         {
            List<String> segments = new ArrayList<String>();
            segments.addAll(Arrays.asList((dep.getGroupId() + "." + dep.getArtifactId()).split("\\.")));
            segments.add(dep.getVersion());

            for (String seg : segments)
            {
               dir = dir.getChildDirectory(seg);
               if (!dir.isDirectory())
               {
                  break;
               }
            }

            if (dir.isDirectory())
            {
               Resource<?> jar = dir.getChild(dep.getArtifactId() + "-" + dep.getVersion() + "."
                        + dep.getPackagingType());
               if (jar.exists())
               {
                  FileResource<?> jarFile = jar.reify(FileResource.class);
                  result.add(new DependencyResource(jarFile.getResourceFactory(), jarFile
View Full Code Here

   protected DirectoryResource createTempFolder() throws IOException
   {
      File tempFolder = File.createTempFile(PKG, null);
      tempFolder.delete();
      tempFolder.mkdirs();
      DirectoryResource resource = factory.getResourceFrom(tempFolder).reify(DirectoryResource.class);
      tempFolders.add(resource);
      return resource;
   }
View Full Code Here

   protected DirectoryResource createTempFolder() throws IOException
   {
      File tempFolder = File.createTempFile(PKG, null);
      tempFolder.delete();
      tempFolder.mkdirs();
      DirectoryResource resource = factory.getResourceFrom(tempFolder).reify(DirectoryResource.class);
      tempFolders.add(resource);
      return resource;
   }
View Full Code Here

   }

   @Override
   public boolean isInstalled()
   {
      DirectoryResource webRoot = project.getFacet(WebResourceFacet.class).getWebRootDirectory();
      return webRoot.exists();
   }
View Full Code Here

   @Override
   public boolean install()
   {
      if (!isInstalled())
      {
         DirectoryResource webRoot = project.getFacet(WebResourceFacet.class).getWebRootDirectory();
         if (!webRoot.exists())
         {
            webRoot.mkdirs();
         }
      }
      return super.install();
   }
View Full Code Here

   }

   @Override
   public FileResource<?> getConfigFile()
   {
      DirectoryResource webRoot = project.getFacet(WebResourceFacet.class).getWebRootDirectory();
      final FileResource<?> child = (FileResource<?>) webRoot.getChild("WEB-INF" + File.separator + "web.xml");

      if (!child.exists())
      {
         return new UnknownFileResource(child.getResourceFactory(), child.getUnderlyingResourceObject())
         {
View Full Code Here

    * List all servlet resource files.
    */
   @Override
   public List<Resource<?>> getResources()
   {
      DirectoryResource webRoot = project.getFacet(WebResourceFacet.class).getWebRootDirectory();
      return listChildrenRecursively(webRoot);
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.resources.DirectoryResource

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.