本文整理了Java中org.jvnet.hk2.config.DomDocument.getRoot()
方法的一些代码示例,展示了DomDocument.getRoot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DomDocument.getRoot()
方法的具体详情如下:
包路径:org.jvnet.hk2.config.DomDocument
类名称:DomDocument
方法名:getRoot
暂无
代码示例来源:origin: org.glassfish.admin/config-api
public void transactionCommited(List<PropertyChangeEvent> changes) {
for (ConfigurationPersistence pers : habitat.getAllByContract(ConfigurationPersistence.class)) {
try {
if (doc.getRoot().getProxyType().equals(Domain.class)) {
Dom domainRoot = doc.getRoot();
domainRoot.attribute("version", Version.getBuildVersion());
}
pers.save(doc);
} catch (IOException e) {
logger.log(Level.SEVERE, "GlassFishDocument.IOException",
new String[] { e.getMessage() });
logger.log(Level.FINE, e.getMessage(), e);
} catch (XMLStreamException e) {
logger.log(Level.SEVERE, "GlassFishDocument.XMLException",
new String[] { e.getMessage() });
logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}
代码示例来源:origin: org.glassfish.main.core/kernel
@Override
public <T extends Container> T parseContainerConfig(ServiceLocator habitat, final URL configuration, Class<T> configType) throws IOException {
// I don't use the GlassFish document here as I don't need persistence
final DomDocument doc = new DomDocument<GlassFishConfigBean>(habitat) {
@Override
public Dom make(final ServiceLocator habitat, XMLStreamReader xmlStreamReader, GlassFishConfigBean dom, ConfigModel configModel) {
// by default, people get the translated view.
return new GlassFishConfigBean(habitat,this, dom, configModel, xmlStreamReader);
}
};
// add the new container configuration to the server config
final T container = doc.getRoot().createProxy(configType);
try {
ConfigSupport.apply(new SingleConfigCode<Config>() {
@Override
public Object run(Config config) throws PropertyVetoException, TransactionFailure {
config.getContainers().add(container);
return null;
}
}, config);
} catch(TransactionFailure e) {
logger.log(Level.SEVERE, KernelLoggerInfo.exceptionAddContainer, e);
}
return container;
}
}
代码示例来源:origin: org.glassfish.main.admin/config-api
public void transactionCommited(List<PropertyChangeEvent> changes) {
if (!isGlassFishDocumentChanged(changes)) {
return;
}
for (ConfigurationPersistence pers : habitat.<ConfigurationPersistence>getAllServices(ConfigurationPersistence.class)) {
try {
if (doc.getRoot().getProxyType().equals(Domain.class)) {
Dom domainRoot = doc.getRoot();
domainRoot.attribute("version", Version.getBuildVersion());
}
pers.save(doc);
} catch (IOException e) {
logger.log(Level.SEVERE,
ConfigApiLoggerInfo.glassFishDocumentIOException,e);
} catch (XMLStreamException e) {
logger.log(Level.SEVERE,
ConfigApiLoggerInfo.glassFishDocumentXmlException,e);
}
}
}
代码示例来源:origin: org.glassfish.main.virtualization/virt-core
final Virtualizations defaultConfig = document.getRoot().createProxy(Virtualizations.class);
ConfigSupport.apply(new SingleConfigCode<Virtualizations>() {
@Override
代码示例来源:origin: eclipse-ee4j/glassfish
ConsoleConfig config = (ConsoleConfig) doc.getRoot().get();
代码示例来源:origin: org.glassfish.main.admin/server-mgmt
URL domainURL = domainXMLFile.toURI().toURL();
DomDocument doc = parser.parse(domainURL);
Dom domDomain = doc.getRoot();
Domain domain = domDomain.createProxy(Domain.class);
DomainXmlVerifier validator = new DomainXmlVerifier(domain);
代码示例来源:origin: org.glassfish.main.admingui/console-plugin-service
ConsoleConfig config = (ConsoleConfig) doc.getRoot().get();
代码示例来源:origin: org.glassfish.admin/cli-optional
/**
*/
@Override
protected int executeCommand()
throws CommandException, CommandValidationException {
File domainXMLFile = getDomainXml();
logger.finer("Domain XML file = " + domainXMLFile);
try {
Habitat habitat = Globals.getStaticHabitat();
ConfigParser parser = new ConfigParser(habitat);
URL domainURL = domainXMLFile.toURI().toURL();
DomDocument doc = parser.parse(domainURL);
Dom domDomain = doc.getRoot();
Domain domain = domDomain.createProxy(Domain.class);
DomainXmlVerifier validator = new DomainXmlVerifier(domain);
if (validator.invokeConfigValidator()) return 1;
} catch (Exception e) {
throw new CommandException(e.getMessage());
}
return 0;
}
}
代码示例来源:origin: org.glassfish.main.admin/admin-util
URL domainURL = domainXMLFile.toURI().toURL();
DomDocument doc = parser.parse(domainURL);
Dom domDomain = doc.getRoot();
Domain d = domDomain.createProxy(Domain.class);
return d;
代码示例来源:origin: org.glassfish.admin/admin-util
URL domainURL = domainXMLFile.toURI().toURL();
DomDocument doc = parser.parse(domainURL);
Dom domDomain = doc.getRoot();
Domain d = domDomain.createProxy(Domain.class);
return d;
代码示例来源:origin: org.glassfish.main.admingui/console-plugin-service
TOC toc = (TOC) doc.getRoot().get();
for (TOCItem item : toc.getTOCItems()) {
insertTOCItem(mergedTOC.getTOCItems(), item, id + prefix);
代码示例来源:origin: eclipse-ee4j/glassfish
TOC toc = (TOC) doc.getRoot().get();
for (TOCItem item : toc.getTOCItems()) {
insertTOCItem(mergedTOC.getTOCItems(), item, id + prefix);
代码示例来源:origin: org.glassfish.main.admingui/console-plugin-service
Index index = (Index) doc.getRoot().get();
for (IndexItem item : index.getIndexItems()) {
insertIndexItem(mergedIndex.getIndexItems(), item, id + prefix);
代码示例来源:origin: eclipse-ee4j/glassfish
Index index = (Index) doc.getRoot().get();
for (IndexItem item : index.getIndexItems()) {
insertIndexItem(mergedIndex.getIndexItems(), item, id + prefix);
代码示例来源:origin: org.glassfish.main.admin/config-api
public <T extends ConfigBeanProxy> T getCurrentConfigBeanForDefaultValue(ConfigBeanDefaultValue defaultValue)
throws InvocationTargetException, IllegalAccessException {
//TODO make this method target aware!
Class parentClass = getOwningClassForLocation(defaultValue.getLocation());
Class configBeanClass = getClassForFullName(defaultValue.getConfigBeanClassName());
Method m = findSuitableCollectionGetter(parentClass, configBeanClass);
if (m != null) {
ConfigParser configParser = new ConfigParser(serviceLocator);
// I don't use the GlassFish document here as I don't need persistence
final DomDocument doc = new DomDocument<GlassFishConfigBean>(serviceLocator) {
@Override
public Dom make(final ServiceLocator serviceLocator, XMLStreamReader xmlStreamReader, GlassFishConfigBean dom,
ConfigModel configModel) {
// by default, people get the translated view.
return new GlassFishConfigBean(serviceLocator, this, dom, configModel, xmlStreamReader);
}
};
ConfigBeanProxy parent = getOwningObject(defaultValue.getLocation());
ConfigurationPopulator populator = new ConfigurationPopulator(defaultValue.getXmlConfiguration(), doc, parent);
populator.run(configParser);
ConfigBeanProxy configBean = doc.getRoot().createProxy(configBeanClass);
Collection col = (Collection) m.invoke(parent);
return (T) getConfigBeanFromCollection(col, configBean, configBeanClass);
}
return null;
}
代码示例来源:origin: org.glassfish.main.admin/config-api
try {
Class configBeanClass = configModularityUtils.getClassForFullName(configBeanDefaultValue.getConfigBeanClassName());
final ConfigBeanProxy pr = doc.getRoot().createProxy(configBeanClass);
configModularityUtils.setIgnorePersisting(true);
ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() {
内容来源于网络,如有侵权,请联系作者删除!