Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.ConfigParser


  if (url == null) {
      return null;
  }
// FIXME: Cache?
  // Get our parser...
  ConfigParser parser = new ConfigParser(GuiUtil.getHabitat());
  String id = null;

  // Read the document...
  DomDocument doc = parser.parse(url);

  // Get the GadgetModule
  GadgetModule module = (GadgetModule) doc.getRoot().get();

  return module;
View Full Code Here


  initialized = true;

  // First find the parser
  if ((providers != null) && (providers.iterator().hasNext())) {
      // Get our parser...
      ConfigParser parser = new ConfigParser(habitat);
      URL url = null;
      String id = null;

      // Loop through the configs and add them all
      for (ConsoleProvider provider : providers) {
    // Read the contents from the URL
    url = provider.getConfiguration();
    if (url == null) {
        url = provider.getClass().getClassLoader().getResource(
      ConsoleProvider.DEFAULT_CONFIG_FILENAME);
    }
    if (url == null) {
        if (logger.isLoggable(Level.INFO)) {
      logger.info("Unable to find "
          + ConsoleProvider.DEFAULT_CONFIG_FILENAME
          + " file for provider '"
          + 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
View Full Code Here

  // TOC
  Map<String, List<URL>> mapUrls = getResources(locale + "/help/toc.xml");

  // Get our parser...
  ConfigParser parser = new ConfigParser(habitat);

  // Setup a new "merged" TOC...
  mergedTOC = new TOC();
  mergedTOC.setTOCItems(new ArrayList<TOCItem>());
  mergedTOC.setVersion("2.0");

  // Loop through the urls and add them all
  String id = null; // module id
  String prefix = "/" + locale + "/help/"// prefix (minus module id)
  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

  // TOC
  Map<String, List<URL>> mapUrls = getResources(locale + "/help/index.xml");

  // Get our parser...
  ConfigParser parser = new ConfigParser(habitat);

  // Setup a new "merged" TOC...
  mergedIndex = new Index();
  mergedIndex.setIndexItems(new ArrayList<IndexItem>());
  mergedIndex.setVersion("2.0");

  // Loop through the urls and add them all
  String id = null; // module id
  String prefix = "/" + locale + "/help/"// prefix (minus module id)
  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

    /**
     * @param <T> the ConfigBeanProxy type we are looking for
     */
    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);
View Full Code Here

        //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) {
View Full Code Here

        //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) {
View Full Code Here

            return null;
        }

        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

    /**
     * @param <T> the ConfigBeanProxy type we are looking for
     */
    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);
View Full Code Here

        //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) {
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.config.ConfigParser

Copyright © 2018 www.massapicom. 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.