Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.Element


        Map<String, String> links = new TreeMap<String, String>();

        for (String elementName : dom.model.getElementNames()) { //for each element
            if (elementName.equals("*")) {
                ConfigModel.Node node = (ConfigModel.Node) dom.model.getElement(elementName);
                ConfigModel childModel = node.getModel();
                List<ConfigModel> lcm = getRealChildConfigModels(childModel, dom.document);

                Collections.sort(lcm, new ConfigModelComparator());
                if (lcm != null) {
                    for (ConfigModel cmodel : lcm) {
View Full Code Here


            childID = id;
        }
        if (parentList != null) { // Believe it or not, this can happen
            for (Dom c : parentList) {
                String keyAttributeName = null;
                ConfigModel model = c.model;
                if (model.key == null) {
                    try {
                        for (String s : model.getAttributeNames()) {//no key, by default use the name attr
                            if (s.equals("name")) {
                                keyAttributeName = s;
                            }
                        }
                        if (keyAttributeName == null) {//nothing, so pick the first one
                            keyAttributeName = model.getAttributeNames().iterator().next();
                        }
                    } catch (Exception e) {
                        keyAttributeName = "ThisIsAModelBug:NoKeyAttr"; //no attr choice fo a key!!! Error!!!
                    } //firstone
                } else {
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

    /**
     * @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

    private void initialize() throws Exception {
        //System.getProperties().put("com.sun.grizzly.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
        theDomain = domain;
        theMonitoringRegistry = monitoringRegistry;
        ConfigSupport cs =
                RestService.habitat.getComponent(ConfigSupport.class);
        configSupport = cs;
    }
View Full Code Here


        //        DomDocument dodo = RestService.getHabitat().getComponent(DomDocument.class);
        //        Dom root = dodo.getRoot();
        // System.out.println(" root "+ root );
        Dom dom1 = Dom.unwrap(entity);
        Dom root = dom1.document.getRoot();
        document = dom1.document;

        ConfigModel rootModel = root.model;

View Full Code Here

        String addr = translateAddressAndPort(getAdminListener(config), server, config)[0];
        if (addr != null && !addr.equals("0.0.0.0")) {
            return addr;
        }

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

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

        IndentingXMLStreamWriter indentingXMLStreamWriter = null;
        String s = null;
        try {
            writer = xmlFactory.createXMLStreamWriter(new BufferedOutputStream(bos));
            indentingXMLStreamWriter = new IndentingXMLStreamWriter(writer);
            Dom configBeanDom = Dom.unwrap(configBean);
            configBeanDom.writeTo(configBeanDom.model.getTagName(), indentingXMLStreamWriter);
            indentingXMLStreamWriter.flush();
            s = bos.toString();
        } catch (XMLStreamException e) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.log(Level.FINE, "Cannot serialize the configbean: " + configBean.toString(), e);
View Full Code Here

        String[] ret = new String[2];
            String portString = null;
            String addressString = null;

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

            adminListenerRaw = GlassFishConfigBean.getRawView(adminListener);
            portString = adminListenerRaw.getPort();
            addressString = adminListenerRaw.getAddress();
            PropertyResolver resolver = new PropertyResolver(domain, server.getName());
View Full Code Here

        public static Node getDefaultLocalNode(Nodes nodes) {
            if (nodes == null) {
                return null;
            }
            Dom serverDom = Dom.unwrap(nodes);
            Domain domain = serverDom.getHabitat().getService(Domain.class);
            for (Node node : nodes.getNode()) {
                if (node.getName().equals("localhost-"+domain.getName())) {
                    return node;
                }
            }
View Full Code Here

TOP

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

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.