/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.provider.livedata;
import java.net.URI;
import java.util.List;
import java.util.Map;
import org.joda.beans.Bean;
import org.joda.beans.BeanBuilder;
import org.joda.beans.BeanDefinition;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaProperty;
import org.joda.beans.Property;
import org.joda.beans.PropertyDefinition;
import org.joda.beans.impl.direct.DirectBean;
import org.joda.beans.impl.direct.DirectBeanBuilder;
import org.joda.beans.impl.direct.DirectMetaBean;
import org.joda.beans.impl.direct.DirectMetaProperty;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;
import com.google.common.collect.Lists;
import com.opengamma.id.ExternalScheme;
import com.opengamma.util.PublicSPI;
/**
* The meta-data for connecting to a live data provider.
* <p>
* This class is mutable and not thread-safe.
*/
@PublicSPI
@BeanDefinition
public class LiveDataMetaData extends DirectBean {
/**
* The external identifier schemes that are supported, in order of preference.
*/
@PropertyDefinition
private final List<ExternalScheme> _supportedSchemes = Lists.newArrayList();
/**
* The type of the live data server.
*/
@PropertyDefinition(validate = "notNull")
private LiveDataServerType _serverType;
/**
* The description, which could be for end-users.
*/
@PropertyDefinition(validate = "notNull")
private String _description;
/**
* The server URI that the client connects to, null if not used.
* This may be a socket, JMS, REST or something else, depending on the server type.
*/
@PropertyDefinition
private URI _connectionUri;
/**
* The URI of the JMS broker that the server uses, null if not used.
*/
@PropertyDefinition
private URI _jmsBrokerUri;
/**
* The name of the subscription topic, null if not used.
*
* @deprecated replaced by jmsSubscriptionQueue, kept in place until clients have been migrated
*/
@PropertyDefinition
@Deprecated
private String _jmsSubscriptionTopic;
/**
* The name of the subscription queue, null if not used.
*/
@PropertyDefinition
private String _jmsSubscriptionQueue;
/**
* The name of the entitlement topic, null if not used.
*/
@PropertyDefinition
private String _jmsEntitlementTopic;
/**
* The name of the heartbeat topic, null if not used.
*/
@PropertyDefinition
private String _jmsHeartbeatTopic;
/**
* Creates an instance.
*/
protected LiveDataMetaData() {
}
/**
* Creates an instance.
*
* @param supportedSchemes the supported schemes, not null
* @param serverType the type of the server, not null
* @param description the user description, not null
*/
public LiveDataMetaData(List<ExternalScheme> supportedSchemes, LiveDataServerType serverType, String description) {
setSupportedSchemes(supportedSchemes);
setServerType(serverType);
setDescription(description);
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code LiveDataMetaData}.
* @return the meta-bean, not null
*/
public static LiveDataMetaData.Meta meta() {
return LiveDataMetaData.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(LiveDataMetaData.Meta.INSTANCE);
}
@Override
public LiveDataMetaData.Meta metaBean() {
return LiveDataMetaData.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the external identifier schemes that are supported, in order of preference.
* @return the value of the property, not null
*/
public List<ExternalScheme> getSupportedSchemes() {
return _supportedSchemes;
}
/**
* Sets the external identifier schemes that are supported, in order of preference.
* @param supportedSchemes the new value of the property, not null
*/
public void setSupportedSchemes(List<ExternalScheme> supportedSchemes) {
JodaBeanUtils.notNull(supportedSchemes, "supportedSchemes");
this._supportedSchemes.clear();
this._supportedSchemes.addAll(supportedSchemes);
}
/**
* Gets the the {@code supportedSchemes} property.
* @return the property, not null
*/
public final Property<List<ExternalScheme>> supportedSchemes() {
return metaBean().supportedSchemes().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the type of the live data server.
* @return the value of the property, not null
*/
public LiveDataServerType getServerType() {
return _serverType;
}
/**
* Sets the type of the live data server.
* @param serverType the new value of the property, not null
*/
public void setServerType(LiveDataServerType serverType) {
JodaBeanUtils.notNull(serverType, "serverType");
this._serverType = serverType;
}
/**
* Gets the the {@code serverType} property.
* @return the property, not null
*/
public final Property<LiveDataServerType> serverType() {
return metaBean().serverType().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the description, which could be for end-users.
* @return the value of the property, not null
*/
public String getDescription() {
return _description;
}
/**
* Sets the description, which could be for end-users.
* @param description the new value of the property, not null
*/
public void setDescription(String description) {
JodaBeanUtils.notNull(description, "description");
this._description = description;
}
/**
* Gets the the {@code description} property.
* @return the property, not null
*/
public final Property<String> description() {
return metaBean().description().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the server URI that the client connects to, null if not used.
* This may be a socket, JMS, REST or something else, depending on the server type.
* @return the value of the property
*/
public URI getConnectionUri() {
return _connectionUri;
}
/**
* Sets the server URI that the client connects to, null if not used.
* This may be a socket, JMS, REST or something else, depending on the server type.
* @param connectionUri the new value of the property
*/
public void setConnectionUri(URI connectionUri) {
this._connectionUri = connectionUri;
}
/**
* Gets the the {@code connectionUri} property.
* This may be a socket, JMS, REST or something else, depending on the server type.
* @return the property, not null
*/
public final Property<URI> connectionUri() {
return metaBean().connectionUri().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the URI of the JMS broker that the server uses, null if not used.
* @return the value of the property
*/
public URI getJmsBrokerUri() {
return _jmsBrokerUri;
}
/**
* Sets the URI of the JMS broker that the server uses, null if not used.
* @param jmsBrokerUri the new value of the property
*/
public void setJmsBrokerUri(URI jmsBrokerUri) {
this._jmsBrokerUri = jmsBrokerUri;
}
/**
* Gets the the {@code jmsBrokerUri} property.
* @return the property, not null
*/
public final Property<URI> jmsBrokerUri() {
return metaBean().jmsBrokerUri().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the name of the subscription topic, null if not used.
*
* @deprecated replaced by jmsSubscriptionQueue, kept in place until clients have been migrated
* @return the value of the property
*/
@Deprecated
public String getJmsSubscriptionTopic() {
return _jmsSubscriptionTopic;
}
/**
* Sets the name of the subscription topic, null if not used.
*
* @deprecated replaced by jmsSubscriptionQueue, kept in place until clients have been migrated
* @param jmsSubscriptionTopic the new value of the property
*/
@Deprecated
public void setJmsSubscriptionTopic(String jmsSubscriptionTopic) {
this._jmsSubscriptionTopic = jmsSubscriptionTopic;
}
/**
* Gets the the {@code jmsSubscriptionTopic} property.
*
* @deprecated replaced by jmsSubscriptionQueue, kept in place until clients have been migrated
* @return the property, not null
*/
@Deprecated
public final Property<String> jmsSubscriptionTopic() {
return metaBean().jmsSubscriptionTopic().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the name of the subscription queue, null if not used.
* @return the value of the property
*/
public String getJmsSubscriptionQueue() {
return _jmsSubscriptionQueue;
}
/**
* Sets the name of the subscription queue, null if not used.
* @param jmsSubscriptionQueue the new value of the property
*/
public void setJmsSubscriptionQueue(String jmsSubscriptionQueue) {
this._jmsSubscriptionQueue = jmsSubscriptionQueue;
}
/**
* Gets the the {@code jmsSubscriptionQueue} property.
* @return the property, not null
*/
public final Property<String> jmsSubscriptionQueue() {
return metaBean().jmsSubscriptionQueue().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the name of the entitlement topic, null if not used.
* @return the value of the property
*/
public String getJmsEntitlementTopic() {
return _jmsEntitlementTopic;
}
/**
* Sets the name of the entitlement topic, null if not used.
* @param jmsEntitlementTopic the new value of the property
*/
public void setJmsEntitlementTopic(String jmsEntitlementTopic) {
this._jmsEntitlementTopic = jmsEntitlementTopic;
}
/**
* Gets the the {@code jmsEntitlementTopic} property.
* @return the property, not null
*/
public final Property<String> jmsEntitlementTopic() {
return metaBean().jmsEntitlementTopic().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the name of the heartbeat topic, null if not used.
* @return the value of the property
*/
public String getJmsHeartbeatTopic() {
return _jmsHeartbeatTopic;
}
/**
* Sets the name of the heartbeat topic, null if not used.
* @param jmsHeartbeatTopic the new value of the property
*/
public void setJmsHeartbeatTopic(String jmsHeartbeatTopic) {
this._jmsHeartbeatTopic = jmsHeartbeatTopic;
}
/**
* Gets the the {@code jmsHeartbeatTopic} property.
* @return the property, not null
*/
public final Property<String> jmsHeartbeatTopic() {
return metaBean().jmsHeartbeatTopic().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public LiveDataMetaData clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
LiveDataMetaData other = (LiveDataMetaData) obj;
return JodaBeanUtils.equal(getSupportedSchemes(), other.getSupportedSchemes()) &&
JodaBeanUtils.equal(getServerType(), other.getServerType()) &&
JodaBeanUtils.equal(getDescription(), other.getDescription()) &&
JodaBeanUtils.equal(getConnectionUri(), other.getConnectionUri()) &&
JodaBeanUtils.equal(getJmsBrokerUri(), other.getJmsBrokerUri()) &&
JodaBeanUtils.equal(getJmsSubscriptionTopic(), other.getJmsSubscriptionTopic()) &&
JodaBeanUtils.equal(getJmsSubscriptionQueue(), other.getJmsSubscriptionQueue()) &&
JodaBeanUtils.equal(getJmsEntitlementTopic(), other.getJmsEntitlementTopic()) &&
JodaBeanUtils.equal(getJmsHeartbeatTopic(), other.getJmsHeartbeatTopic());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getSupportedSchemes());
hash = hash * 31 + JodaBeanUtils.hashCode(getServerType());
hash = hash * 31 + JodaBeanUtils.hashCode(getDescription());
hash = hash * 31 + JodaBeanUtils.hashCode(getConnectionUri());
hash = hash * 31 + JodaBeanUtils.hashCode(getJmsBrokerUri());
hash = hash * 31 + JodaBeanUtils.hashCode(getJmsSubscriptionTopic());
hash = hash * 31 + JodaBeanUtils.hashCode(getJmsSubscriptionQueue());
hash = hash * 31 + JodaBeanUtils.hashCode(getJmsEntitlementTopic());
hash = hash * 31 + JodaBeanUtils.hashCode(getJmsHeartbeatTopic());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(320);
buf.append("LiveDataMetaData{");
int len = buf.length();
toString(buf);
if (buf.length() > len) {
buf.setLength(buf.length() - 2);
}
buf.append('}');
return buf.toString();
}
protected void toString(StringBuilder buf) {
buf.append("supportedSchemes").append('=').append(JodaBeanUtils.toString(getSupportedSchemes())).append(',').append(' ');
buf.append("serverType").append('=').append(JodaBeanUtils.toString(getServerType())).append(',').append(' ');
buf.append("description").append('=').append(JodaBeanUtils.toString(getDescription())).append(',').append(' ');
buf.append("connectionUri").append('=').append(JodaBeanUtils.toString(getConnectionUri())).append(',').append(' ');
buf.append("jmsBrokerUri").append('=').append(JodaBeanUtils.toString(getJmsBrokerUri())).append(',').append(' ');
buf.append("jmsSubscriptionTopic").append('=').append(JodaBeanUtils.toString(getJmsSubscriptionTopic())).append(',').append(' ');
buf.append("jmsSubscriptionQueue").append('=').append(JodaBeanUtils.toString(getJmsSubscriptionQueue())).append(',').append(' ');
buf.append("jmsEntitlementTopic").append('=').append(JodaBeanUtils.toString(getJmsEntitlementTopic())).append(',').append(' ');
buf.append("jmsHeartbeatTopic").append('=').append(JodaBeanUtils.toString(getJmsHeartbeatTopic())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code LiveDataMetaData}.
*/
public static class Meta extends DirectMetaBean {
/**
* The singleton instance of the meta-bean.
*/
static final Meta INSTANCE = new Meta();
/**
* The meta-property for the {@code supportedSchemes} property.
*/
@SuppressWarnings({"unchecked", "rawtypes" })
private final MetaProperty<List<ExternalScheme>> _supportedSchemes = DirectMetaProperty.ofReadWrite(
this, "supportedSchemes", LiveDataMetaData.class, (Class) List.class);
/**
* The meta-property for the {@code serverType} property.
*/
private final MetaProperty<LiveDataServerType> _serverType = DirectMetaProperty.ofReadWrite(
this, "serverType", LiveDataMetaData.class, LiveDataServerType.class);
/**
* The meta-property for the {@code description} property.
*/
private final MetaProperty<String> _description = DirectMetaProperty.ofReadWrite(
this, "description", LiveDataMetaData.class, String.class);
/**
* The meta-property for the {@code connectionUri} property.
*/
private final MetaProperty<URI> _connectionUri = DirectMetaProperty.ofReadWrite(
this, "connectionUri", LiveDataMetaData.class, URI.class);
/**
* The meta-property for the {@code jmsBrokerUri} property.
*/
private final MetaProperty<URI> _jmsBrokerUri = DirectMetaProperty.ofReadWrite(
this, "jmsBrokerUri", LiveDataMetaData.class, URI.class);
/**
* The meta-property for the {@code jmsSubscriptionTopic} property.
*/
private final MetaProperty<String> _jmsSubscriptionTopic = DirectMetaProperty.ofReadWrite(
this, "jmsSubscriptionTopic", LiveDataMetaData.class, String.class);
/**
* The meta-property for the {@code jmsSubscriptionQueue} property.
*/
private final MetaProperty<String> _jmsSubscriptionQueue = DirectMetaProperty.ofReadWrite(
this, "jmsSubscriptionQueue", LiveDataMetaData.class, String.class);
/**
* The meta-property for the {@code jmsEntitlementTopic} property.
*/
private final MetaProperty<String> _jmsEntitlementTopic = DirectMetaProperty.ofReadWrite(
this, "jmsEntitlementTopic", LiveDataMetaData.class, String.class);
/**
* The meta-property for the {@code jmsHeartbeatTopic} property.
*/
private final MetaProperty<String> _jmsHeartbeatTopic = DirectMetaProperty.ofReadWrite(
this, "jmsHeartbeatTopic", LiveDataMetaData.class, String.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"supportedSchemes",
"serverType",
"description",
"connectionUri",
"jmsBrokerUri",
"jmsSubscriptionTopic",
"jmsSubscriptionQueue",
"jmsEntitlementTopic",
"jmsHeartbeatTopic");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case -842906912: // supportedSchemes
return _supportedSchemes;
case -1825908451: // serverType
return _serverType;
case -1724546052: // description
return _description;
case -513214034: // connectionUri
return _connectionUri;
case 2047189283: // jmsBrokerUri
return _jmsBrokerUri;
case -102439838: // jmsSubscriptionTopic
return _jmsSubscriptionTopic;
case -105041852: // jmsSubscriptionQueue
return _jmsSubscriptionQueue;
case -59808846: // jmsEntitlementTopic
return _jmsEntitlementTopic;
case -326199997: // jmsHeartbeatTopic
return _jmsHeartbeatTopic;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends LiveDataMetaData> builder() {
return new DirectBeanBuilder<LiveDataMetaData>(new LiveDataMetaData());
}
@Override
public Class<? extends LiveDataMetaData> beanType() {
return LiveDataMetaData.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code supportedSchemes} property.
* @return the meta-property, not null
*/
public final MetaProperty<List<ExternalScheme>> supportedSchemes() {
return _supportedSchemes;
}
/**
* The meta-property for the {@code serverType} property.
* @return the meta-property, not null
*/
public final MetaProperty<LiveDataServerType> serverType() {
return _serverType;
}
/**
* The meta-property for the {@code description} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> description() {
return _description;
}
/**
* The meta-property for the {@code connectionUri} property.
* @return the meta-property, not null
*/
public final MetaProperty<URI> connectionUri() {
return _connectionUri;
}
/**
* The meta-property for the {@code jmsBrokerUri} property.
* @return the meta-property, not null
*/
public final MetaProperty<URI> jmsBrokerUri() {
return _jmsBrokerUri;
}
/**
* The meta-property for the {@code jmsSubscriptionTopic} property.
* @deprecated replaced by jmsSubscriptionQueue, kept in place until clients have been migrated
* @return the meta-property, not null
*/
@Deprecated
public final MetaProperty<String> jmsSubscriptionTopic() {
return _jmsSubscriptionTopic;
}
/**
* The meta-property for the {@code jmsSubscriptionQueue} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> jmsSubscriptionQueue() {
return _jmsSubscriptionQueue;
}
/**
* The meta-property for the {@code jmsEntitlementTopic} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> jmsEntitlementTopic() {
return _jmsEntitlementTopic;
}
/**
* The meta-property for the {@code jmsHeartbeatTopic} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> jmsHeartbeatTopic() {
return _jmsHeartbeatTopic;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case -842906912: // supportedSchemes
return ((LiveDataMetaData) bean).getSupportedSchemes();
case -1825908451: // serverType
return ((LiveDataMetaData) bean).getServerType();
case -1724546052: // description
return ((LiveDataMetaData) bean).getDescription();
case -513214034: // connectionUri
return ((LiveDataMetaData) bean).getConnectionUri();
case 2047189283: // jmsBrokerUri
return ((LiveDataMetaData) bean).getJmsBrokerUri();
case -102439838: // jmsSubscriptionTopic
return ((LiveDataMetaData) bean).getJmsSubscriptionTopic();
case -105041852: // jmsSubscriptionQueue
return ((LiveDataMetaData) bean).getJmsSubscriptionQueue();
case -59808846: // jmsEntitlementTopic
return ((LiveDataMetaData) bean).getJmsEntitlementTopic();
case -326199997: // jmsHeartbeatTopic
return ((LiveDataMetaData) bean).getJmsHeartbeatTopic();
}
return super.propertyGet(bean, propertyName, quiet);
}
@SuppressWarnings("unchecked")
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case -842906912: // supportedSchemes
((LiveDataMetaData) bean).setSupportedSchemes((List<ExternalScheme>) newValue);
return;
case -1825908451: // serverType
((LiveDataMetaData) bean).setServerType((LiveDataServerType) newValue);
return;
case -1724546052: // description
((LiveDataMetaData) bean).setDescription((String) newValue);
return;
case -513214034: // connectionUri
((LiveDataMetaData) bean).setConnectionUri((URI) newValue);
return;
case 2047189283: // jmsBrokerUri
((LiveDataMetaData) bean).setJmsBrokerUri((URI) newValue);
return;
case -102439838: // jmsSubscriptionTopic
((LiveDataMetaData) bean).setJmsSubscriptionTopic((String) newValue);
return;
case -105041852: // jmsSubscriptionQueue
((LiveDataMetaData) bean).setJmsSubscriptionQueue((String) newValue);
return;
case -59808846: // jmsEntitlementTopic
((LiveDataMetaData) bean).setJmsEntitlementTopic((String) newValue);
return;
case -326199997: // jmsHeartbeatTopic
((LiveDataMetaData) bean).setJmsHeartbeatTopic((String) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
@Override
protected void validate(Bean bean) {
JodaBeanUtils.notNull(((LiveDataMetaData) bean)._supportedSchemes, "supportedSchemes");
JodaBeanUtils.notNull(((LiveDataMetaData) bean)._serverType, "serverType");
JodaBeanUtils.notNull(((LiveDataMetaData) bean)._description, "description");
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}