Examples of DomDocument


Examples of org.jvnet.hk2.config.DomDocument

          + provider.getClass().getName() + "'");
        }
        continue;
    }
//System.out.println("Provider *"+provider+"* : url=*"+url+"*");
    DomDocument doc = parser.parse(url);

    // Get the New IntegrationPoints
    ConsoleConfig config = (ConsoleConfig) doc.getRoot().get();

    // Save the ClassLoader for later
//System.out.println("Storing: " + config.getId() + " : " + provider.getClass().getClassLoader());
    id = config.getId();
    moduleClassLoaderMap.put(id, provider.getClass().getClassLoader());
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

  List<URL> urls = null; // URLs to TOC files w/i each plugin module
  for (Map.Entry<String, List<URL>> entry : mapUrls.entrySet()) {
      id = entry.getKey();
      urls = entry.getValue();
      for (URL url : urls) {
    DomDocument doc = parser.parse(url);

    // Merge all the TOC's...
    TOC toc = (TOC) doc.getRoot().get();
    for (TOCItem item : toc.getTOCItems()) {
        insertTOCItem(mergedTOC.getTOCItems(), item, id + prefix);
    }
      }
  }
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

  List<URL> urls = null; // URLs to TOC files w/i each plugin module
  for (Map.Entry<String, List<URL>> entry : mapUrls.entrySet()) {
      id = entry.getKey();
      urls = entry.getValue();
      for (URL url : urls) {
    DomDocument doc = parser.parse(url);

    // Merge all the TOC's...
    Index index = (Index) doc.getRoot().get();
    for (IndexItem item : index.getIndexItems()) {
        insertIndexItem(mergedIndex.getIndexItems(), item, id + prefix);
    }
      }
  }
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

     */
    public <T extends ConfigBeanProxy> void parseAndSetConfigBean(List<ConfigBeanDefaultValue> values) {

        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) {
                return new GlassFishConfigBean(serviceLocator, this, dom, configModel, xmlStreamReader);
            }
        };

        //TODO requires rework to put all the changes that a service may introduce into one transaction
        //the solution is to put the loop into the apply method...  But it would be some fine amount of work
        for (final ConfigBeanDefaultValue configBeanDefaultValue : values) {
            final ConfigBeanProxy parent = configModularityUtils.getOwningObject(configBeanDefaultValue.getLocation());
            if(parent==null) continue;
            ConfigurationPopulator populator = null;
            if (replaceSystemProperties)
                try {
                    populator = new ConfigurationPopulator(
                            configModularityUtils.replacePropertiesWithCurrentValue(
                                    configBeanDefaultValue.getXmlConfiguration(), configBeanDefaultValue)
                            , doc, parent);
                } catch (Exception e) {
                    LocalStringManager localStrings =
                            new LocalStringManagerImpl(ConfigurationParser.class);
                    final String msg = localStrings.getLocalString(
                            "can.not.add.configuration.to.extension.point",
                            "Cannot add new configuration extension to the extension point.");
                    LOG.log(Level.SEVERE, msg, e);
                }
            else {
                //Check that parent is not null!
                populator = new ConfigurationPopulator(configBeanDefaultValue.getXmlConfiguration(), doc, parent);
            }
            populator.run(configParser);
            try {
                Class configBeanClass = configModularityUtils.getClassForFullName(configBeanDefaultValue.getConfigBeanClassName());
                final ConfigBeanProxy pr = doc.getRoot().createProxy(configBeanClass);
                ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() {
                    public Object run(ConfigBeanProxy param) throws PropertyVetoException, TransactionFailure {
                        boolean writeDefaultElementsToXml = Boolean.parseBoolean(System.getProperty("writeDefaultElementsToXml", "true"));
                        if (!writeDefaultElementsToXml) {
                            //Do not write default snippets to domain.xml
                            doc.getRoot().skipFromXml();
                        }
                        configModularityUtils.setConfigBean(pr, configBeanDefaultValue, param);
                        return param;
                    }
                }, parent);
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

        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;
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

        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;
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

        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 d = domDomain.createProxy(Domain.class);
            return d;
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

     */
    public <T extends ConfigBeanProxy> void parseAndSetConfigBean(List<ConfigBeanDefaultValue> values) {

        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) {
                return new GlassFishConfigBean(serviceLocator, this, dom, configModel, xmlStreamReader);
            }
        };

        //TODO requires rework to put all the changes that a service may introduce into one transaction
        //the solution is to put the loop into the apply method...  But it would be some fine amount of work
        for (final ConfigBeanDefaultValue configBeanDefaultValue : values) {
            final ConfigBeanProxy parent = configModularityUtils.getOwningObject(configBeanDefaultValue.getLocation());
            if(parent==null) continue;
            ConfigurationPopulator populator = null;
            if (replaceSystemProperties)
                try {
                    populator = new ConfigurationPopulator(
                            configModularityUtils.replacePropertiesWithCurrentValue(
                                    configBeanDefaultValue.getXmlConfiguration(), configBeanDefaultValue)
                            , doc, parent);
                } catch (Exception e) {
                    LocalStringManager localStrings =
                            new LocalStringManagerImpl(ConfigurationParser.class);
                    final String msg = localStrings.getLocalString(
                            "can.not.add.configuration.to.extension.point",
                            "Cannot add new configuration extension to the extension point.");
                    LOG.log(Level.SEVERE, msg, e);
                }
            else {
                //Check that parent is not null!
                populator = new ConfigurationPopulator(configBeanDefaultValue.getXmlConfiguration(), doc, parent);
            }
            populator.run(configParser);
            try {
                Class configBeanClass = configModularityUtils.getClassForFullName(configBeanDefaultValue.getConfigBeanClassName());
                final ConfigBeanProxy pr = doc.getRoot().createProxy(configBeanClass);
                ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() {
                    public Object run(ConfigBeanProxy param) throws PropertyVetoException, TransactionFailure {
                        boolean writeDefaultElementsToXml = Boolean.parseBoolean(System.getProperty("writeDefaultElementsToXml", "true"));
                        if (!writeDefaultElementsToXml) {
                            //Do not write default snippets to domain.xml
                            doc.getRoot().skipFromXml();
                        }
                        configModularityUtils.setConfigBean(pr, configBeanDefaultValue, param);
                        return param;
                    }
                }, parent);
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

        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;
View Full Code Here

Examples of org.jvnet.hk2.config.DomDocument

    private void generateASM(Habitat habitat) {
        try {
            Domain entity = habitat.getComponent(Domain.class);
            Dom dom = Dom.unwrap(entity);
            DomDocument document = dom.document;
            ConfigModel rootModel = dom.document.getRoot().model;

            ResourcesGenerator resourcesGenerator = new ASMResourcesGenerator(habitat);
            resourcesGenerator.generateSingle(rootModel, document);
            resourcesGenerator.endGeneration();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.