public void onError(Exception ex) { for (ResourceBuilder resourceBuilder : mResourceBuilders) { try { resourceBuilder.onError(ex); } catch (Exception e) { // throw new RuntimeException(e); } } }
public void finish() { for (ResourceBuilder resourceBuilder : mResourceBuilders) { try { resourceBuilder.finish(); } catch (Exception e) { throw new RuntimeException(e); } } }
public void build(Entity entity) { for (ResourceBuilder resourceBuilder : mResourceBuilders) { try { resourceBuilder.build(entity); } catch (Exception e) { throw new RuntimeException(e); } } }
public void init() { for (ResourceBuilder resourceBuilder : mResourceBuilders) { resourceBuilder.setContext(mBuilderConfig); try { resourceBuilder.init(); } catch (Exception e) { throw new RuntimeException(e); } } }
protected List<Project> getProjects() { ResourceBuilder rb = new ResourceBuilder(); List<Project> projects = new ArrayList<Project>(); for (String project : sourceProjects) { File file = new File(sourceDir, project); System.out.println(file.getAbsolutePath()); projects.add(rb.buildTree(file)); } return projects; }
/** * Fills the file and directory maps with resources read from the archive. * * @param src the archive to scan. * @param encoding encoding used to encode file names inside the archive. * @param fileEntries Map (name to resource) of non-directory resources found inside the archive. * @param matchFileEntries Map (name to resource) of non-directory resources found inside the * archive that matched all include patterns and didn't match any exclude patterns. * @param dirEntries Map (name to resource) of directory resources found inside the archive. * @param matchDirEntries Map (name to resource) of directory resources found inside the archive * that matched all include patterns and didn't match any exclude patterns. */ protected void fillMapsFromArchive( Resource src, String encoding, Map fileEntries, Map matchFileEntries, Map dirEntries, Map matchDirEntries) { ArchiveEntry entry = null; ArchiveInputStream ai = null; try { try { ai = StreamHelper.getInputStream(factory, src, encoding); if (ai == null) { ai = factory.getArchiveStream(new BufferedInputStream(src.getInputStream()), encoding); } } catch (IOException ex) { throw new BuildException("problem opening " + src, ex); } while ((entry = ai.getNextEntry()) != null) { if (skipUnreadable && !ai.canReadEntryData(entry)) { log(Messages.skippedIsUnreadable(entry)); continue; } Resource r = builder.buildResource(src, encoding, entry); String name = entry.getName(); if (entry.isDirectory()) { name = trimSeparator(name); dirEntries.put(name, r); if (match(name)) { matchDirEntries.put(name, r); } } else { fileEntries.put(name, r); if (match(name)) { matchFileEntries.put(name, r); } } } } catch (IOException ex) { throw new BuildException("problem reading " + src, ex); } finally { FileUtils.close(ai); } }
private void buildResourceType(ResourceBuilder resourceBuilder, ResourceType resourceType) { List<ResourceDescr> resourcesByType = this.resourcesByType.remove(resourceType); if (resourcesByType != null) { for (ResourceDescr resourceDescr : resourcesByType) { try { kBuilder.setAssetFilter(resourceDescr.getFilter()); resourceBuilder.build(kBuilder, resourceDescr); } catch (RuntimeException e) { if (buildException == null) { buildException = e; } } catch (Exception e) { if (buildException == null) { buildException = new RuntimeException(e); } } finally { kBuilder.setAssetFilter(null); } } } }