Package org.jboss.metatype.api.values

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


  public RequestMetadata unwrapRequestMetaValue(MetaValue metaValue) throws Exception {
    if (metaValue == null)
      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValue compositeValue = (CompositeValue) metaValue;
     
      RequestMetadata request = new RequestMetadata();
      request.setExecutionId((Long) ProfileServiceUtil.longValue(compositeValue.get(EXECUTION_ID)));
      request.setSessionId((String) ProfileServiceUtil.stringValue(compositeValue.get(SESSION_ID)));
      request.setStartTime((Long) ProfileServiceUtil.longValue(compositeValue.get(START_TIME)));
      request.setCommand((String) ProfileServiceUtil.stringValue(compositeValue.get(COMMAND)));
      request.setSourceRequest((Boolean) ProfileServiceUtil.booleanValue(compositeValue.get(SOURCE_REQUEST)));
      request.setNodeId((Integer) ProfileServiceUtil.integerValue(compositeValue.get(NODE_ID)));
      request.setTransactionId((String) ProfileServiceUtil.stringValue(compositeValue.get(TRANSACTION_ID)));
      request.setState((ProcessingState) ProfileServiceUtil.getSimpleValue(compositeValue.get(STATE), ProcessingState.class));
      return request;
    }
    throw new IllegalStateException("Unable to unwrap RequestMetadata " + metaValue); //$NON-NLS-1$
  }
View Full Code Here


  public TransactionMetadata unwrapTransactionMetaValue(MetaValue metaValue) throws Exception {
    if (metaValue == null)
      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValue compositeValue = (CompositeValue) metaValue;
     
      TransactionMetadata transaction = new TransactionMetadata();
      transaction.setAssociatedSession((String) ProfileServiceUtil.stringValue(compositeValue.get(ASSOCIATED_SESSION)));
      transaction.setCreatedTime((Long) ProfileServiceUtil.longValue(compositeValue.get(CREATED_TIME)));
      transaction.setScope((String) ProfileServiceUtil.stringValue(compositeValue.get(SCOPE)));
      transaction.setId((String) ProfileServiceUtil.stringValue(compositeValue.get("id"))); //$NON-NLS-1$
      return transaction;
    }
    throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
  }
View Full Code Here

{
    private final Log log = LogFactory.getLog(PluginConstants.DEFAULT_LOGGER_CATEGORY);

    public void populateMetaValueFromProperty(PropertyMap propMap, MetaValue metaValue, PropertyDefinitionMap propDefMap)
    {
        CompositeValue compositeValue = (CompositeValue)metaValue;               
        for (String mapMemberPropName : propMap.getMap().keySet())
        {
            Property mapMemberProp = propMap.get(mapMemberPropName);
            PropertyDefinition mapMemberPropDef = propDefMap.get(mapMemberPropName);
            MetaType mapMemberMetaType = compositeValue.getMetaType().getType(mapMemberPropName);
            if (mapMemberMetaType == null)
            {
                // this will occur when new map properties are added since they are not present
                // in the original metaValue which we are using
                mapMemberMetaType = SimpleMetaType.STRING;
View Full Code Here

        }
    }

    public MetaValue convertToMetaValue(PropertyMap propMap, PropertyDefinitionMap propDefMap, MetaType metaType)
    {
        CompositeValue compositeValue = createCompositeValue(propDefMap, metaType);
        populateMetaValueFromProperty(propMap, compositeValue, propDefMap);
        return compositeValue;
    }
View Full Code Here

    public void populatePropertyFromMetaValue(PropertyMap propMap, MetaValue metaValue, PropertyDefinitionMap propDefMap)
    {
        if (metaValue == null)
            return;
        CompositeValue compositeValue = (CompositeValue)metaValue;
        Set<String> mapMemberPropNames = compositeValue.getMetaType().keySet();
        // There won't be any keys when loading a Configuration for the first time.
        for (String mapMemberPropName : mapMemberPropNames)
        {
            Property mapMemberProp = propMap.get(mapMemberPropName);
            MetaValue mapMemberMetaValue = compositeValue.get(mapMemberPropName);
            MetaType mapMemberMetaType = compositeValue.getMetaType().getType(mapMemberPropName);
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(mapMemberMetaType);
            PropertyDefinition mapMemberPropDef = propDefMap.get(mapMemberPropName);
            if (mapMemberProp == null)
            {
                if (mapMemberPropDef != null)
View Full Code Here

  public RequestMetadata unwrapMetaValue(MetaValue metaValue) {
    if (metaValue == null)
      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValue compositeValue = (CompositeValue) metaValue;
     
      RequestMetadata request = new RequestMetadata();
      request.setExecutionId((Long) metaValueFactory.unwrap(compositeValue.get(EXECUTION_ID)));
      request.setSessionId((String) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
      request.setStartTime((Long) metaValueFactory.unwrap(compositeValue.get(START_TIME)));
      request.setCommand((String) metaValueFactory.unwrap(compositeValue.get(COMMAND)));
      request.setSourceRequest((Boolean) metaValueFactory.unwrap(compositeValue.get(SOURCE_REQUEST)));
      request.setNodeId((Integer) metaValueFactory.unwrap(compositeValue.get(NODE_ID)));
      request.setTransactionId((String) metaValueFactory.unwrap(compositeValue.get(TRANSACTION_ID)));
      request.setState((ProcessingState) metaValueFactory.unwrap(compositeValue.get(STATE)));
      return request;
    }
    throw new IllegalStateException("Unable to unwrap RequestMetadata " + metaValue); //$NON-NLS-1$
  }
View Full Code Here

  public TransactionMetadata unwrapMetaValue(MetaValue metaValue) {
    if (metaValue == null)
      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValue compositeValue = (CompositeValue) metaValue;
     
      TransactionMetadata transaction = new TransactionMetadata();
      transaction.setAssociatedSession((String) metaValueFactory.unwrap(compositeValue.get(ASSOCIATED_SESSION)));
      transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
      transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get(SCOPE)));
      transaction.setId((String) metaValueFactory.unwrap(compositeValue.get(ID)));
      return transaction;
    }
    throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
  }
View Full Code Here

  public WorkerPoolStatisticsMetadata unwrapMetaValue(MetaValue metaValue) {
    if (metaValue == null)
      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValue compositeValue = (CompositeValue) metaValue;
     
      WorkerPoolStatisticsMetadata stats = new WorkerPoolStatisticsMetadata();
      stats.setActiveThreads((Integer) metaValueFactory.unwrap(compositeValue.get(ACTIVE_THREADS)));
      stats.setHighestActiveThreads((Integer) metaValueFactory.unwrap(compositeValue.get(HIGHEST_ACTIVE_THREADS)));
      stats.setTotalCompleted((Long) metaValueFactory.unwrap(compositeValue.get(TOTAL_COMPLETED)));
      stats.setTotalSubmitted((Long) metaValueFactory.unwrap(compositeValue.get(TOTAL_SUBMITTED)));
      stats.setQueueName((String) metaValueFactory.unwrap(compositeValue.get(QUEUE_NAME)));
      stats.setQueued((Integer) metaValueFactory.unwrap(compositeValue.get(QUEUED)));
      stats.setHighestQueued((Integer) metaValueFactory.unwrap(compositeValue.get(HIGHEST_QUEUED)));
      stats.setMaxThreads((Integer) metaValueFactory.unwrap(compositeValue.get(MAX_THREADS)));     
      return stats;
    }
    throw new IllegalStateException("Unable to unwrap transaction " + metaValue); //$NON-NLS-1$
  }
View Full Code Here

  public SessionMetadata unwrapMetaValue(MetaValue metaValue) {
    if (metaValue == null)
      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValue compositeValue = (CompositeValue) metaValue;
     
      SessionMetadata session = new SessionMetadata();
      session.setApplicationName((String) metaValueFactory.unwrap(compositeValue.get(APPLICATION_NAME)));
      session.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
      session.setClientHostName((String) metaValueFactory.unwrap(compositeValue.get(CLIENT_HOST_NAME)));
      session.setIPAddress((String) metaValueFactory.unwrap(compositeValue.get(IP_ADDRESS)));
      session.setLastPingTime((Long) metaValueFactory.unwrap(compositeValue.get(LAST_PING_TIME)));
      session.setSessionId((String) metaValueFactory.unwrap(compositeValue.get(SESSION_ID)));
      session.setUserName((String) metaValueFactory.unwrap(compositeValue.get(USER_NAME)));
      session.setVDBName((String) metaValueFactory.unwrap(compositeValue.get(VDB_NAME)));
      session.setVDBVersion((Integer) metaValueFactory.unwrap(compositeValue.get(VDB_VERSION)));
      session.setSecurityDomain((String) metaValueFactory.unwrap(compositeValue.get(SECURITY_DOMAIN)));
      return session;
    }
    throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$
  }
View Full Code Here

  public CacheStatisticsMetadata unwrapMetaValue(MetaValue metaValue) {
    if (metaValue == null)
      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValue compositeValue = (CompositeValue) metaValue;
     
      CacheStatisticsMetadata cache = new CacheStatisticsMetadata();
      cache.setTotalEntries((Integer) metaValueFactory.unwrap(compositeValue.get(TOTAL_ENTRIES)));
      cache.setHitRatio((Double) metaValueFactory.unwrap(compositeValue.get(HITRATIO)));
      cache.setRequestCount((Integer) metaValueFactory.unwrap(compositeValue.get(REQUEST_COUNT)));
      return cache;
    }
    throw new IllegalStateException("Unable to unwrap cache statistics " + metaValue); //$NON-NLS-1$
  }
View Full Code Here

TOP

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

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.