Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.Dom


    }

    private void generateASM(ServiceLocator habitat) {
        try {
            Domain entity = habitat.getService(Domain.class);
            Dom dom = Dom.unwrap(entity);

            ResourcesGenerator resourcesGenerator = new ASMResourcesGenerator(habitat);
            resourcesGenerator.generateSingle(dom.document.getRoot().model, dom.document);
            resourcesGenerator.endGeneration();
        } catch (Exception ex) {
View Full Code Here


    }

    private void generateASM(ServiceLocator habitat) {
        try {
            Domain entity = habitat.getService(Domain.class);
            Dom dom = Dom.unwrap(entity);

            ResourcesGenerator resourcesGenerator = new ASMResourcesGenerator(habitat);
            resourcesGenerator.generateSingle(dom.document.getRoot().model, dom.document);
            resourcesGenerator.endGeneration();
        } catch (Exception ex) {
View Full Code Here

     * as we recurse up to the top of the Dom tree to finish building the path desired.
     * @param node
     * @return
     */
    private String buildPath (Dom node) {
        final Dom parentNode = node.parent();
        String part = node.model.getTagName();
        String name = node.attribute("name");
        if (name != null) {
            part = name;
        }
View Full Code Here

        }
        target.setGadgetUserPref(v2);
    }

    public void element_setGadgetModulePrefs(Dom dom, GadgetModule target) {
        Dom v1 = dom.nodeElement("ModulePrefs");
        if (v1 == null) {
            return ;
        }
        target.setGadgetModulePrefs(((GadgetModulePrefs) v1 .get()));
    }
View Full Code Here

            Habitat habitat = serviceLocator.getService(Habitat.class);

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

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

    }

    private void generateASM(ServiceLocator habitat) {
        try {
            Domain entity = habitat.getService(Domain.class);
            Dom dom = Dom.unwrap(entity);

            ResourcesGenerator resourcesGenerator = new ASMResourcesGenerator(habitat);
            resourcesGenerator.generateSingle(dom.document.getRoot().model, dom.document);
            resourcesGenerator.endGeneration();
        } catch (Exception ex) {
View Full Code Here

    /**
     * Utility methods used both from AccessCheck and from CommandSecurityChecker.
     */
    public static class Util {
        public static String resourceNameFromDom(Dom d) {
            Dom lastDom = null;
            final StringBuilder path = new StringBuilder();
            while (d != null) {
                if (path.length() > 0) {
                    path.insert(0, '/');
                }
                final ConfigModel m = d.model;
                lastDom = d;
                final String key = d.getKey();
                final String pathSegment = m.getTagName() + (key == null ? "" : "/" + key);
                path.insert(0, pathSegment);
                d = d.parent();
            }
            if (lastDom != null) {
                if (lastDom.getKey() != null) {
                    path.insert(0, pluralize(lastDom.model.getTagName()) + '/');
                }
            }
            return path.toString();
        }
View Full Code Here

    /** return true if the candidate is a descendent of the parent */
    private boolean isDescendent(final ConfigBean candidate, final ConfigBean parent)
    {
        boolean isParent = false;
        Dom temp = candidate.parent();
        while (temp != null)
        {
            if (temp == parent)
            {
                isParent = true;
                break;
            }
            temp = temp.parent();
        }

        return isParent;
    }
View Full Code Here

        return messages;
    }

    public void generateClasses() {
        Domain entity = getBaseServiceLocator().getService(Domain.class);
        Dom dom = Dom.unwrap(entity);
        document = dom.document;
        ConfigModel rootModel = dom.document.getRoot().model;
        alreadyGenerated.clear();

        generateSingle(rootModel);
View Full Code Here

TOP

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

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.