public class DependencyResolver extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
baseDir |
protected File[] |
lookupDirs |
protected String |
lookupPrefix |
protected String |
mergedPrefix |
protected File[] |
resourcePath |
protected String |
rootComponent |
| Constructor and Description |
|---|
DependencyResolver(String lookupPrefix,
String mergedPrefix,
String rootComponent,
String[] resourcePath) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
createScriptTags(List<String> jsFileNames)
returns document.write() script tags for each dependent js library.
|
List<String> |
findFilesInDirs(java.util.function.BiFunction<String,String,Boolean> filter)
iterates all component directorys, list each (nonrecursively) and return all component/filenames
where filter returns true.
|
String |
getBaseDir() |
protected List<File> |
getDependentDirs(String comp,
List<File> li,
HashSet<String> alreadyCheckedDependencies)
creates a lookup path for given component.
|
String |
getRootComponent() |
List<File> |
locateComponent(String name) |
File |
locateResource(String name)
iterate component directories in order and return full path of first file matching
|
byte[] |
mergeBinary(List<String> fileNames)
lookup (ordered directory computed by resourcepath) and merge scripts into a single byte[].
|
byte[] |
mergeScripts(List<String> fileNames)
lookup (ordered directory computed by resourcepath) and merge scripts into a single byte[].
|
byte[] |
mergeTextSnippets(List<String> names,
String startTag,
String endTag)
locate ressource file on the directory path and merge them in a document.write file.
|
protected DependencyResolver |
setBaseDir(String baseDir) |
protected DependencyResolver |
setResourcePath(String... path) |
protected void |
setRootComponent(String name) |
protected String mergedPrefix
protected String lookupPrefix
protected File[] resourcePath
protected File[] lookupDirs
protected String baseDir
protected String rootComponent
public String getBaseDir()
protected DependencyResolver setBaseDir(String baseDir)
protected DependencyResolver setResourcePath(String... path)
protected void setRootComponent(String name)
public String getRootComponent()
public List<String> findFilesInDirs(java.util.function.BiFunction<String,String,Boolean> filter)
filter - public File locateResource(String name)
name - public List<File> locateComponent(String name)
name - protected List<File> getDependentDirs(String comp, List<File> li, HashSet<String> alreadyCheckedDependencies) throws IOException
comp - - component name to lookupli - - growing list of filesalreadyCheckedDependencies - - already visited componentsIOExceptionpublic byte[] createScriptTags(List<String> jsFileNames)
jsFileNames - public byte[] mergeScripts(List<String> fileNames)
fileNames - list script (.js) filenamespublic byte[] mergeBinary(List<String> fileNames)
fileNames - list of filenames to mergeCopyright © 2015. All rights reserved.