Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.Dom


    }

    //returns null if successful or the Response which contains the error msg.
    protected Response deleteRemovedProperties(Map<String,String> newProps) {
        List<String> existingList = new ArrayList();
        Dom parent = getEntity();
        for (Dom existingProp : parent.nodeElements(TAG_SYSTEM_PROPERTY)) {
            existingList.add(existingProp.attribute("name"));
        }
        //no existing properites,return null
        if (existingList.isEmpty()){
            return null;
View Full Code Here


        String addr = nl.getAddress();
        if (addr != null && !addr.equals("0.0.0.0")) {
            return addr;
        }

        Dom serverDom = Dom.unwrap(server);
        Domain domain = serverDom.getHabitat().getComponent(Domain.class);
        Nodes nodes = serverDom.getHabitat().getComponent(Nodes.class);
        ServerEnvironment env =
                serverDom.getHabitat().getComponent(ServerEnvironment.class);

        if (server.isDas()) {
            if (env.isDas()) {
                // We are the DAS. Return our hostname
                return System.getProperty(
View Full Code Here

    private static String translatePort(NetworkListener adminListener, Server server, Config config) {
        NetworkListener adminListenerRaw = null;

        try {
            Dom serverDom = Dom.unwrap(server);
            Domain domain = serverDom.getHabitat().getComponent(Domain.class);

            adminListenerRaw = GlassFishConfigBean.getRawView(adminListener);
            String portString = adminListenerRaw.getPort();

            if (!isToken(portString))
View Full Code Here

        public static Node getDefaultLocalNode(Nodes nodes) {
            if (nodes == null) {
                return null;
            }
            Dom serverDom = Dom.unwrap(nodes);
            Domain domain = serverDom.getHabitat().getComponent(Domain.class);
            for (Node node : nodes.getNode()) {
                if (node.getName().equals("localhost-"+domain.getName())) {
                    return node;
                }
            }
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

        }
        String retVal = "Code Generation done at : " + outputDir;

        try {
            Domain entity = habitat.getService(Domain.class);
            Dom dom = Dom.unwrap(entity);
            DomDocument document = dom.document;
            ConfigModel rootModel = dom.document.getRoot().model;

            ResourcesGenerator resourcesGenerator = new TextResourcesGenerator(outputDir, habitat);
            resourcesGenerator.generateSingle(rootModel, document);
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);
                    Nodes nodes = domain.getNodes();

                    for (Node node : nodes.getNode()) {
                        //make it Unix style and remove trailing slash
                        iDir = removeTrailingSlash(iDir.replaceAll("\\\\", "/"));
View Full Code Here

    @Override
    public boolean isValid(ConfigBeanProxy config, ConstraintValidatorContext cvc) throws UnexpectedTypeException {
        if (config == null) {
            return true;
        }
        Dom dom = Dom.unwrap(config);
        if (rc.skipDuringCreation() && dom.getKey() == null) {
            return true; //During creation the coresponding DOM is not fully loaded.
        }
        Collection<RemoteKeyInfo> remoteKeys = findRemoteKeys(config);
        if (remoteKeys != null && !remoteKeys.isEmpty()) {
            ServiceLocator habitat = dom.getHabitat();
            boolean result = true;
            boolean disableGlobalMessage = true;
            for (RemoteKeyInfo remoteKeyInfo : remoteKeys) {
                if (remoteKeyInfo.method.getParameterTypes().length > 0) {
                    throw new UnexpectedTypeException(localStrings.getLocalString("referenceValidator.not.getter",
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

    }

    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

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.