@Test public final void testFromString() { StringBuffer buffer = new StringBuffer(); BufferedReader profileReader = null; try { profileReader = new BufferedReader(new FileReader(new File(testFile))); String line = null; while( (line=profileReader.readLine()) != null) { buffer.append(line); buffer.append("\n"); } assertNotNull(HeritrixProfile.fromString(buffer.toString())); } catch(Exception e) { fail(e.getMessage()); } }
public static HeritrixProfile fromString(String str) { try { XMLReader parser = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); StringReader reader = new StringReader(str); XMLSettingsHandler settingsHandler = new XMLSettingsHandler(new File("dummy_file")); parser.setContentHandler(new CrawlSettingsSAXHandler(settingsHandler.getSettings(null))); InputSource source = new InputSource(reader); parser.parse(source); HeritrixProfile profile = new HeritrixProfile(settingsHandler, null); return profile; } catch(SAXException ex) { throw new WCTRuntimeException(ex); } catch(ParserConfigurationException pcex) { throw new WCTRuntimeException(pcex); } catch (IOException e) { throw new WCTRuntimeException(e); } catch (InvalidAttributeValueException e) { throw new WCTRuntimeException(e); } }
HeritrixProfile { public static HeritrixProfile fromString(String str) { try { XMLReader parser = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); StringReader reader = new StringReader(str); XMLSettingsHandler settingsHandler = new XMLSettingsHandler(new File("dummy_file")); parser.setContentHandler(new CrawlSettingsSAXHandler(settingsHandler.getSettings(null))); InputSource source = new InputSource(reader); parser.parse(source); HeritrixProfile profile = new HeritrixProfile(settingsHandler, null); return profile; } catch(SAXException ex) { throw new WCTRuntimeException(ex); } catch(ParserConfigurationException pcex) { throw new WCTRuntimeException(pcex); } catch (IOException e) { throw new WCTRuntimeException(e); } catch (InvalidAttributeValueException e) { throw new WCTRuntimeException(e); } } }
HeritrixProfile { public static HeritrixProfile fromString(String str) { try { XMLReader parser = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); StringReader reader = new StringReader(str); XMLSettingsHandler settingsHandler = new XMLSettingsHandler(new File("dummy_file")); parser.setContentHandler(new CrawlSettingsSAXHandler(settingsHandler.getSettings(null))); InputSource source = new InputSource(reader); parser.parse(source); HeritrixProfile profile = new HeritrixProfile(settingsHandler, null); return profile; } catch(SAXException ex) { throw new WCTRuntimeException(ex); } catch(ParserConfigurationException pcex) { throw new WCTRuntimeException(pcex); } catch (IOException e) { throw new WCTRuntimeException(e); } catch (InvalidAttributeValueException e) { throw new WCTRuntimeException(e); } } HeritrixProfile(XMLSettingsHandler aSettingsHandler, String aDomain); }
HeritrixProfile { public static HeritrixProfile fromString(String str) { try { XMLReader parser = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); StringReader reader = new StringReader(str); XMLSettingsHandler settingsHandler = new XMLSettingsHandler(new File("dummy_file")); parser.setContentHandler(new CrawlSettingsSAXHandler(settingsHandler.getSettings(null))); InputSource source = new InputSource(reader); parser.parse(source); HeritrixProfile profile = new HeritrixProfile(settingsHandler, null); return profile; } catch(SAXException ex) { throw new WCTRuntimeException(ex); } catch(ParserConfigurationException pcex) { throw new WCTRuntimeException(pcex); } catch (IOException e) { throw new WCTRuntimeException(e); } catch (InvalidAttributeValueException e) { throw new WCTRuntimeException(e); } } HeritrixProfile(XMLSettingsHandler aSettingsHandler, String aDomain); boolean elementExists(String anAbsoluteName); ProfileElement getElement(String anAbsoluteName); boolean moveMapElementUp(String complexElementName, String simpleElementName); boolean moveMapElementDown(String complexElementName, String simpleElementName); void removeMapElement(String complexElementName, String simpleElementName); void clearMap(String complexElementName); void setToeThreads(int toeThreadCount); void removeFromMapByType(String complexElementName, String type); void addSimpleMapElement(String complexElementName, String key, String value); void addMapElement(String complexElementName, SimpleType child); void addMapElement(String complexElementName, String newElemName, String newElemType); @SuppressWarnings("unchecked") static List<String> getOptionsForType(Class type); void setAllSimpleTypes(HttpServletRequest request, ComplexProfileElement element); void setListType(String elementName, List values); void setListType(ListType aListType, List values); void setAllSimpleTypes(HttpServletRequest request, SimpleProfileElement element); void setSimpleType(String elementPath, Object value); void setScopeClass(String scopeClass); String toString(); static HeritrixProfile create(); static HeritrixProfile create(File f); static HeritrixProfile fromString(String str); }
HeritrixProfile { public static HeritrixProfile fromString(String str) { try { XMLReader parser = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); StringReader reader = new StringReader(str); XMLSettingsHandler settingsHandler = new XMLSettingsHandler(new File("dummy_file")); parser.setContentHandler(new CrawlSettingsSAXHandler(settingsHandler.getSettings(null))); InputSource source = new InputSource(reader); parser.parse(source); HeritrixProfile profile = new HeritrixProfile(settingsHandler, null); return profile; } catch(SAXException ex) { throw new WCTRuntimeException(ex); } catch(ParserConfigurationException pcex) { throw new WCTRuntimeException(pcex); } catch (IOException e) { throw new WCTRuntimeException(e); } catch (InvalidAttributeValueException e) { throw new WCTRuntimeException(e); } } HeritrixProfile(XMLSettingsHandler aSettingsHandler, String aDomain); boolean elementExists(String anAbsoluteName); ProfileElement getElement(String anAbsoluteName); boolean moveMapElementUp(String complexElementName, String simpleElementName); boolean moveMapElementDown(String complexElementName, String simpleElementName); void removeMapElement(String complexElementName, String simpleElementName); void clearMap(String complexElementName); void setToeThreads(int toeThreadCount); void removeFromMapByType(String complexElementName, String type); void addSimpleMapElement(String complexElementName, String key, String value); void addMapElement(String complexElementName, SimpleType child); void addMapElement(String complexElementName, String newElemName, String newElemType); @SuppressWarnings("unchecked") static List<String> getOptionsForType(Class type); void setAllSimpleTypes(HttpServletRequest request, ComplexProfileElement element); void setListType(String elementName, List values); void setListType(ListType aListType, List values); void setAllSimpleTypes(HttpServletRequest request, SimpleProfileElement element); void setSimpleType(String elementPath, Object value); void setScopeClass(String scopeClass); String toString(); static HeritrixProfile create(); static HeritrixProfile create(File f); static HeritrixProfile fromString(String str);  }