@Override
public MetaValue createMetaValue(MetaType metaType, ConnectionFactoryControl control)
{
CompositeValueSupport cvs = new CompositeValueSupport(TYPE);
cvs.set("name", new SimpleValueSupport(SimpleMetaType.STRING, control.getName()));
List<org.hornetq.api.core.Pair<TransportConfiguration, TransportConfiguration>> pairs = control.getStaticConnectors();
StringBuffer liveTransportClassNames = new StringBuffer();
StringBuffer liveTransportParams = new StringBuffer();
StringBuffer backupTransportClassNames = new StringBuffer();
StringBuffer backupTransportParams = new StringBuffer();
for (Pair<TransportConfiguration, TransportConfiguration> pair : pairs)
{
if (pair.a != null)
{
TransportConfiguration live = pair.a;
if(liveTransportClassNames.length() > 0)
{
liveTransportClassNames.append(",");
}
liveTransportClassNames.append(live.getFactoryClassName());
Map<String, Object> params = live.getParams();
liveTransportParams.append("{");
for (Map.Entry<String, Object> stringObjectEntry : params.entrySet())
{
if(liveTransportParams.length() > 1)
{
liveTransportParams.append(",");
}
liveTransportParams.append(stringObjectEntry.getKey()).append("=").append(stringObjectEntry.getValue());
}
liveTransportParams.append("}");
}
if (pair.b != null)
{
TransportConfiguration backUp = pair.b;
if(backupTransportClassNames.length() > 0)
{
backupTransportClassNames.append(",");
}
backupTransportClassNames.append(backUp.getFactoryClassName());
Map<String, Object> params = backUp.getParams();
backupTransportParams.append("{");
for (Map.Entry<String, Object> stringObjectEntry : params.entrySet())
{
if(backupTransportParams.length() > 1)
{
backupTransportParams.append(",");
}
backupTransportParams.append(stringObjectEntry.getKey()).append("=").append(stringObjectEntry.getValue());
}
backupTransportParams.append("}");
}
}
cvs.set("liveTransportClassNames", new SimpleValueSupport(SimpleMetaType.STRING, liveTransportClassNames));
cvs.set("liveTransportParams", new SimpleValueSupport(SimpleMetaType.STRING, liveTransportParams));
cvs.set("backupTransportClassNames", new SimpleValueSupport(SimpleMetaType.STRING, backupTransportClassNames));
cvs.set("backupTransportParams", new SimpleValueSupport(SimpleMetaType.STRING, backupTransportParams));
cvs.set("Bindings", new SimpleValueSupport(SimpleMetaType.STRING, getJndiString(control.getJNDIBindings())));
cvs.set("DiscoveryAddress", new SimpleValueSupport(SimpleMetaType.STRING, control.getDiscoveryAddress()));
cvs.set("DiscoveryPort", new SimpleValueSupport(SimpleMetaType.STRING, control.getDiscoveryPort()));
cvs.set("DiscoveryRefreshTimeout", new SimpleValueSupport(SimpleMetaType.STRING, control.getDiscoveryRefreshTimeout()));
cvs.set("DiscoveryInitialWaitTimeout", new SimpleValueSupport(SimpleMetaType.STRING, control.getDiscoveryInitialWaitTimeout()));
cvs.set("ClientID", new SimpleValueSupport(SimpleMetaType.STRING, control.getClientID()));
cvs.set("DupsOKBatchSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getDupsOKBatchSize()));
cvs.set("TransactionBatchSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getTransactionBatchSize()));
cvs.set("ClientFailureCheckPeriod", new SimpleValueSupport(SimpleMetaType.STRING, control.getClientFailureCheckPeriod()));
cvs.set("ConnectionTTL", new SimpleValueSupport(SimpleMetaType.STRING, control.getConnectionTTL()));
cvs.set("CallTimeout", new SimpleValueSupport(SimpleMetaType.STRING, control.getCallTimeout()));
cvs.set("ConsumerWindowSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getConfirmationWindowSize()));
cvs.set("ConsumerMaxRate", new SimpleValueSupport(SimpleMetaType.STRING, control.getConsumerMaxRate()));
cvs.set("ConfirmationWindowSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getConfirmationWindowSize()));
cvs.set("ProducerMaxRate", new SimpleValueSupport(SimpleMetaType.STRING, control.getProducerMaxRate()));
cvs.set("ProducerWindowSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getProducerWindowSize()));
cvs.set("CacheLargeMessagesClient", new SimpleValueSupport(SimpleMetaType.STRING, control.isCacheLargeMessagesClient()));
cvs.set("MinLargeMessageSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getMinLargeMessageSize()));
cvs.set("BlockOnNonDurableSend", new SimpleValueSupport(SimpleMetaType.STRING, control.isBlockOnNonDurableSend()));
cvs.set("BlockOnAcknowledge", new SimpleValueSupport(SimpleMetaType.STRING, control.isBlockOnAcknowledge()));
cvs.set("BlockOnDurableSend", new SimpleValueSupport(SimpleMetaType.STRING, control.isBlockOnDurableSend()));
cvs.set("AutoGroup", new SimpleValueSupport(SimpleMetaType.STRING, control.isAutoGroup()));
cvs.set("PreAcknowledge", new SimpleValueSupport(SimpleMetaType.STRING, control.isPreAcknowledge()));
cvs.set("MaxRetryInterval", new SimpleValueSupport(SimpleMetaType.STRING, control.getMaxRetryInterval()));
cvs.set("RetryIntervalMultiplier", new SimpleValueSupport(SimpleMetaType.STRING, control.getRetryIntervalMultiplier()));
cvs.set("ReconnectAttempts", new SimpleValueSupport(SimpleMetaType.STRING, control.getReconnectAttempts()));
cvs.set("FailoverOnServerShutdown", new SimpleValueSupport(SimpleMetaType.STRING, control.isFailoverOnServerShutdown()));
cvs.set("ScheduledThreadPoolMaxSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getScheduledThreadPoolMaxSize()));
cvs.set("ThreadPoolMaxSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getThreadPoolMaxSize()));
cvs.set("GroupID", new SimpleValueSupport(SimpleMetaType.STRING, control.getGroupID()));
cvs.set("InitialMessagePacketSize", new SimpleValueSupport(SimpleMetaType.STRING, control.getInitialMessagePacketSize()));
cvs.set("UseGlobalPools", new SimpleValueSupport(SimpleMetaType.STRING, control.isUseGlobalPools()));
cvs.set("RetryInterval", new SimpleValueSupport(SimpleMetaType.STRING, control.getRetryInterval()));
cvs.set("ConnectionLoadBalancingPolicyClassName", new SimpleValueSupport(SimpleMetaType.STRING, control.getConnectionLoadBalancingPolicyClassName()));
return cvs;
}