|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectaQute.lib.osgi.Processor
public class Processor
Field Summary | |
---|---|
static String |
LIST_SPLITTER
|
Constructor Summary | |
---|---|
Processor()
|
|
Processor(Processor parent)
|
|
Processor(Properties parent)
|
Method Summary | ||
---|---|---|
String |
_basedir(String[] args)
|
|
String |
_random(String[] args)
Generate a random string, which is guaranteed to be a valid Java identifier (first character is an ASCII letter, subsequent characters are ASCII letters or numbers). |
|
void |
addBasicPlugin(Object plugin)
These plugins are added to the total list of plugins. |
|
void |
addClose(Closeable jar)
|
|
void |
addIncluded(File file)
|
|
void |
addProperties(File file)
|
|
static String |
append(String... strings)
|
|
static String |
appendPath(String... parts)
Append two strings to for a path in a ZIP or JAR file. |
|
protected void |
begin()
|
|
protected Processor |
beginHandleErrors(String message)
Set the current command thread. |
|
void |
clear()
|
|
void |
close()
|
|
protected
|
customize(T plugin,
Map<String,String> map)
|
|
static Map<String,String> |
doAttrbutes(Object[] attrs,
Clazz clazz,
Macro macro)
Parse the a=b strings and return a map of them. |
|
void |
doIncludeFile(File file,
boolean overwrite,
Properties target)
|
|
protected void |
endHandleErrors(Processor previous)
End a command. |
|
void |
error(String string,
Object... args)
|
|
void |
error(String string,
Throwable t,
Object... args)
|
|
boolean |
exists()
|
|
void |
forceRefresh()
|
|
static String |
formatArrays(String string,
Object... parms)
This method is the same as String.format but it makes sure that any arrays are transformed to strings. |
|
File |
getBase()
|
|
Class<?> |
getClass(String type,
File jar)
|
|
static long |
getDuration(String tm,
long dflt)
|
|
List<String> |
getErrors()
|
|
static Executor |
getExecutor()
|
|
static File |
getFile(File base,
String file)
|
|
File |
getFile(String file)
|
|
Properties |
getFlattenedProperties()
Return the properties but expand all macros. |
|
void |
getInfo(Processor processor)
|
|
void |
getInfo(Processor processor,
String prefix)
|
|
protected Object[] |
getMacroDomains()
This should be overridden by subclasses to add extra macro command domains on the search list. |
|
static Properties |
getManifestAsProperties(InputStream in)
Read a manifest but return a properties object. |
|
Processor |
getParent()
|
|
|
getPlugin(Class<T> clazz)
Returns the first plugin it can find of the given type. |
|
protected Set<Object> |
getPlugins()
Return a list of plugins. |
|
|
getPlugins(Class<T> clazz)
Return a list of plugins that implement the given class. |
|
Properties |
getProperties()
Property handling ... |
|
File |
getPropertiesFile()
|
|
String |
getProperty(String key)
|
|
String |
getProperty(String key,
String deflt)
Get a property with a proper default |
|
Macro |
getReplacer()
|
|
Processor |
getTop()
|
|
List<String> |
getWarnings()
|
|
static boolean |
isDuplicate(String name)
|
|
boolean |
isExceptions()
|
|
boolean |
isFailOk()
|
|
boolean |
isMissingPlugin(String name)
Answer if the name is a missing plugin's command name. |
|
boolean |
isOk()
|
|
boolean |
isPedantic()
|
|
boolean |
isPerfect()
|
|
boolean |
isTrace()
|
|
static boolean |
isTrue(String value)
|
|
static String |
join(Collection<?>... list)
|
|
static String |
join(Collection<?> list,
String delimeter)
Join a list. |
|
static String |
join(Object[] list,
String delimeter)
|
|
static String |
join(String delimeter,
Collection<?>... list)
|
|
static
|
join(T[] list)
|
|
long |
lastModified()
|
|
protected void |
loadPlugins(Set<Object> list,
String spe)
|
|
Properties |
loadProperties(File file)
Helper to load a properties file from disk. |
|
static Object |
makePrintable(Object object)
Check if the object is an array and turn it into a string if it is, otherwise unchanged. |
|
static String |
merge(String... strings)
|
|
static Map<String,Map<String,String>> |
merge(String type,
Map<String,Map<String,String>> instructions,
Map<String,Map<String,String>> actual,
Set<String> superfluous,
Map<String,Map<String,String>> ignored)
Merge the attributes of two maps, where the first map can contain wildcarded names. |
|
void |
mergeProperties(File file,
boolean override)
|
|
void |
mergeProperties(Properties properties,
boolean override)
|
|
static
|
newHashMap()
|
|
|
newList()
|
|
|
newList(Collection<T> t)
|
|
static
|
newMap()
|
|
|
newMap(Map<K,V> t)
|
|
|
newSet()
|
|
|
newSet(Collection<T> t)
|
|
String |
normalize(File f)
|
|
String |
normalize(String f)
Make the file short if it is inside our base directory, otherwise long. |
|
Map<String,Map<String,String>> |
parseHeader(String value)
|
|
static Map<String,Map<String,String>> |
parseHeader(String value,
Processor logger)
Standard OSGi header parser. |
|
static void |
printClause(Map<String,String> map,
StringBuffer sb)
|
|
static String |
printClauses(Map<String,Map<String,String>> exports)
Print a standard Map based OSGi header. |
|
static String |
printClauses(Map<String,Map<String,String>> exports,
boolean checkMultipleVersions)
|
|
void |
progress(String s,
Object... args)
|
|
void |
propertiesChanged()
|
|
static String |
read(InputStream in)
|
|
boolean |
refresh()
|
|
void |
removeBasicPlugin(Object plugin)
|
|
static String |
removeDuplicateMarker(String key)
|
|
static Properties |
replaceAll(Properties p,
String pattern,
String replacement)
Replace a string in all the values of the map. |
|
void |
setBase(File base)
|
|
void |
setExceptions(boolean exceptions)
|
|
void |
setFileMustExist(boolean mustexist)
|
|
void |
setForceLocal(Collection<String> local)
|
|
void |
setParent(Processor processor)
|
|
void |
setPedantic(boolean pedantic)
|
|
void |
setProperties(File propertiesFile)
Set the properties by file. |
|
void |
setProperties(File propertiesFile,
File base)
|
|
void |
setProperties(Properties properties)
|
|
void |
setProperty(String key,
String value)
Add or override a new property. |
|
void |
setTrace(boolean x)
|
|
protected void |
setTypeSpecificPlugins(Set<Object> list)
|
|
void |
signal()
|
|
static Collection<String> |
split(String s)
|
|
static void |
split(String s,
Collection<String> set)
|
|
static Collection<String> |
split(String s,
String splitter)
|
|
void |
trace(String msg,
Object... parms)
|
|
void |
unsetProperty(String string)
|
|
boolean |
updateModified(long time,
String reason)
|
|
void |
warning(String string,
Object... args)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String LIST_SPLITTER
Constructor Detail |
---|
public Processor()
public Processor(Properties parent)
public Processor(Processor parent)
Method Detail |
---|
public void setParent(Processor processor)
public Processor getParent()
public Processor getTop()
public void getInfo(Processor processor, String prefix)
public void getInfo(Processor processor)
public void warning(String string, Object... args)
warning
in interface Reporter
public void error(String string, Object... args)
error
in interface Reporter
public void error(String string, Throwable t, Object... args)
public void signal()
public List<String> getWarnings()
getWarnings
in interface Reporter
public List<String> getErrors()
getErrors
in interface Reporter
public Map<String,Map<String,String>> parseHeader(String value)
public static Map<String,Map<String,String>> parseHeader(String value, Processor logger)
value
-
public void addClose(Closeable jar)
public void progress(String s, Object... args)
progress
in interface Reporter
public boolean isPedantic()
isPedantic
in interface Reporter
public void setPedantic(boolean pedantic)
public static File getFile(File base, String file)
public File getFile(String file)
public <T> List<T> getPlugins(Class<T> clazz)
getPlugins
in interface Registry
clazz
- Each returned plugin implements this class/interface
public <T> T getPlugin(Class<T> clazz)
getPlugin
in interface Registry
T
- clazz
-
protected Set<Object> getPlugins()
protected void loadPlugins(Set<Object> list, String spe)
list
- spe
- protected void setTypeSpecificPlugins(Set<Object> list)
protected <T> T customize(T plugin, Map<String,String> map)
plugin
- entry
- public boolean isFailOk()
public File getBase()
public void setBase(File base)
public void clear()
public void trace(String msg, Object... parms)
trace
in interface Reporter
public <T> List<T> newList()
public <T> Set<T> newSet()
public static <K,V> Map<K,V> newMap()
public static <K,V> Map<K,V> newHashMap()
public <T> List<T> newList(Collection<T> t)
public <T> Set<T> newSet(Collection<T> t)
public <K,V> Map<K,V> newMap(Map<K,V> t)
public void close()
close
in interface Closeable
public String _basedir(String[] args)
public Properties getProperties()
public String getProperty(String key)
public void mergeProperties(File file, boolean override)
public void mergeProperties(Properties properties, boolean override)
public void setProperties(Properties properties)
public void addProperties(File file) throws Exception
Exception
public void addIncluded(File file)
public void doIncludeFile(File file, boolean overwrite, Properties target) throws Exception
file
- parent
- done
- overwrite
-
FileNotFoundException
IOException
Exception
public void unsetProperty(String string)
public boolean refresh()
public void forceRefresh()
public void propertiesChanged()
public void setProperties(File propertiesFile) throws IOException
propertiesFile
-
FileNotFoundException
IOException
public void setProperties(File propertiesFile, File base)
protected void begin()
public static boolean isTrue(String value)
public String getProperty(String key, String deflt)
headerName
- deflt
-
public Properties loadProperties(File file) throws IOException
file
-
IOException
public static Properties replaceAll(Properties p, String pattern, String replacement)
public static Map<String,Map<String,String>> merge(String type, Map<String,Map<String,String>> instructions, Map<String,Map<String,String>> actual, Set<String> superfluous, Map<String,Map<String,String>> ignored)
instructions
- the instructions with patterns. Aactual
- the actual found packagespublic static String printClauses(Map<String,Map<String,String>> exports)
exports
- map { name => Map { attribute|directive => value } }
public static String printClauses(Map<String,Map<String,String>> exports, boolean checkMultipleVersions)
public static void printClause(Map<String,String> map, StringBuffer sb)
public Macro getReplacer()
protected Object[] getMacroDomains()
public Properties getFlattenedProperties()
public boolean updateModified(long time, String reason)
public long lastModified()
public void setProperty(String key, String value)
key
- value
- public static Properties getManifestAsProperties(InputStream in) throws IOException
in
-
IOException
public File getPropertiesFile()
public void setFileMustExist(boolean mustexist)
public static String read(InputStream in) throws Exception
Exception
public static String join(Collection<?> list, String delimeter)
args
-
public static String join(String delimeter, Collection<?>... list)
public static String join(Object[] list, String delimeter)
public static String join(Collection<?>... list)
public static <T> String join(T[] list)
public static void split(String s, Collection<String> set)
public static Collection<String> split(String s)
public static Collection<String> split(String s, String splitter)
public static String merge(String... strings)
public boolean isExceptions()
public void setExceptions(boolean exceptions)
public String normalize(String f)
f
-
public String normalize(File f)
public static String removeDuplicateMarker(String key)
public static boolean isDuplicate(String name)
public void setTrace(boolean x)
public boolean exists()
public boolean isOk()
public boolean isPerfect()
public void setForceLocal(Collection<String> local)
public boolean isMissingPlugin(String name)
name
-
public static String appendPath(String... parts)
"/" + "abc/def/" becomes "abc/def" @param prefix @param suffix @return
public static Map<String,String> doAttrbutes(Object[] attrs, Clazz clazz, Macro macro)
attrs
- clazz
-
public static String formatArrays(String string, Object... parms)
string
- parms
-
public static Object makePrintable(Object object)
object
- the object to make printable
public static String append(String... strings)
public Class<?> getClass(String type, File jar) throws Exception
Exception
public boolean isTrace()
public static long getDuration(String tm, long dflt)
public String _random(String[] args)
protected Processor beginHandleErrors(String message)
#end(Processor)
method. The method returns the previous command
owner or null.
The command owner will receive all warnings and error reports.
protected void endHandleErrors(Processor previous)
previous
- public static Executor getExecutor()
public void addBasicPlugin(Object plugin)
plugin
- public void removeBasicPlugin(Object plugin)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |