Examples of ManagedPropertyImpl


Examples of org.jboss.managed.plugins.ManagedPropertyImpl

      DefaultFieldsImpl fields = new DefaultFieldsImpl();
      fields.setDescription(fieldDescr);
      fields.setMandatory(mandatory);
      fields.setMetaType(metaType);
      fields.setName(fieldName);
      ManagedPropertyImpl mp = new ManagedPropertyImpl(mo, fields);
      if(isID)
      {
         Map<String, Annotation> annotations = new HashMap<String, Annotation>();
         Map<String, Object> idFields = Collections.emptyMap();
         try
         {
            ManagementObjectID id = (ManagementObjectID) AnnotationProxy.createProxy(idFields, ManagementObjectID.class);
            annotations.put(ManagementObjectID.class.getName(), id);
            mp.setAnnotations(annotations);
         }
         catch(Exception e)
         {
            throw new UndeclaredThrowableException(e);
         }
      }

      super.addProperty(mp);
      if(value != null)
         mp.setValue(value);
   }
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

    * @return simpler ManagedPropertyImpl
    * @throws java.io.ObjectStreamException for any error
    */
   private Object writeReplace() throws ObjectStreamException
   {
      ManagedPropertyImpl managedProperty = new ManagedPropertyImpl(getManagedObject(), getFields());
      managedProperty.setTargetManagedObject(getTargetManagedObject());
      return managedProperty;
   }
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

    */
   @ManagementProperty(name="runtime-stat", use={ViewUse.STATISTIC})
   public void testViewUseField()
      throws Exception
   {
      ManagedPropertyImpl mp = new ManagedPropertyImpl("runtime");
      mp.setMetaType(SimpleMetaType.LONG);
      mp.setValue(SimpleValueSupport.wrap(1000));
      mp.setViewUse(new ViewUse[]{ViewUse.RUNTIME});
      assertTrue("has ViewUse.RUNTIME", mp.hasViewUse(ViewUse.RUNTIME));

      ManagedPropertyImpl mp2 = new ManagedPropertyImpl("runtime-stat");
      mp2.setMetaType(SimpleMetaType.LONG);
      mp2.setValue(SimpleValueSupport.wrap(1000));
      mp2.setViewUse(new ViewUse[]{ViewUse.RUNTIME, ViewUse.STATISTIC});
      assertTrue("has ViewUse.RUNTIME", mp2.hasViewUse(ViewUse.RUNTIME));
      assertTrue("has ViewUse.STATISTIC", mp2.hasViewUse(ViewUse.STATISTIC));

      ManagedPropertyImpl mp3 = new ManagedPropertyImpl("runtime-stat");
      mp3.setMetaType(SimpleMetaType.LONG);
      mp3.setValue(SimpleValueSupport.wrap(1000));
      mp3.setViewUse(new ViewUse[]{ViewUse.RUNTIME});
      HashMap<String, Annotation> annotations = new HashMap<String, Annotation>();
      ManagementProperty mpa = getClass().getMethod("testViewUseField", null).getAnnotation(ManagementProperty.class);
      annotations.put(ManagementProperty.class.getName(), mpa);
      mp3.setAnnotations(annotations);
      assertTrue("has ViewUse.RUNTIME", mp3.hasViewUse(ViewUse.RUNTIME));
      assertTrue("has ViewUse.STATISTIC", mp3.hasViewUse(ViewUse.STATISTIC));
   }
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

      {
         throw new RuntimeException("Error creating dom", e);
      }
     
      Map<String, ManagedProperty> properties = getProperties();
      properties.put("jndi-name", new ManagedPropertyImpl(this, new MockDOMFields(element, "jndi-name")));
      properties.put("connection-url", new ManagedPropertyImpl(this, new MockDOMFields(element, "connection-url")));
      properties.put("user", new ManagedPropertyImpl(this, new MockDOMFields(element, "user")));
      properties.put("password", new ManagedPropertyImpl(this, new MockDOMFields(element, "password")));
   }
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

      {
         attachment = attachment.clone();
         ManagedObjectImpl managedObject = new ManagedObjectImpl(TestAttachment.class.getName());
         managedObject.setAttachment(attachment);
         Map<String, ManagedProperty> properties = managedObject.getProperties();
         properties.put("string1", new ManagedPropertyImpl(managedObject, new TestFields(attachment, "string1")));
         properties.put("string2", new ManagedPropertyImpl(managedObject, new TestFields(attachment, "string2")));
         managedObjects.put(TestAttachment.class.getName(), managedObject);
      }
   }
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

            }

            Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
            // Create a beans ManagedProperty, a list of BeanMetaData ManagedObjects
            Fields fields = getFields("beans", beansType);
            ManagedPropertyImpl beansMP = new ManagedPropertyImpl(bmdfMO, fields);
            newProps.put("beans", beansMP);

            // Create a ManagedObject for each of the beans BeanMetaData
            List<BeanMetaData> beans = bmdf.getBeans();
            if(beans != null)
            {
               for(BeanMetaData bmd : beans)
               {
                  DeploymentUnit compUnit = unit.getComponent(bmd.getName());
                  if(compUnit == null)
                  {
                     log.debug("Failed to find component for bean: "+bmd.getName());
                     continue;
                  }
                  MetaData compMetaData = compUnit.getMetaData();
                  GenericValue gv = getManagedObjectValue(bmd, compMetaData, bmdfMO);
                  if(gv != null)
                  {
                     // The component managed objects need to be in the root map
                     ManagedObject compMO = (ManagedObject) gv.getValue();
                     // Use the ManagedObject name if it's not the same as the attachmentName
                     String managedObjectName = compUnit.getName();
                     if(compMO != null && compMO.getAttachmentName() != null)
                     {
                        managedObjectName = compMO.getAttachmentName().equals(compMO.getName()) ?
                              compUnit.getName() : compMO.getName();
                     }
                     // Add the managed object
                     managedObjects.put(managedObjectName, compMO);
                     // Add the bean MO to the beans list
                     tmpBeans.add(gv);
                  }
               }
            }
            GenericValue[] beanMOs = new GenericValue[tmpBeans.size()];
            tmpBeans.toArray(beanMOs);
            CollectionValueSupport values = new CollectionValueSupport(beansType, beanMOs);
            beansMP.setValue(values);
            // Update the bean factory properties
            bmdfMMO.setProperties(newProps);
         }
      }
      GenericValue[] mos = new GenericValue[tmpBFs.size()];
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

         mmo.setParent(parentMO);
         Map<String, ManagedProperty> oldProps = mmo.getProperties();
         Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
         // Add a state property
         Fields stateFields = getFields("state", ControllerStateMetaType.TYPE);
         ManagedPropertyImpl stateMP = new ManagedPropertyImpl(mmo, stateFields);
         newProps.put("state", stateMP);
         mmo.setProperties(newProps);
      }
      return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
   }
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

                     {
                        aliases[n] = i.next().toString();
                     }
                     ArrayValueSupport value = new ArrayValueSupport(aliasType, aliases);
                     fields.setValue(value);
                     ManagedPropertyImpl aliasesMP = new ManagedPropertyImpl(bmdMO, fields);
                     newProps.put("alias", aliasesMP);
                  }
                  // Add a state property
                  DefaultFieldsImpl stateFields = getFields("state", ControllerStateMetaType.TYPE);
                  stateFields.setViewUse(new ViewUse[]{ViewUse.STATISTIC});
                  EnumValue stateValue = getState(bmd.getName(), kernel);
                  stateFields.setValue(stateValue);
                  stateFields.setDescription("The bean controller state");
                  ManagedPropertyImpl stateMP = new ManagedPropertyImpl(mmo, stateFields);
                  newProps.put("state", stateMP);
                  // Update the properties
                  mmo.setProperties(newProps);
               }
               log.debug("Created ManagedObject: "+bmdMO+" for bean: "+bmd.getName());
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

/* 124 */       values.add(SimpleValueSupport.wrap("local-tx-datasource"));
/* 125 */       values.add(SimpleValueSupport.wrap("no-tx-datasource"));
/* 126 */       values.add(SimpleValueSupport.wrap("xa-datasource"));
/* 127 */       f21.setLegalValues(values);
/* 128 */       f21.setMetaType(SimpleMetaType.STRING);
/* 129 */       ManagedPropertyImpl dsType = new ManagedPropertyImpl(typeMO, f21);
/* 130 */       typeMO.getProperties().put("datasource-type", dsType);
/* 131 */       wrapMO = WrapperAdvice.wrapManagedObject(typeMO);
/* 132 */       map.put(attachName, wrapMO);
/*     */     }
/*     */   }
View Full Code Here

Examples of org.jboss.managed.plugins.ManagedPropertyImpl

/* 235 */     DefaultFieldsImpl fields = new DefaultFieldsImpl();
/* 236 */     setFieldName(fieldName, fields);
/* 237 */     fields.setDescription(fieldDescr);
/* 238 */     fields.setMandatory(mandatory);
/* 239 */     fields.setMetaType(metaType);
/* 240 */     ManagedPropertyImpl mp = new ManagedPropertyImpl(mo, fields);
/* 241 */     super.addProperty(mp);
/* 242 */     if (value != null)
/* 243 */       mp.setValue(value);
/*     */   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.