Methods Summary |
---|
public static void | addFilterLibrary(java.lang.String libraryPath)Adds a new Java library to the list to be scanned for filters.
libraryPath must be an absolute path of the jar file. This needs to be
static because only one classloader per process can open a shared native
library, which a filter may well have.
if (mLogVerbose) Log.v(TAG, "Adding filter library " + libraryPath);
synchronized(mClassLoaderGuard) {
if (mLibraries.contains(libraryPath)) {
if (mLogVerbose) Log.v(TAG, "Library already added");
return;
}
mLibraries.add(libraryPath);
// Chain another path loader to the current chain
mCurrentClassLoader = new PathClassLoader(libraryPath, mCurrentClassLoader);
}
|
public void | addPackage(java.lang.String packageName)
if (mLogVerbose) Log.v(TAG, "Adding package " + packageName);
/* TODO: This should use a getPackage call in the caller's context, but no such method exists.
Package pkg = Package.getPackage(packageName);
if (pkg == null) {
throw new IllegalArgumentException("Unknown filter package '" + packageName + "'!");
}
*/
mPackages.add(packageName);
|
public android.filterfw.core.Filter | createFilterByClass(java.lang.Class filterClass, java.lang.String filterName)
// Make sure this is a Filter subclass
try {
filterClass.asSubclass(Filter.class);
} catch (ClassCastException e) {
throw new IllegalArgumentException("Attempting to allocate class '" + filterClass
+ "' which is not a subclass of Filter!");
}
// Look for the correct constructor
Constructor filterConstructor = null;
try {
filterConstructor = filterClass.getConstructor(String.class);
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException("The filter class '" + filterClass
+ "' does not have a constructor of the form <init>(String name)!");
}
// Construct the filter
Filter filter = null;
try {
filter = (Filter)filterConstructor.newInstance(filterName);
} catch (Throwable t) {
// Condition checked below
}
if (filter == null) {
throw new IllegalArgumentException("Could not construct the filter '"
+ filterName + "'!");
}
return filter;
|
public android.filterfw.core.Filter | createFilterByClassName(java.lang.String className, java.lang.String filterName)
if (mLogVerbose) Log.v(TAG, "Looking up class " + className);
Class filterClass = null;
// Look for the class in the imported packages
for (String packageName : mPackages) {
try {
if (mLogVerbose) Log.v(TAG, "Trying "+packageName + "." + className);
synchronized(mClassLoaderGuard) {
filterClass = mCurrentClassLoader.loadClass(packageName + "." + className);
}
} catch (ClassNotFoundException e) {
continue;
}
// Exit loop if class was found.
if (filterClass != null) {
break;
}
}
if (filterClass == null) {
throw new IllegalArgumentException("Unknown filter class '" + className + "'!");
}
return createFilterByClass(filterClass, filterName);
|
public static android.filterfw.core.FilterFactory | sharedFactory()
if (mSharedFactory == null) {
mSharedFactory = new FilterFactory();
}
return mSharedFactory;
|