Package org.jboss.forge.addon.resource.util

Examples of org.jboss.forge.addon.resource.util.ResourcePathResolver


      Result result = Results.success();
      UIOutput output = shell.getOutput();
      while (it.hasNext())
      {
         final Resource<?> resource = it.hasNext() ?
                  (new ResourcePathResolver(resourceFactory, currentResource, it.next()).resolve().get(0))
                  : currentResource;

         if (!resource.exists())
         {
            output.err().println("cat: " + resource.getName() + ": No such file or directory");
View Full Code Here


      {
         String value = it.next();
         boolean searching = (value.matches(".*(\\?|\\*)+.*"));
         try
         {
            resourceList = new ResourcePathResolver(resourceFactory, currentResource, value).resolve();
         }
         catch (RuntimeException re)
         {
            if (re.getMessage() == null || !re.getMessage().contains("no such child"))
            {
View Full Code Here

      else
      {
         Resource<?> selectedResource = currentResource;
         ALL: for (String path : arguments.getValue())
         {
            List<Resource<?>> resources = new ResourcePathResolver(resourceFactory, currentResource, path).resolve();
            for (Resource<?> resource : resources)
            {
               if (resource.exists())
               {
                  final PipedOutputStream stdin = new PipedOutputStream();
View Full Code Here

      Iterator<String> it = value == null ? Collections.<String> emptyIterator() : value.iterator();
      final Result result;
      if (it.hasNext())
      {
         String newPath = it.next();
         final List<Resource<?>> newResource = new ResourcePathResolver(resourceFactory, currentResource, newPath)
                  .resolve();
         if (newResource.isEmpty() || !newResource.get(0).exists())
         {
            result = Results.fail(newPath + ": No such file or directory");
         }
View Full Code Here

   public Result execute(UIExecutionContext context) throws Exception
   {
      Resource<?> currentResource = (Resource<?>) context.getUIContext().getInitialSelection().get();
      for (String path : arguments.getValue())
      {
         List<Resource<?>> resources = new ResourcePathResolver(resourceFactory, currentResource, path).resolve();
         for (Resource<?> resource : resources)
         {
            FileResource<?> file = resourceFactory.create(FileResource.class,
                     new File(resource.getFullyQualifiedName()));
View Full Code Here

      Result result = Results.success();
      UIOutput output = shell.getOutput();
      while (it.hasNext())
      {
         final Resource<?> resource = it.hasNext() ?
                  (new ResourcePathResolver(resourceFactory, currentResource, it.next()).resolve().get(0)) : currentResource;

         if (!resource.exists())
         {
            output.err().println("cat: " + resource.getName() + ": No such file or directory");
            result = Results.fail();
View Full Code Here

      List<Result> results = new ArrayList<>();
      Resource<?> currentResource = (Resource<?>) context.getUIContext().getInitialSelection().get();

      ALL: for (String path : arguments.getValue())
      {
         List<Resource<?>> resources = new ResourcePathResolver(resourceFactory, currentResource, path).resolve();
         for (Resource<?> resource : resources)
         {
            if (resource.exists())
            {
               final PipedOutputStream stdin = new PipedOutputStream();
View Full Code Here

   public Result execute(UIExecutionContext context) throws Exception
   {
      Resource<?> currentResource = (Resource<?>) context.getUIContext().getInitialSelection().get();
      for (String file : arguments.getValue())
      {
         List<Resource<?>> resources = new ResourcePathResolver(resourceFactory, currentResource, file).resolve();
         for (Resource<?> resource : resources)
         {
            if (!resource.exists())
            {
               return Results.fail(file + ": no such file or directory");
            }
         }
      }

      boolean forceOption = force.getValue();
      boolean recurse = recursive.getValue();
      UIPrompt prompt = context.getPrompt();
      UIOutput output = context.getUIContext().getProvider().getOutput();
      for (String file : arguments.getValue())
      {
         List<Resource<?>> resources = new ResourcePathResolver(resourceFactory, currentResource, file).resolve();
         for (Resource<?> resource : resources)
         {
            if ((resource instanceof DirectoryResource))
            {
               if (!recurse)
View Full Code Here

   public Result execute(UIExecutionContext context) throws Exception
   {
      Resource<?> currentResource = (Resource<?>) context.getUIContext().getInitialSelection().get();
      for (String path : arguments.getValue())
      {
         List<Resource<?>> resources = new ResourcePathResolver(resourceFactory, currentResource, path).resolve();
         if (resources.isEmpty())
         {
            return Results.fail(path + ": path could not be resolved");
         }
         for (Resource<?> resource : resources)
View Full Code Here

      List<Resource<?>> resourceList;
      if (it.hasNext())
      {
         String value = it.next();
         boolean searching = (value.matches(".*(\\?|\\*)+.*"));
         resourceList = new ResourcePathResolver(resourceFactory, currentResource, value).resolve();
         if (!searching && !resourceList.isEmpty() && resourceList.get(0).exists())
         {
            resourceList = resourceList.get(0).listResources();
         }
      }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.resource.util.ResourcePathResolver

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.