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); } } }
@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; } }
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); } } }
final Virtualizations defaultConfig = document.getRoot().createProxy(Virtualizations.class); ConfigSupport.apply(new SingleConfigCode<Virtualizations>() { @Override
ConsoleConfig config = (ConsoleConfig) doc.getRoot().get();
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);
ConsoleConfig config = (ConsoleConfig) doc.getRoot().get();
/** */ @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; } }
URL domainURL = domainXMLFile.toURI().toURL(); DomDocument doc = parser.parse(domainURL); Dom domDomain = doc.getRoot(); Domain d = domDomain.createProxy(Domain.class); return d;
URL domainURL = domainXMLFile.toURI().toURL(); DomDocument doc = parser.parse(domainURL); Dom domDomain = doc.getRoot(); Domain d = domDomain.createProxy(Domain.class); return d;
TOC toc = (TOC) doc.getRoot().get(); for (TOCItem item : toc.getTOCItems()) { insertTOCItem(mergedTOC.getTOCItems(), item, id + prefix);
TOC toc = (TOC) doc.getRoot().get(); for (TOCItem item : toc.getTOCItems()) { insertTOCItem(mergedTOC.getTOCItems(), item, id + prefix);
Index index = (Index) doc.getRoot().get(); for (IndexItem item : index.getIndexItems()) { insertIndexItem(mergedIndex.getIndexItems(), item, id + prefix);
Index index = (Index) doc.getRoot().get(); for (IndexItem item : index.getIndexItems()) { insertIndexItem(mergedIndex.getIndexItems(), item, id + prefix);
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; }
try { Class configBeanClass = configModularityUtils.getClassForFullName(configBeanDefaultValue.getConfigBeanClassName()); final ConfigBeanProxy pr = doc.getRoot().createProxy(configBeanClass); configModularityUtils.setIgnorePersisting(true); ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() {