Tabnine Logo
ResourceFile$Finder
Code IndexAdd Tabnine to your IDE (free)

How to use
ResourceFile$Finder
in
it.tidalwave.northernwind.core.model

Best Java code snippets using it.tidalwave.northernwind.core.model.ResourceFile$Finder (Showing top 16 results out of 315)

origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

for (final ResourceFile fileObject : delegateDirectory.findChildren().results())
origin: it.tidalwave.northernwind.rca/it-tidalwave-northernwind-rca-model

return folder.findChildren().withName(localizedFileName).result();
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

 @Override @Nonnull
 protected List<? extends ResourceFile> computeResults()
  {
   if (name != null)
    {
     if (name.contains("/"))
      {
       throw new IllegalArgumentException("relativePath: " + name);
      }
     final ResourceFile child = getChildrenMap().get(name);
     return (child != null) ? Collections.singletonList(child) : Collections.<ResourceFile>emptyList();
    }
   //
   // FIXME: this reproduces the behaviour before the refactoring for NW-192 - but it's (and was) wrong
   // since it doesn't consider delegates. It should be rewritten by relying on getChildrenMap() and
   // making it eventually support recursion.
   //
   else if (recursive)
    {
     return delegate.findChildren().withRecursion(recursive).results();
    }
   else
    {
     return new ArrayList<>(getChildrenMap().values());
    }
  }
};
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

for (final ResourceFile fo : zipFolder.findChildren().results())
origin: it.tidalwave.northernwind.rca/it-tidalwave-northernwind-rca-model

 /*******************************************************************************************************************
  *
  *
  ******************************************************************************************************************/
 @Nonnull
 private ResourceProperties loadProperties()
  throws IOException
  {
   final ResourceFile file = getFile();
   log.debug("loadProperties() for {}", file.getPath().asString());
   ResourceProperties properties = modelFactory.createProperties().withPropertyResolver(propertyResolver).build();
   try
    {
     final ResourceFile propertyFile = file.findChildren().withName("Properties.xml").result(); // FIXME reuse the inheritance helper
 //        log.trace(">>>> reading properties from {} ({})...", propertyFile.getPath().asString(), locale);
     @Cleanup final InputStream is = propertyFile.getInputStream();
     final ResourceProperties tempProperties =
 //            modelFactory.createProperties().build().as(Unmarshallable).unmarshal(is);
         modelFactory.createProperties().withPropertyResolver(propertyResolver).build().as(Unmarshallable).unmarshal(is);
 //        log.trace(">>>>>>>> read properties: {} ({})", tempProperties, locale);
     properties = properties.merged(tempProperties);
    }
   catch (NotFoundException e)
    {
     // ok, no properties
    }
   return properties;
  }
}
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

@BeforeMethod
public void setup()
 throws Exception
 {
  final ClassPathXmlApplicationContext context =
      new ClassPathXmlApplicationContext("META-INF/CommonsAutoBeans.xml",
                        "META-INF/XsltTemplateTestBeans.xml",
                        "META-INF/CachedUriResolverBeans.xml");
  filter = context.getBean(XsltMacroFilter.class);
  context.getBean(CachedURIResolver.class).setCacheFolderPath("target/CachedUriResolver");
  final SiteProvider siteProvider = context.getBean(SiteProvider.class);
  final Site site = mock(Site.class);
  when(siteProvider.getSite()).thenReturn(site);
  final ResourceFileSystemProvider fileSystemProvider = mock(ResourceFileSystemProvider.class);
  when(site.getFileSystemProvider()).thenReturn(fileSystemProvider);
  final File root = new File("src/main/resources/content/library/XsltTemplates").getAbsoluteFile();
  final ResourceFileSystemProvider localFileSystemProvider = new LocalFileSystemProvider();
  final ResourceFile file = localFileSystemProvider.getFileSystem().findFileByPath(root.getAbsolutePath());
  final List<Resource> resources = new ArrayList<>();
  for (final ResourceFile xsltFile : file.findChildren().results())
   {
    final Resource resource = mock(Resource.class);
    when(resource.getFile()).thenReturn(xsltFile);
    resources.add(resource);
   }
  when(site.find(eq(Resource.class))).thenReturn(new MockResourceFinder(resources));
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

 /*******************************************************************************************************************
  *
  *
  ******************************************************************************************************************/
 private void copyFolder (final @Nonnull ResourceFile sourceFolder, final @Nonnull ResourceFile targetFolder)
  throws IOException
  {
   log.trace("copyFolder({}, {}", sourceFolder, targetFolder);
   for (final ResourceFile sourceChild : sourceFolder.findChildren().results())
    {
     if (!sourceChild.isFolder())
      {
       log.trace(">>>> copying {} into {} ...", sourceChild, targetFolder);
       sourceChild.copyTo(targetFolder);
      }
    }
   for (final ResourceFile sourceChild : sourceFolder.findChildren().results())
    {
     if (sourceChild.isFolder())
      {
       copyFolder(sourceChild, targetFolder.createFolder(sourceChild.getName()));
      }
    }
  }
}
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 * {@inheritDoc}
 *
 ******************************************************************************************************************/
@Override @Nonnull
protected List<? extends Type> computeResults()
 {
  final List<Type> result = new ArrayList<>();
  for (final ResourceFile childFile : parentFile.findChildren().withRecursion(true).results())
   {
    if (childFile.isFolder())
     {
      try
       {
        final String relativeUri = childFile.getPath().relativeTo(resourceRootPath).urlDecoded().asString();
        result.add(siteProvider.get().getSite().find(typeClass).withRelativePath(relativeUri).result());
       }
      catch (NotFoundException e)
       {
        log.error("", e);
       }
     }
   }
  return result;
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

return folder.findChildren().withName(localizedFileName).result();
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 ******************************************************************************************************************/
private List<ResourceFile> getFiles (final @Nonnull String prefix,
                   final @Nonnull String propertyFileName,
                   final @Nonnull ResourceFile folder,
                   final @Nonnull List<String> suffixes)
 {
  final List<ResourceFile> files = new ArrayList<>();
  for (final String localeSuffix : suffixes)
   {
    final String fileName = prefix + propertyFileName + localeSuffix + ".xml";
    log.trace(">>>> probing {} ...", folder.getPath().asString() + "/" + fileName);
    try
     {
      files.add(folder.findChildren().withName(fileName).result());
     }
    catch (NotFoundException e)
     {
      // ok. do nothing
     }
   }
  return files;
 }
origin: it.tidalwave.northernwind.rca/it-tidalwave-northernwind-rca-model

 @Override @Nonnull
 protected List<? extends T> computeResults()
  {
   // FIXME: it's not flyweight
   final List<T> results = new ArrayList<>();
   for (final ResourceFile childFile : resourceFile.findChildren().results())
    {
     if (childFile.isFolder())
      {
       try
        {
         results.add(productCreator.createProduct(childFile));
        }
       catch (IOException | NotFoundException e)
        {
         throw new RuntimeException(e);
        }
      }
    }
   return results;
  }
}
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 * Traverse the file system with a {@link FilePredicate}.
 *
 * @param  file        the file to traverse
 * @param  fileFilter  the filter for directory contents
 * @param  predicate   the predicate
 *
 ******************************************************************************************************************/
private void traverse (final @Nonnull ResourcePath rootPath,
            final @Nonnull ResourceFile file,
            final @Nonnull FileFilter fileFilter,
            final @Nonnull FilePredicate predicate)
 {
  log.trace("traverse({}, {}, {}, {})", rootPath, file, fileFilter, predicate);
  final ResourcePath relativePath = file.getPath().urlDecoded().relativeTo(rootPath);
  if (fileFilter.accept(file))
   {
    predicate.apply(file, relativePath);
   }
  for (final ResourceFile child : file.findChildren().results())
   {
    traverse(rootPath, child, fileFilter, predicate);
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 ******************************************************************************************************************/
@Nonnull
protected ResourceFile createMockFolder (final @Nonnull ResourceFileSystem fileSystem,
                     final @Nonnull ResourceFile parentFolder,
                     final @Nonnull String name)
 {
  final ResourcePath path = parentFolder.getPath().appendedWith(name);
  final ResourceFile folder = createMockFolder(name);
  when(folder.getParent()).thenReturn(parentFolder);
  when(folder.getPath()).thenReturn(path);
  when(folder.toString()).thenReturn(path.asString());
  when(fileSystem.findFileByPath(eq(path.asString()))).thenReturn(folder);
  final Collection<ResourceFile> children = new ArrayList<>(parentFolder.findChildren().results());
  children.add(folder);
  when(parentFolder.findChildren()).thenReturn(new ListFinder(children));
  return folder;
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

/*******************************************************************************************************************
 *
 *
 *
 ******************************************************************************************************************/
private static void dump (final @Nonnull List<String> lines, final @Nonnull ResourceFile fileObject)
 throws IOException
 {
  if (fileObject.isData())
   {
    lines.add(String.format("%s: %s", fileObject.getPath().asString(), fileObject.asText("UTF-8")));
   }
  else
   {
    for (final ResourceFile child : fileObject.findChildren().results())
     {
      dump(lines, child);
     }
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 ******************************************************************************************************************/
@Nonnull
protected ResourceFile createMockFile (final @Nonnull ResourceFileSystem fileSystem,
                    final @Nonnull ResourceFile parentFolder,
                    final @Nonnull String name)
 {
  final ResourcePath path = parentFolder.getPath().appendedWith(name);
  final ResourceFile file = createMockFile(name);
  when(file.getParent()).thenReturn(parentFolder);
  when(file.getPath()).thenReturn(path);
  when(file.toString()).thenReturn(path.asString());
  when(fileSystem.findFileByPath(eq(path.asString()))).thenReturn(file);
  final Collection<ResourceFile> children = new ArrayList<>(parentFolder.findChildren().results());
  children.add(file);
  when(parentFolder.findChildren()).thenReturn(new ListFinder(children));
  return file;
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
private void emptyFolder (final @Nonnull ResourceFile folder)
 throws IOException
 {
  log.trace("emptyFolder({}, {}", folder);
  for (final ResourceFile child : folder.findChildren().results())
   {
    child.delete();
   }
 }
it.tidalwave.northernwind.core.modelResourceFile$Finder

Most used methods

  • results
  • result
  • withName
  • withRecursion

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • setContentView (Activity)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Notification (javax.management)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now