Created
April 24, 2017 18:32
-
-
Save bshambaugh/24f14f7928e48e2af7d5fa5172f9783c to your computer and use it in GitHub Desktop.
Trying to parse an xml file for PowerAqua createsesame2repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package poweraqua.indexingService.creator; | |
import java.io.IOException; | |
import java.io.PrintStream; | |
import java.util.ArrayList; | |
import org.apache.xerces.parsers.DOMParser; | |
import org.w3c.dom.DOMException; | |
import org.w3c.dom.Document; | |
import org.w3c.dom.Element; | |
import org.w3c.dom.Node; | |
import org.w3c.dom.NodeList; | |
import org.xml.sax.SAXException; | |
public class MultiIndexServiceConfiguration | |
{ | |
private static final String MULTI_INDEX_CONFIGURATION_FILE = "multi_index_properties.xml"; | |
private String db; | |
private String login; | |
private String password; | |
private String index_global_path; | |
private boolean watson = false; | |
private boolean virtuoso = false; | |
private boolean powermap = true; | |
private boolean remoteSPARQLVirtuoso = false; | |
private ArrayList<MultiOntologyIndexBean> indexList; | |
public MultiIndexServiceConfiguration() | |
{ | |
readConfigurationFile("multi_index_properties.xml"); | |
} | |
public MultiIndexServiceConfiguration(String realPath) | |
{ | |
readConfigurationFile(realPath + "multi_index_properties.xml"); | |
} | |
private void readConfigurationFile(String path) | |
{ | |
DOMParser parser = new DOMParser(); | |
try | |
{ | |
parser.parse(path); | |
} | |
catch (SAXException ex) | |
{ | |
ex.printStackTrace(); | |
} | |
catch (IOException ex) | |
{ | |
ex.printStackTrace(); | |
} | |
Document doc = parser.getDocument(); | |
Element configuration = doc.getDocumentElement(); | |
list = configuration.getElementsByTagName("ONTOLOGY_INDEX_DB_PASSWORD"); | |
setPassword(list.item(0).getFirstChild() != null ? list.item(0).getFirstChild().getNodeValue() : new String()); | |
} | |
public ArrayList<MultiOntologyIndexBean> getIndexList() | |
{ | |
return this.indexList; | |
} | |
public static void main(String[] args) | |
{ | |
MultiIndexServiceConfiguration isc = new MultiIndexServiceConfiguration(); | |
for (MultiOntologyIndexBean ib : isc.getIndexList()) { | |
System.out.println(ib); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment