Package org.jvnet.hk2.config

Examples of org.jvnet.hk2.config.ConfigBean


        for ( final String attrName : attrs.keySet() )
        {
            final Object attrValue = attrs.get(attrName);
            final String xmlName = convertAttributeName(attrName);
           
            final ConfigBean targetCB = (ConfigBean)Dom.unwrap(target);
            final ConfigModel.Property modelProp = targetCB.model.findIgnoreCase( xmlName );
            if ( modelProp == null )
            {
                throw new IllegalArgumentException( "Can't find ConfigModel.Property for attr " + xmlName + " on " + targetCB.getProxyType() );
            }
            //cdebug( "setting attribute \"" + attrName + "\" to \"" + attrValue + "\" on " + type );
            if ( modelProp.isCollection() )
            {
                //cdebug( "HANDLING COLLECTION FOR " + xmlName + " on " + targetCB.getProxyType().getName() );
View Full Code Here


    private final ObjectName remove(final ObjectName childObjectName)
    {
        ObjectName removed = null;
        try
        {
            final ConfigBean childConfigBean = ConfigBeanRegistry.getInstance().getConfigBean(childObjectName);

            try
            {
                //cdebug("REMOVING config of class " + childConfigBean.getProxyType().getName() + " from  parent of type " +
                       //getConfigBean().getProxyType().getName() + ", ObjectName = " + JMXUtil.toString(childObjectName));
View Full Code Here

            {
                throw new IllegalArgumentException();
            }
            final ConfigBeanProxy parent = params[0];

            final ConfigBean source = (ConfigBean) ConfigBean.unwrap(parent);
            final ConfigSupport configSupport = source.getHabitat().getComponent(ConfigSupport.class);

            return _run(parent, configSupport);
        }
View Full Code Here

            final Class<? extends ConfigBeanProxy> childClass  = Dom.unwrap(child).getProxyType();
            final ConfigBeanJMXSupport  parentSpt = ConfigBeanJMXSupportRegistry.getInstance(parentClass);
           
            final ConfigBeanJMXSupport.ElementMethodInfo elementInfo = parentSpt.getElementMethodInfo(childClass);
            //cdebug( "Found: " + elementInfo + " for " + childClass + " on parent class " + parentClass.getName() );
            final ConfigBean parentBean = (ConfigBean)Dom.unwrap(parent.getProxy(parentClass));
            if ( elementInfo != null && Collection.class.isAssignableFrom(elementInfo.method().getReturnType()) )
            {
                // get the Collection and add the child
                final ConfigModel.Property modelProp = parentBean.model.findIgnoreCase( elementInfo.xmlName() );
                final List  list = (List)parent.getter( modelProp, elementInfo.method().getGenericReturnType() );
View Full Code Here

                final ConfigBeanProxy childProxy = parent.allocateProxy(clazz);
                Dom newBean = Dom.unwrap(childProxy);
                newBean.addDefaultChildren();
                addToList( parent, childProxy);
                final ConfigBean child = (ConfigBean)Dom.unwrap(childProxy);
                newChildren.add(child);
                final WriteableView childW = WriteableView.class.cast(Proxy.getInvocationHandler(Proxy.class.cast(childProxy)));
                //cdebug("Created sub-element of type: " + type + ", " + clazz);
               
                final Map<String,Object> childAttrs = replaceNameWithKey( childParams.attrs(), spt);
View Full Code Here

            {
                throw new IllegalArgumentException();
            }
            final ConfigBeanProxy parent = params[0];

            final ConfigBean source = (ConfigBean) ConfigBean.unwrap(parent);
            final ConfigSupport configSupport = source.getHabitat().getComponent(ConfigSupport.class);

            return _run(parent, configSupport);
        }
View Full Code Here

        if (parent == null || props == null)
        {
            throw new IllegalArgumentException();
        }

        final ConfigBean configBean = ConfigBeanRegistry.getInstance().getConfigBean(parent);
        if (configBean == null)
        {
            throw new IllegalArgumentException("" + parent);
        }

        final PropertyBagProxy proxy = configBean.getProxy(PropertyBagProxy.class);
        if (!PropertyBag.class.isAssignableFrom(proxy.getClass()))
        {
            throw new IllegalArgumentException("ConfigBean " + configBean.getProxyType().getName() + " is not a PropertyBag");
        }

        final PropsSetter propsSetter = new PropsSetter(props, clearAll);
        try
        {
View Full Code Here

        if (parent == null || props == null)
        {
            throw new IllegalArgumentException();
        }

        final ConfigBean configBean = ConfigBeanRegistry.getInstance().getConfigBean(parent);
        if (configBean == null)
        {
            throw new IllegalArgumentException("" + parent);
        }

        final SystemPropertyBagProxy proxy = configBean.getProxy(SystemPropertyBagProxy.class);
        if (!SystemPropertyBag.class.isAssignableFrom(proxy.getClass()))
        {
            throw new IllegalArgumentException("ConfigBean " + configBean.getProxyType().getName() + " is not a SystemPropertyBag");
        }

        final SystemPropsSetter propsSetter = new SystemPropsSetter(props, clearAll);
        try
        {
View Full Code Here

        final DeployCommandParameters deployParams = context.getCommandParameters(DeployCommandParameters.class);
        Transaction t = new Transaction();

        try {
            // prepare the application element
            ConfigBean newBean = ((ConfigBean)ConfigBean.unwrap(applications)).allocate(Application.class);
            Application app = newBean.createProxy();
            Application app_w = t.enroll(app);
            setInitialAppAttributes(app_w, deployParams, appProps, context);
            context.addTransientAppMetaData(Application.APPLICATION, app_w);
        } catch(TransactionFailure e) {
            t.rollback();
View Full Code Here

            throwError(Status.FORBIDDEN, message);
        }

        if (getDeleteCommand().equals("GENERIC-DELETE")) {
            try {
                ConfigBean p = (ConfigBean) parent;
                if (parent == null) {
                    p = (ConfigBean) entity.parent();
                }
                ConfigSupport.deleteChild(p, (ConfigBean) entity);
                return ExitCode.SUCCESS;
View Full Code Here

TOP

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

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.