InputStream in = InstallerFrame.class.getResourceAsStream("/rules");
ObjectInputStream objIn = new ObjectInputStream(in);
Map rules = (Map) objIn.readObject();
if ((rules != null) && (rules.size() != 0))
{
this.rules = new RulesEngine(rules, installdata);
}
objIn.close();
}
catch (Exception e)
{
Debug.trace("Can not find optional rules");
}
if (rules != null)
{
// rules already read
return;
}
try
{
InputStream input = null;
input = this.getResource(CONDITIONS_SPECRESOURCENAME);
if (input == null)
{
this.rules = new RulesEngine((XMLElement) null, installdata);
return;
}
StdXMLParser parser = new StdXMLParser();
parser.setBuilder(XMLBuilderFactory.createXMLBuilder());
parser.setValidator(new NonValidator());
parser.setReader(new StdXMLReader(input));
// get the data
XMLElement conditionsxml = (XMLElement) parser.parse();
this.rules = new RulesEngine(conditionsxml, installdata);
}
catch (Exception e)
{
Debug.trace("Can not find optional resource " + CONDITIONS_SPECRESOURCENAME);
// there seem to be no conditions
this.rules = new RulesEngine((XMLElement) null, installdata);
}
}