Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.MetaValue


    // Check if the property is readable
    if (propertyInfo != null && propertyInfo.isReadable() == false)
      return null;

    MetaValue value = null;
    if (TRANSLATOR_PROPERTY.equals(property.getName())) {
      MapCompositeValueSupport mapValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
      List<PropertyMetadata> list = attachment.getJAXBProperties();
      if (list != null) {
        for (PropertyMetadata prop : list) {
          String name = prop.getName();
          MetaValue svalue = SimpleValueSupport.wrap(prop.getValue());
          mapValue.put(name, svalue);
        }
      }
      value = mapValue;
    } else {
View Full Code Here


  }

  public static MapCompositeValueSupport compositeValueMap(Map<String, String> map) {
    MapCompositeValueSupport metaValue = new MapCompositeValueSupport(SimpleMetaType.STRING);
    for (String key : map.keySet()) {
      MetaValue value = SimpleValueSupport.wrap(map.get(key));
      metaValue.put(key, value);
    }
    return metaValue;
 
View Full Code Here

       else if (metaType.isComposite()) {
        Properties props = new Properties();
        MapCompositeValueSupport map = (MapCompositeValueSupport) mp.getValue();
        MapCompositeMetaType type = map.getMetaType();
        for (String key : type.keySet()) {
          MetaValue value = map.get(key);
          props.setProperty(key, stringValue(value));
        }
        return props;
       }
       throw new IllegalArgumentException(prop+ " is not a properties type"); //$NON-NLS-1$
View Full Code Here

    try {
      Object t = clazz.newInstance();
     
      Map<String, ManagedProperty> managedProperties = mc.getProperties();
      for (ManagedProperty mp: managedProperties.values()) {
        MetaValue value = mp.getValue();
        if (value != null) {
          MetaType type = value.getMetaType();
          if (type.isSimple()) {
            PropertiesUtils.setBeanProperty(t, mp.getMappedName(), ((SimpleValue)value).getValue());
          }
          else if (type.isPrimitive()) {
            PropertiesUtils.setBeanProperty(t, mp.getMappedName(), ((SimpleValue)value).getValue());
View Full Code Here

      for (String key:sourceInfo.getProperties().keySet()) {
        ManagedProperty mp = propertyMap.get(key);
               
        if (mp != null) {
          // property found in target, so just add as value
          MetaValue value = sourceInfo.getProperties().get(key).getValue();
          if (ManagedUtil.sameValue(mp.getDefaultValue(), value)) {
            continue;
          }   
         
          if (value != null) {
            mp.setValue(value);
          }
        }
        else {
          // property not found in the target; add as "config-property"
          mp = sourceInfo.getProperties().get(key);
          if (ManagedUtil.sameValue(mp.getDefaultValue(), mp.getValue())) {
            continue;
         
         
          if (mp.getValue() != null) {
            configProps.put(key, ManagedUtil.stringValue(mp.getValue()));
            configProps.put(key+".type", mp.getValue().getMetaType().getClassName());//$NON-NLS-1$ 
          }
        }
      }
     
      if (configProps.size() > 0) {
        MetaValue metaValue = ManagedUtil.compositeValueMap(configProps);
        targetInfo.getProperties().get("config-property").setValue(metaValue);//$NON-NLS-1$         
      }
      return this.targetTemplate.applyTemplate(targetInfo);

    } catch (NoSuchDeploymentException e) {
View Full Code Here

  @Override
  public Collection<Session> getSessions() throws AdminException {
    try {
      Collection<Session> sessionList = new ArrayList<Session>();
      ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE)
      MetaValue value = ManagedUtil.executeOperation(mc, "getActiveSessions");//$NON-NLS-1$
      MetaValue[] sessions = ((CollectionValueSupport)value).getElements();
      for (MetaValue mv:sessions) {
        sessionList.add((SessionMetadata)MetaValueFactory.getInstance().unwrap(mv, SessionMetadata.class));
      }
      return sessionList;
View Full Code Here

  @Override
    public Collection<Request> getRequests() throws AdminException {
    try {
      Collection<Request> requestList = new ArrayList<Request>();
      ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE)
      MetaValue value = ManagedUtil.executeOperation(mc, "getRequests");//$NON-NLS-1$
      MetaValue[] requests = ((CollectionValueSupport)value).getElements();     
      for (MetaValue mv:requests) {
        requestList.add((RequestMetadata)MetaValueFactory.getInstance().unwrap(mv, RequestMetadata.class));
      }
      return requestList;
View Full Code Here

  @Override
    public Collection<Request> getRequestsForSession(String sessionId) throws AdminException {
    try {
      Collection<Request> requestList = new ArrayList<Request>();
      ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE)
      MetaValue value = ManagedUtil.executeOperation(mc, "getRequestsForSession", SimpleValueSupport.wrap(sessionId));//$NON-NLS-1$
      MetaValue[] requests = ((CollectionValueSupport)value).getElements();
      for (MetaValue mv:requests) {
        requestList.add((RequestMetadata)MetaValueFactory.getInstance().unwrap(mv, RequestMetadata.class));
      }
      return requestList;
View Full Code Here

  @Override
  public Collection<String> getCacheTypes() throws AdminException {
    try {
      Collection<String> requestList = new ArrayList<String>();
      ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE)
      MetaValue value = ManagedUtil.executeOperation(mc, "getCacheTypes");//$NON-NLS-1$
      MetaValue[] requests = ((CollectionValueSupport)value).getElements();
      for (MetaValue mv:requests) {
        requestList.add(ManagedUtil.stringValue(mv));
      }
      return requestList;
View Full Code Here

  @Override
  public Collection<Transaction> getTransactions() throws AdminException {
    try {
      Collection<Transaction> txnList = new ArrayList<Transaction>();
      ManagedComponent mc = getView().getComponent(DQPNAME, DQPTYPE)
      MetaValue value = ManagedUtil.executeOperation(mc, "getTransactions");//$NON-NLS-1$
      MetaValue[] requests = ((CollectionValueSupport)value).getElements();
      for (MetaValue mv:requests) {
        txnList.add((TransactionMetadata)MetaValueFactory.getInstance().unwrap(mv, TransactionMetadata.class));
      }
      return txnList;
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.MetaValue

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.