Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedProperty


      if(deploymentMO instanceof ManagedObjectImpl)
         ((ManagedObjectImpl) deploymentMO).setAttachmentName(KernelDeployment.class.getName());

      MetaData metaData = unit.getMetaData();
      // Update the beanFactories value to a list of BeanMetaDataFactory with BeanMetaDatas
      ManagedProperty beanFactoriesMP = deploymentMO.getProperty("beanFactories");
      List<GenericValue> tmpBFs = new ArrayList<GenericValue>();
      CollectionMetaType beansFactoryType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
      if(beanFactories != null)
      {
         List<GenericValue> tmpBeans = new ArrayList<GenericValue>();
         CollectionMetaType beansType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
         for(BeanMetaDataFactory bmdf : beanFactories)
         {
           
            ManagedObject bmdfMO = mof.initManagedObject(bmdf, metaData);
            if(bmdfMO == null)
            {
               // Create a container managed object
               bmdfMO = createFactoryManagedObject(bmdf, deploymentMO, metaData);
            }

            if((bmdfMO instanceof MutableManagedObject) == false)
            {
               // Just go with the default ManagedObject
               GenericValueSupport gv = new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, bmdfMO);
               tmpBFs.add(gv);
               continue;
            }

            MutableManagedObject bmdfMMO = (MutableManagedObject) bmdfMO;
            bmdfMMO.setParent(deploymentMO);
            Map<String, ManagedProperty> oldProps = bmdfMMO.getProperties();
            ManagedProperty beansMPCheck = oldProps.get("beans");
            // If there already is a beans property assume it's correct
            if(beansMPCheck != null)
            {
               // Need to map
               continue;
View Full Code Here


    * @return the wrapped managed property
    * @throws Throwable for any error
    */
   public ManagedProperty wrapManagedProperty(Invocation invocation) throws Throwable
   {
      ManagedProperty result = (ManagedProperty) invocation.invokeNext();
      return wrapManagedProperty(result);
   }
View Full Code Here

         {
            getLog().debug(entry.getKey() + " -- ManagedObject == " + mo);
         }
      }
     
      ManagedProperty prop = mc.getProperty("stateString");
      assertNotNull("HAPartition has property stateString", prop);
      MetaValue metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
      prop = mc.getProperty("nodeName");
      assertNotNull("HAPartition has property nodeName", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
      prop = mc.getProperty("partitionName");
      assertNotNull("HAPartition has property partitionName", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
      prop = mc.getProperty("currentViewId");
      assertNotNull("HAPartition has property currentViewId", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof Long);
     
      prop = mc.getProperty("currentView");
      assertNotNull("HAPartition has property currentView", prop);
     
      prop = mc.getProperty("currentNodeCoordinator");
      assertNotNull("HAPartition has property currentNodeCoordinator", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof Boolean);
     
      prop = mc.getProperty("allowSynchronousMembershipNotifications");
      assertNotNull("HAPartition has property allowSynchronousMembershipNotifications", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof Boolean);
     
      prop = mc.getProperty("bindIntoJndi");
      assertNotNull("HAPartition has property bindIntoJndi", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof Boolean);
     
      prop = mc.getProperty("JGroupsVersion");
      assertNotNull("HAPartition has property JGroupsVersion", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
      prop = mc.getProperty("cacheConfigName");
      assertNotNull("HAPartition has property cacheConfigName", prop);
      metaVal = prop.getValue();
      assertTrue("cacheConfigName value (" + metaVal +") is instanceof SimpleValue", metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
      prop = mc.getProperty("channelStackName");
      assertNotNull("HAPartition has property channelStackName", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
      prop = mc.getProperty("stateTransferTimeout");
      assertNotNull("HAPartition has property stateTransferTimeout", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof Long);
     
      prop = mc.getProperty("methodCallTimeout");
      assertNotNull("HAPartition has property methodCallTimeout", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof Long);
   }
View Full Code Here

   {
      boolean matches = comp.getName().equals(name);
      if(matches == false)
      {
         // Look for an alias property
         ManagedProperty prop = comp.getProperty(propertyName);
         if(prop != null)
         {
            MetaType type = prop.getMetaType();
            if(type.isSimple())
            {
               SimpleValue value = (SimpleValue) prop.getValue();
               String n = value.getValue().toString();
               matches = name.equals(n);
            }
            else if(type.isArray())
            {
               ArrayValue value = (ArrayValue) prop.getValue();
               for(Object n : value)
               {
                  if(name.equals(n.toString()))
                  {
                     matches = true;
View Full Code Here

         {
            getLog().debug(entry.getKey() + " -- ManagedObject == " + mo);
         }
      }
     
      ManagedProperty prop = mc.getProperty("domain");
      assertNotNull("ChannelFactory has property domain", prop);
      MetaValue metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      Object val = ((SimpleValue) metaVal).getValue();
      assertEquals("jboss.jgroups", val);
     
      prop = mc.getProperty("exposeChannels");
      assertNotNull("ChannelFactory has property exposeChannels", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertEquals(Boolean.TRUE, val);
     
      prop = mc.getProperty("exposeProtocols");
      assertNotNull("ChannelFactory has property exposeProtocols", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertEquals(Boolean.TRUE, val);
     
      prop = mc.getProperty("nodeName");
      assertNotNull("ChannelFactory has property nodeName", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertNotNull(val);
      assertTrue(val instanceof String);
     
      prop = mc.getProperty("assignLogicalAddresses");
      assertNotNull("ChannelFactory has property assignLogicalAddresses", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertEquals(Boolean.TRUE, val);
     
      prop = mc.getProperty("manageNewThreadClassLoader");
      assertNotNull("ChannelFactory has property manageNewThreadClassLoader", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertEquals(Boolean.TRUE, val);
     
      prop = mc.getProperty("manageReleasedThreadClassLoader");
      assertNotNull("ChannelFactory has property manageReleasedThreadClassLoader", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertTrue(val instanceof Boolean);
     
      prop = mc.getProperty("addMissingSingletonName");
      assertNotNull("ChannelFactory has property addMissingSingletonName", prop);
      metaVal = prop.getValue();
      assertTrue(metaVal instanceof SimpleValue);
      val = ((SimpleValue) metaVal).getValue();
      assertEquals(Boolean.TRUE, val);
     
      prop = mc.getProperty("state");
      assertNotNull("ChannelFactory has property state", prop);

      // FIXME ProfileService messes with this prop -- figure out how to validate
//      metaVal = prop.getValue();     
//      assertNotNull(metaVal);
//      assertTrue(metaVal instanceof SimpleValue);
//      val = ((SimpleValue) metaVal).getValue();
//      assertEquals(ServiceMBean.states[ServiceMBean.STARTED], val);
     
      prop = mc.getProperty("protocolStackConfigurations");
      assertNotNull("ChannelFactory has property protocolStackConfigurations", prop);
      metaVal = prop.getValue();
      ManagedObjectTestUtil.validateProtocolStackConfigurations(metaVal, new String[]{"udp", "tcp"});
     
      prop = mc.getProperty("openChannels");
      assertNotNull("ChannelFactory has property openChannels", prop);
      try
      {
         metaVal = prop.getValue();
      }
      catch (UndeclaredThrowableException ute)
      {
         log.error("Undeclared throwable: ", ute.getUndeclaredThrowable());
      }
View Full Code Here

   }

   public void testUpdateProtocolStackConfigurations() throws Exception
   {
      ManagedComponent component = getChannelFactoryManagedComponent();
      ManagedProperty prop = component.getProperty("protocolStackConfigurations");
      MetaValue mapValue = prop.getValue();
      assertTrue(mapValue instanceof CompositeValue);
      MetaValue stackValue = ((CompositeValue) mapValue).get("udp-async");
      assertTrue(stackValue instanceof CompositeValue);
      MetaValue configurationValue = ((CompositeValue) stackValue).get("configuration");
      assertTrue(configurationValue instanceof CollectionValue);
      MetaValue[] protocols = ((CollectionValue) configurationValue).getElements();
      MetaValue udp = protocols[0];
      assertTrue(udp instanceof CompositeValue);
      MetaValue parametersValue = ((CompositeValue) udp).get("protocolParameters");
      assertTrue(parametersValue instanceof CompositeValue);
      Set<String> params = ((CompositeValue) parametersValue).getMetaType().keySet();
      int maxThreads = -1;
      MapCompositeValueSupport newVal = null;
      for (String name : params)
      {        
         if ("oob_thread_pool.max_threads".equals(name))
         {
            CompositeValue param = (CompositeValue) ((CompositeValue) parametersValue).get(name);
            String value = (String) ((SimpleValue) param.get("value")).getValue();
            maxThreads = Integer.parseInt(value);
            newVal = cloneCompositeValue(param);
            newVal.put("value", SimpleValueSupport.wrap(String.valueOf(maxThreads + 1)));
            break;
         }
      }
      assertNotNull("updated max_threads config", newVal);
     
      MapCompositeValueSupport newParametersValue = cloneCompositeValue((CompositeValue) parametersValue);
      newParametersValue.put("oob_thread_pool.max_threads", newVal);
      MapCompositeValueSupport newUdp = cloneCompositeValue((CompositeValue) udp);
      newUdp.put("protocolParameters", newParametersValue);
      protocols[0] = newUdp;
      CollectionValue newConfigurationValue =
         new CollectionValueSupport(((CollectionValue) configurationValue).getMetaType(), protocols);
      MapCompositeValueSupport updatedStack = cloneCompositeValue((CompositeValue) stackValue);
      updatedStack.put("configuration", newConfigurationValue);
      MapCompositeValueSupport newMapValue = cloneCompositeValue((CompositeValue) mapValue);
      newMapValue.put("udp-async", updatedStack);
     
      // Add a stack
      MapCompositeValueSupport newStack = cloneCompositeValue((CompositeValue) stackValue);
      newStack.put("name", SimpleValueSupport.wrap("new-stack"));
      newMapValue.put("new-stack", newStack);
     
      // Remove a stack
      newMapValue.remove("tcp-async");
     
      // Store the updates
      prop.setValue(newMapValue);
      getManagementView().updateComponent(component);
     
      // Re-read the component and validate the changes took
     
      component = getChannelFactoryManagedComponent();
      prop = component.getProperty("protocolStackConfigurations");
      mapValue = prop.getValue();
      assertTrue(mapValue instanceof CompositeValue);
      stackValue = ((CompositeValue) mapValue).get("udp-async");
      assertTrue(stackValue instanceof CompositeValue);
      configurationValue = ((CompositeValue) stackValue).get("configuration");
      assertTrue(configurationValue instanceof CollectionValue);
View Full Code Here

    * @return the wrapped managed property
    * @throws Throwable for any error
    */
   public ManagedProperty wrapManagedProperty(Invocation invocation) throws Throwable
   {
      ManagedProperty result = (ManagedProperty) invocation.invokeNext();
      return wrapManagedProperty(result);
   }
View Full Code Here

            if(log.isTraceEnabled())
               log.trace("Skipping component property: "+prop);
            continue;
         }

         ManagedProperty ctxProp = serverComp.getProperties().get(prop.getName());
         // Check for a mapped name
         if( ctxProp == null )
         {
            String mappedName = prop.getMappedName();
            if( mappedName != null )
               ctxProp = serverComp.getProperties().get(mappedName);
         }
         if( ctxProp == null )
         {
            formatter.applyPattern(i18n.getString("ManagementView.InvalidTemplateProperty")); //$NON-NLS-1$
            Object[] args = {prop.getName()};
            String msg = formatter.format(args);
            throw new IllegalArgumentException(msg);
         }
         // The property value must be a MetaValue
         Object value = prop.getValue();
         if ((value instanceof MetaValue) == false)
         {
            formatter.applyPattern(i18n.getString("ManagementView.InvalidPropertyValue")); //$NON-NLS-1$
            Object[] args = {prop.getName(), value.getClass()};
            String msg = formatter.format(args);
            throw new IllegalArgumentException(msg);
         }
         // Update the serverComp
         MetaValue metaValue = (MetaValue)value;
         ctxProp.setField(Fields.META_TYPE, metaValue.getMetaType());
         ctxProp.setValue(metaValue);

         // Dispatch any runtime component property values
         Object componentName = getComponentName(ctxProp);
         ActivationPolicy policy = ctxProp.getActivationPolicy();

         if (componentName != null && policy.equals(ActivationPolicy.IMMEDIATE))
         {
            AbstractRuntimeComponentDispatcher.setActiveProperty(ctxProp);
            dispatcher.set(componentName, ctxProp.getName(), metaValue);
         }
      }

      // Persist the changed values
      this.store.updateDeployment(comp.getDeployment().getName(), serverComp);
View Full Code Here

               }
               catch(Throwable t)
               {
                  log.debug("Failed to get stat value, "+componentName+":"+propName);
               }
               ManagedProperty proxiedProp = createPropertyProxy(prop);
               props.put(prop.getName(), proxiedProp);
            }
            else
            {
               props.put(prop.getName(), prop);
View Full Code Here

            if(log.isTraceEnabled())
               log.trace("Skipping component property: "+prop);
            continue;
         }
  
         ManagedProperty ctxProp = serverComp.getProperties().get(prop.getName());
         // Check for a mapped name
         if( ctxProp == null )
         {
            String mappedName = prop.getMappedName();
            if( mappedName != null )
               ctxProp = serverComp.getProperties().get(mappedName);
         }
         if( ctxProp == null )
         {
            formatter.applyPattern(i18n.getString("ManagementView.InvalidTemplateProperty")); //$NON-NLS-1$
            Object[] args = {prop.getName()};
            String msg = formatter.format(args);
            throw new IllegalArgumentException(msg);
         }
         // The property value must be a MetaValue
         Object value = prop.getValue();
         if ((value instanceof MetaValue) == false)
         {
            formatter.applyPattern(i18n.getString("ManagementView.InvalidPropertyValue")); //$NON-NLS-1$
            Object[] args = {prop.getName(), value.getClass()};
            String msg = formatter.format(args);
            throw new IllegalArgumentException(msg);
         }
         // Update the serverComp
         MetaValue metaValue = (MetaValue)value;
         ctxProp.setField(Fields.META_TYPE, metaValue.getMetaType());
         ctxProp.setValue(metaValue);
        
         // Dispatch any runtime component property values
         Object componentName = getComponentName(ctxProp);
         ActivationPolicy policy = ctxProp.getActivationPolicy();
        
         if (componentName != null && policy.equals(ActivationPolicy.IMMEDIATE))
         {
            AbstractRuntimeComponentDispatcher.setActiveProperty(ctxProp);
            dispatcher.set(componentName, ctxProp.getName(), metaValue);
         }
      }
  
      // Persist the changed values
      Profile profile = getProfileForDeployment(md.getName());
View Full Code Here

TOP

Related Classes of org.jboss.managed.api.ManagedProperty

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.