Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.ConfigBeanProxy


        }
        return expression;
    }

    public String serializeConfigBeanByType(Class configBeanType) {
        ConfigBeanProxy configBeanProxy = getConfigBeanInstanceFor(configBeanType);
        return serializeConfigBean(configBeanProxy);
    }
View Full Code Here


        return m;
    }

    public boolean deleteConfigurationForConfigBean(ConfigBeanProxy configBean, Collection col, ConfigBeanDefaultValue defaultValue) {
        String name;
        ConfigBeanProxy itemToRemove;
        try {
            Class configBeanClass = getClassForFullName(defaultValue.getConfigBeanClassName());
            name = getNameForConfigBean(configBean, configBeanClass);
            itemToRemove = getNamedConfigBeanFromCollection(col, name, configBeanClass);
            if (itemToRemove != null) {
View Full Code Here

    }

    public String replacePropertiesWithCurrentValue(String xmlConfiguration, ConfigBeanDefaultValue value) throws InvocationTargetException, IllegalAccessException {
        for (ConfigCustomizationToken token : value.getCustomizationTokens()) {
            String toReplace = "${" + token.getKey() + "}";
            ConfigBeanProxy current = getCurrentConfigBeanForDefaultValue(value);
            String propertyValue = getPropertyValue(token, current);
            if (propertyValue != null) {
                xmlConfiguration = xmlConfiguration.replace(toReplace, propertyValue);
            }
        }
View Full Code Here

    }


    public String getPropertyValue(ConfigCustomizationToken token, ConfigBeanProxy finalConfigBean) {
        if (finalConfigBean != null) {
            ConfigBeanProxy parent = finalConfigBean.getParent();
            while (!(parent instanceof SystemPropertyBag)) {
                parent = parent.getParent();
                if (parent == null) return null;
            }
            if (((SystemPropertyBag) parent).getSystemProperty(token.getKey()) != null) {
                return ((SystemPropertyBag) parent).getSystemProperty(token.getKey()).getValue();
            }
View Full Code Here

        Class parentClass = configModularityUtils.getOwningClassForLocation(defaultValue.getLocation());
        final Class configBeanClass = configModularityUtils.getClassForFullName(defaultValue.getConfigBeanClassName());
        final Method m = configModularityUtils.findSuitableCollectionGetter(parentClass, configBeanClass);
        if (m != null) {
            try {
                final ConfigBeanProxy parent = configModularityUtils.getOwningObject(defaultValue.getLocation());
                ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() {
                    @Override
                    public Object run(ConfigBeanProxy param) throws PropertyVetoException,
                            TransactionFailure {
                        List col = null;
                        ConfigBeanProxy configBean = null;
                        try {
                            col = (List) m.invoke(param);
                            if (col != null) {
                                configBean = configModularityUtils.getCurrentConfigBeanForDefaultValue(defaultValue);
                            }
View Full Code Here

    private static <T extends ConfigBeanProxy> boolean removeCustomTokens(final ConfigBeanDefaultValue configBeanDefaultValue, T finalConfigBean, ConfigBeanProxy parent) throws TransactionFailure, PropertyVetoException {
        if (parent instanceof SystemPropertyBag) {
            removeSystemPropertyForTokens(configBeanDefaultValue.getCustomizationTokens(), (SystemPropertyBag) parent);
            return true;
        } else {
            ConfigBeanProxy curParent = finalConfigBean;
            while (!(curParent instanceof SystemPropertyBag)) {
                curParent = curParent.getParent();
            }
            if (configBeanDefaultValue.getCustomizationTokens().size() != 0) {
                final SystemPropertyBag bag = (SystemPropertyBag) curParent;
                final List<ConfigCustomizationToken> tokens = configBeanDefaultValue.getCustomizationTokens();
                removeSystemPropertyForTokens(tokens, bag);
View Full Code Here

    }


    private String getDependentConfigElement(ConfigBeanDefaultValue defaultValue)
            throws InvocationTargetException, IllegalAccessException {
        ConfigBeanProxy configBean = configModularityUtils.getCurrentConfigBeanForDefaultValue(defaultValue);
        if (configBean != null) {
            return configModularityUtils.serializeConfigBean(configBean);
        } else {
            return defaultValue.getXmlConfiguration();
        }
View Full Code Here

                final ConfigBean node,
                final String elementName,
                final String values)
        throws TransactionFailure {

        ConfigBeanProxy readableView = node.getProxy(node.getProxyType());
        ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() {

            /**
             * Runs the following command passing the configuration object. The code will be run
             * within a transaction, returning true will commit the transaction, false will abort
View Full Code Here

    }
   
    private static String resourceNameFromRestEndpoint(Class<? extends ConfigBeanProxy> c,
            final String path,
            final ServiceLocator locator) {
        ConfigBeanProxy b = locator.getService(c);
        String name = (b != null ? AccessRequired.Util.resourceNameFromConfigBeanProxy(b) : "?");
        if (path != null) {
            name += '/' + path;
        }
        return name;
View Full Code Here

        if(serverEnv.isInstance()) {
            return true;
        }

        ConfigBeanProxy proxy = (ConfigBeanProxy)(event.getSource());
        while(proxy != null && !(proxy instanceof Config)) {
            proxy = proxy.getParent();
        }
        if (proxy != null) {
            Config config = (Config)proxy;
            return config.isDas();
        }
View Full Code Here

TOP

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

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.