public <T extends Container> T parseContainerConfig(Habitat habitat, final URL configuration, Class<T> configType) throws IOException {
org.jvnet.hk2.config.ConfigParser configParser = new org.jvnet.hk2.config.ConfigParser(habitat);
// I don't use the GlassFish document here as I don't need persistence
final DomDocument doc = new DomDocument<GlassFishConfigBean>(habitat) {
public Dom make(final Habitat habitat, XMLStreamReader xmlStreamReader, GlassFishConfigBean dom, ConfigModel configModel) {
// by default, people get the translated view.
return new GlassFishConfigBean(habitat,this, dom, configModel, xmlStreamReader);
}
};
(new Populator() {
public void run(org.jvnet.hk2.config.ConfigParser parser) {
long now = System.currentTimeMillis();
if (configuration != null) {
try {
DomDocument newElement = parser.parse(configuration, doc, Dom.unwrap(config));
logger.info(newElement.getRoot().getProxyType().toString());
} catch(Exception e) {
e.printStackTrace();
}
Logger.getAnonymousLogger().fine("time to parse domain.xml : " + String.valueOf(System.currentTimeMillis() - now));
}