*) correcting usage of supportedFileExt-List

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@315 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 83ceec3a63
commit aae9a433a6

@ -100,6 +100,12 @@ public final class plasmaParser {
*/ */
private static final HashSet supportedFileExt = new HashSet(); private static final HashSet supportedFileExt = new HashSet();
/**
* A list of file extensions that are supported by the html-parser and can
* be parsed in realtime.
*/
private static final HashSet supportedRealtimeFileExt = new HashSet();
/** /**
* A list of mimeTypes that can be parsed in Realtime (on the fly) * A list of mimeTypes that can be parsed in Realtime (on the fly)
*/ */
@ -113,7 +119,7 @@ public final class plasmaParser {
private static plasmaParserPool theParserPool; private static plasmaParserPool theParserPool;
/** /**
* A list of media extensions that should not be handled by the plasmaParser * A list of media extensions that should <b>not</b> be handled by the plasmaParser
*/ */
private static final HashSet mediaExtSet = new HashSet(28); private static final HashSet mediaExtSet = new HashSet(28);
@ -170,6 +176,13 @@ public final class plasmaParser {
loadAvailableParserList(); loadAvailableParserList();
} }
/**
* This function is used to initialize the realtimeParsableMimeTypes List.
* This list contains a list of mimeTypes that can be parsed in realtime by
* the yacy html-Parser
* @param realtimeParsableMimeTypes a list of mimetypes that can be parsed by the
* yacy html parser
*/
public static void initRealtimeParsableMimeTypes(String realtimeParsableMimeTypes) { public static void initRealtimeParsableMimeTypes(String realtimeParsableMimeTypes) {
LinkedList mimeTypes = new LinkedList(); LinkedList mimeTypes = new LinkedList();
if ((realtimeParsableMimeTypes == null) || (realtimeParsableMimeTypes.length() == 0)) { if ((realtimeParsableMimeTypes == null) || (realtimeParsableMimeTypes.length() == 0)) {
@ -181,6 +194,13 @@ public final class plasmaParser {
initRealtimeParsableMimeTypes(mimeTypes); initRealtimeParsableMimeTypes(mimeTypes);
} }
/**
* This function is used to initialize the realtimeParsableMimeTypes List.
* This list contains a list of mimeTypes that can be parsed in realtime by
* the yacy html-Parser
* @param realtimeParsableMimeTypes a list of mimetypes that can be parsed by the
* yacy html parser
*/
public static void initRealtimeParsableMimeTypes(List mimeTypesList) { public static void initRealtimeParsableMimeTypes(List mimeTypesList) {
synchronized (realtimeParsableMimeTypes) { synchronized (realtimeParsableMimeTypes) {
realtimeParsableMimeTypes.clear(); realtimeParsableMimeTypes.clear();
@ -218,10 +238,10 @@ public final class plasmaParser {
} }
} }
public static void initSupportedFileExt(List supportedFileExtList) { public static void initSupportedRealtimeFileExt(List supportedRealtimeFileExtList) {
synchronized (mediaExtSet) { synchronized (supportedRealtimeFileExt) {
supportedFileExt.clear(); supportedRealtimeFileExt.clear();
supportedFileExt.addAll(supportedFileExtList); supportedRealtimeFileExt.addAll(supportedRealtimeFileExtList);
} }
} }
@ -246,8 +266,14 @@ public final class plasmaParser {
public static boolean supportedFileExtContains(String mediaExt) { public static boolean supportedFileExtContains(String mediaExt) {
if (supportedFileExt == null) return false; if (supportedFileExt == null) return false;
//System.out.println("supported ext: " + supportedFileExt.toString());
return (supportedFileExt.contains(mediaExt)); synchronized(supportedFileExt) {
if (supportedFileExt.contains(mediaExt)) return true;
}
synchronized (supportedRealtimeFileExt) {
return supportedRealtimeFileExt.contains(mediaExt);
}
} }
public static boolean mediaExtContains(String mediaExt) { public static boolean mediaExtContains(String mediaExt) {
@ -328,13 +354,13 @@ public final class plasmaParser {
} }
synchronized (enabledParserList) { synchronized (enabledParserList) {
//enabledParserList.clear(); enabledParserList.clear();
enabledParserList.putAll(newEnabledParsers); enabledParserList.putAll(newEnabledParsers);
} }
synchronized (supportedFileExt) { synchronized (supportedFileExt) {
//supportedFileExt.clear(); supportedFileExt.clear();
supportedFileExt.addAll(newSupportedFileExt); supportedFileExt.addAll(newSupportedFileExt);
} }

@ -265,7 +265,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// define an extension-blacklist // define an extension-blacklist
log.logSystem("Parser: Initializing Extension Mappings for Media/Parser"); log.logSystem("Parser: Initializing Extension Mappings for Media/Parser");
plasmaParser.initMediaExt(plasmaParser.extString2extList(getConfig("mediaExt",""))); plasmaParser.initMediaExt(plasmaParser.extString2extList(getConfig("mediaExt","")));
plasmaParser.initSupportedFileExt(plasmaParser.extString2extList(getConfig("parseableExt",""))); plasmaParser.initSupportedRealtimeFileExt(plasmaParser.extString2extList(getConfig("parseableExt","")));
// define a realtime parsable mimetype list // define a realtime parsable mimetype list
log.logSystem("Parser: Initializing Mime Types"); log.logSystem("Parser: Initializing Mime Types");

Loading…
Cancel
Save