Package com.opengamma.component.factory.tool

Source Code of com.opengamma.component.factory.tool.ConventionInstrumentTimeSeriesLoaderTool$Meta

/**
* Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.component.factory.tool;

import java.util.LinkedHashMap;
import java.util.Map;

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.DirectBeanBuilder;
import org.joda.beans.impl.direct.DirectMetaProperty;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;

import com.opengamma.component.ComponentRepository;
import com.opengamma.component.factory.AbstractComponentFactory;
import com.opengamma.core.historicaltimeseries.HistoricalTimeSeriesSource;
import com.opengamma.financial.convention.ConventionInstrumentTimeSeriesLoader;
import com.opengamma.id.ExternalScheme;
import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesLoader;

// TODO jonathan 2012-02-17 -- come back to this when we have some established way of using the component factory
// infrastructure to run 'tools'. Currently this is designed to sit at the end of an ini file where the tool will be
// run. It isn't a 'component factory' at all.

/**
* Component factory which runs the {@link ConventionInstrumentTimeSeriesLoader}.
*/
@BeanDefinition
public class ConventionInstrumentTimeSeriesLoaderTool extends AbstractComponentFactory {

  @PropertyDefinition(validate = "notNull")
  private HistoricalTimeSeriesSource _historicalTimeSeriesSource;
 
  @PropertyDefinition(validate = "notNull")
  private HistoricalTimeSeriesLoader _historicalTimeSeriesLoader;
 
  @PropertyDefinition(validate = "notNull")
  private String _dataSource;
 
  @PropertyDefinition(validate = "notNull")
  private String _dataProvider;
 
  @PropertyDefinition(validate = "notNull")
  private String _dataField;
 
  @PropertyDefinition(validate = "notNull")
  private String _identifierScheme;
 
  @PropertyDefinition
  private boolean _updateExisting;
 
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
    ConventionInstrumentTimeSeriesLoader loader = new ConventionInstrumentTimeSeriesLoader(
        getHistoricalTimeSeriesSource(), getHistoricalTimeSeriesLoader(), getDataSource(), getDataProvider(),
        getDataField(), ExternalScheme.of(getIdentifierScheme()), isUpdateExisting());
    loader.run();
   
    System.out.println("Convention instrument time-series loader completed");
    System.exit(0);
  }

  //------------------------- AUTOGENERATED START -------------------------
  ///CLOVER:OFF
  /**
   * The meta-bean for {@code ConventionInstrumentTimeSeriesLoaderTool}.
   * @return the meta-bean, not null
   */
  public static ConventionInstrumentTimeSeriesLoaderTool.Meta meta() {
    return ConventionInstrumentTimeSeriesLoaderTool.Meta.INSTANCE;
  }

  static {
    JodaBeanUtils.registerMetaBean(ConventionInstrumentTimeSeriesLoaderTool.Meta.INSTANCE);
  }

  @Override
  public ConventionInstrumentTimeSeriesLoaderTool.Meta metaBean() {
    return ConventionInstrumentTimeSeriesLoaderTool.Meta.INSTANCE;
  }

  @Override
  protected Object propertyGet(String propertyName, boolean quiet) {
    switch (propertyName.hashCode()) {
      case 358729161// historicalTimeSeriesSource
        return getHistoricalTimeSeriesSource();
      case 157715905// historicalTimeSeriesLoader
        return getHistoricalTimeSeriesLoader();
      case 1272470629// dataSource
        return getDataSource();
      case 339742651// dataProvider
        return getDataProvider();
      case -386794640// dataField
        return getDataField();
      case 144370606// identifierScheme
        return getIdentifierScheme();
      case -1252525708// updateExisting
        return isUpdateExisting();
    }
    return super.propertyGet(propertyName, quiet);
  }

  @Override
  protected void propertySet(String propertyName, Object newValue, boolean quiet) {
    switch (propertyName.hashCode()) {
      case 358729161// historicalTimeSeriesSource
        setHistoricalTimeSeriesSource((HistoricalTimeSeriesSource) newValue);
        return;
      case 157715905// historicalTimeSeriesLoader
        setHistoricalTimeSeriesLoader((HistoricalTimeSeriesLoader) newValue);
        return;
      case 1272470629// dataSource
        setDataSource((String) newValue);
        return;
      case 339742651// dataProvider
        setDataProvider((String) newValue);
        return;
      case -386794640// dataField
        setDataField((String) newValue);
        return;
      case 144370606// identifierScheme
        setIdentifierScheme((String) newValue);
        return;
      case -1252525708// updateExisting
        setUpdateExisting((Boolean) newValue);
        return;
    }
    super.propertySet(propertyName, newValue, quiet);
  }

  @Override
  protected void validate() {
    JodaBeanUtils.notNull(_historicalTimeSeriesSource, "historicalTimeSeriesSource");
    JodaBeanUtils.notNull(_historicalTimeSeriesLoader, "historicalTimeSeriesLoader");
    JodaBeanUtils.notNull(_dataSource, "dataSource");
    JodaBeanUtils.notNull(_dataProvider, "dataProvider");
    JodaBeanUtils.notNull(_dataField, "dataField");
    JodaBeanUtils.notNull(_identifierScheme, "identifierScheme");
    super.validate();
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if (obj != null && obj.getClass() == this.getClass()) {
      ConventionInstrumentTimeSeriesLoaderTool other = (ConventionInstrumentTimeSeriesLoaderTool) obj;
      return JodaBeanUtils.equal(getHistoricalTimeSeriesSource(), other.getHistoricalTimeSeriesSource()) &&
          JodaBeanUtils.equal(getHistoricalTimeSeriesLoader(), other.getHistoricalTimeSeriesLoader()) &&
          JodaBeanUtils.equal(getDataSource(), other.getDataSource()) &&
          JodaBeanUtils.equal(getDataProvider(), other.getDataProvider()) &&
          JodaBeanUtils.equal(getDataField(), other.getDataField()) &&
          JodaBeanUtils.equal(getIdentifierScheme(), other.getIdentifierScheme()) &&
          JodaBeanUtils.equal(isUpdateExisting(), other.isUpdateExisting()) &&
          super.equals(obj);
    }
    return false;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash += hash * 31 + JodaBeanUtils.hashCode(getHistoricalTimeSeriesSource());
    hash += hash * 31 + JodaBeanUtils.hashCode(getHistoricalTimeSeriesLoader());
    hash += hash * 31 + JodaBeanUtils.hashCode(getDataSource());
    hash += hash * 31 + JodaBeanUtils.hashCode(getDataProvider());
    hash += hash * 31 + JodaBeanUtils.hashCode(getDataField());
    hash += hash * 31 + JodaBeanUtils.hashCode(getIdentifierScheme());
    hash += hash * 31 + JodaBeanUtils.hashCode(isUpdateExisting());
    return hash ^ super.hashCode();
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the historicalTimeSeriesSource.
   * @return the value of the property, not null
   */
  public HistoricalTimeSeriesSource getHistoricalTimeSeriesSource() {
    return _historicalTimeSeriesSource;
  }

  /**
   * Sets the historicalTimeSeriesSource.
   * @param historicalTimeSeriesSource  the new value of the property, not null
   */
  public void setHistoricalTimeSeriesSource(HistoricalTimeSeriesSource historicalTimeSeriesSource) {
    JodaBeanUtils.notNull(historicalTimeSeriesSource, "historicalTimeSeriesSource");
    this._historicalTimeSeriesSource = historicalTimeSeriesSource;
  }

  /**
   * Gets the the {@code historicalTimeSeriesSource} property.
   * @return the property, not null
   */
  public final Property<HistoricalTimeSeriesSource> historicalTimeSeriesSource() {
    return metaBean().historicalTimeSeriesSource().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the historicalTimeSeriesLoader.
   * @return the value of the property, not null
   */
  public HistoricalTimeSeriesLoader getHistoricalTimeSeriesLoader() {
    return _historicalTimeSeriesLoader;
  }

  /**
   * Sets the historicalTimeSeriesLoader.
   * @param historicalTimeSeriesLoader  the new value of the property, not null
   */
  public void setHistoricalTimeSeriesLoader(HistoricalTimeSeriesLoader historicalTimeSeriesLoader) {
    JodaBeanUtils.notNull(historicalTimeSeriesLoader, "historicalTimeSeriesLoader");
    this._historicalTimeSeriesLoader = historicalTimeSeriesLoader;
  }

  /**
   * Gets the the {@code historicalTimeSeriesLoader} property.
   * @return the property, not null
   */
  public final Property<HistoricalTimeSeriesLoader> historicalTimeSeriesLoader() {
    return metaBean().historicalTimeSeriesLoader().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the dataSource.
   * @return the value of the property, not null
   */
  public String getDataSource() {
    return _dataSource;
  }

  /**
   * Sets the dataSource.
   * @param dataSource  the new value of the property, not null
   */
  public void setDataSource(String dataSource) {
    JodaBeanUtils.notNull(dataSource, "dataSource");
    this._dataSource = dataSource;
  }

  /**
   * Gets the the {@code dataSource} property.
   * @return the property, not null
   */
  public final Property<String> dataSource() {
    return metaBean().dataSource().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the dataProvider.
   * @return the value of the property, not null
   */
  public String getDataProvider() {
    return _dataProvider;
  }

  /**
   * Sets the dataProvider.
   * @param dataProvider  the new value of the property, not null
   */
  public void setDataProvider(String dataProvider) {
    JodaBeanUtils.notNull(dataProvider, "dataProvider");
    this._dataProvider = dataProvider;
  }

  /**
   * Gets the the {@code dataProvider} property.
   * @return the property, not null
   */
  public final Property<String> dataProvider() {
    return metaBean().dataProvider().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the dataField.
   * @return the value of the property, not null
   */
  public String getDataField() {
    return _dataField;
  }

  /**
   * Sets the dataField.
   * @param dataField  the new value of the property, not null
   */
  public void setDataField(String dataField) {
    JodaBeanUtils.notNull(dataField, "dataField");
    this._dataField = dataField;
  }

  /**
   * Gets the the {@code dataField} property.
   * @return the property, not null
   */
  public final Property<String> dataField() {
    return metaBean().dataField().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the identifierScheme.
   * @return the value of the property, not null
   */
  public String getIdentifierScheme() {
    return _identifierScheme;
  }

  /**
   * Sets the identifierScheme.
   * @param identifierScheme  the new value of the property, not null
   */
  public void setIdentifierScheme(String identifierScheme) {
    JodaBeanUtils.notNull(identifierScheme, "identifierScheme");
    this._identifierScheme = identifierScheme;
  }

  /**
   * Gets the the {@code identifierScheme} property.
   * @return the property, not null
   */
  public final Property<String> identifierScheme() {
    return metaBean().identifierScheme().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the updateExisting.
   * @return the value of the property
   */
  public boolean isUpdateExisting() {
    return _updateExisting;
  }

  /**
   * Sets the updateExisting.
   * @param updateExisting  the new value of the property
   */
  public void setUpdateExisting(boolean updateExisting) {
    this._updateExisting = updateExisting;
  }

  /**
   * Gets the the {@code updateExisting} property.
   * @return the property, not null
   */
  public final Property<Boolean> updateExisting() {
    return metaBean().updateExisting().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * The meta-bean for {@code ConventionInstrumentTimeSeriesLoaderTool}.
   */
  public static class Meta extends AbstractComponentFactory.Meta {
    /**
     * The singleton instance of the meta-bean.
     */
    static final Meta INSTANCE = new Meta();

    /**
     * The meta-property for the {@code historicalTimeSeriesSource} property.
     */
    private final MetaProperty<HistoricalTimeSeriesSource> _historicalTimeSeriesSource = DirectMetaProperty.ofReadWrite(
        this, "historicalTimeSeriesSource", ConventionInstrumentTimeSeriesLoaderTool.class, HistoricalTimeSeriesSource.class);
    /**
     * The meta-property for the {@code historicalTimeSeriesLoader} property.
     */
    private final MetaProperty<HistoricalTimeSeriesLoader> _historicalTimeSeriesLoader = DirectMetaProperty.ofReadWrite(
        this, "historicalTimeSeriesLoader", ConventionInstrumentTimeSeriesLoaderTool.class, HistoricalTimeSeriesLoader.class);
    /**
     * The meta-property for the {@code dataSource} property.
     */
    private final MetaProperty<String> _dataSource = DirectMetaProperty.ofReadWrite(
        this, "dataSource", ConventionInstrumentTimeSeriesLoaderTool.class, String.class);
    /**
     * The meta-property for the {@code dataProvider} property.
     */
    private final MetaProperty<String> _dataProvider = DirectMetaProperty.ofReadWrite(
        this, "dataProvider", ConventionInstrumentTimeSeriesLoaderTool.class, String.class);
    /**
     * The meta-property for the {@code dataField} property.
     */
    private final MetaProperty<String> _dataField = DirectMetaProperty.ofReadWrite(
        this, "dataField", ConventionInstrumentTimeSeriesLoaderTool.class, String.class);
    /**
     * The meta-property for the {@code identifierScheme} property.
     */
    private final MetaProperty<String> _identifierScheme = DirectMetaProperty.ofReadWrite(
        this, "identifierScheme", ConventionInstrumentTimeSeriesLoaderTool.class, String.class);
    /**
     * The meta-property for the {@code updateExisting} property.
     */
    private final MetaProperty<Boolean> _updateExisting = DirectMetaProperty.ofReadWrite(
        this, "updateExisting", ConventionInstrumentTimeSeriesLoaderTool.class, Boolean.TYPE);
    /**
     * The meta-properties.
     */
    private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
        this, (DirectMetaPropertyMap) super.metaPropertyMap(),
        "historicalTimeSeriesSource",
        "historicalTimeSeriesLoader",
        "dataSource",
        "dataProvider",
        "dataField",
        "identifierScheme",
        "updateExisting");

    /**
     * Restricted constructor.
     */
    protected Meta() {
    }

    @Override
    protected MetaProperty<?> metaPropertyGet(String propertyName) {
      switch (propertyName.hashCode()) {
        case 358729161// historicalTimeSeriesSource
          return _historicalTimeSeriesSource;
        case 157715905// historicalTimeSeriesLoader
          return _historicalTimeSeriesLoader;
        case 1272470629// dataSource
          return _dataSource;
        case 339742651// dataProvider
          return _dataProvider;
        case -386794640// dataField
          return _dataField;
        case 144370606// identifierScheme
          return _identifierScheme;
        case -1252525708// updateExisting
          return _updateExisting;
      }
      return super.metaPropertyGet(propertyName);
    }

    @Override
    public BeanBuilder<? extends ConventionInstrumentTimeSeriesLoaderTool> builder() {
      return new DirectBeanBuilder<ConventionInstrumentTimeSeriesLoaderTool>(new ConventionInstrumentTimeSeriesLoaderTool());
    }

    @Override
    public Class<? extends ConventionInstrumentTimeSeriesLoaderTool> beanType() {
      return ConventionInstrumentTimeSeriesLoaderTool.class;
    }

    @Override
    public Map<String, MetaProperty<?>> metaPropertyMap() {
      return _metaPropertyMap$;
    }

    //-----------------------------------------------------------------------
    /**
     * The meta-property for the {@code historicalTimeSeriesSource} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<HistoricalTimeSeriesSource> historicalTimeSeriesSource() {
      return _historicalTimeSeriesSource;
    }

    /**
     * The meta-property for the {@code historicalTimeSeriesLoader} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<HistoricalTimeSeriesLoader> historicalTimeSeriesLoader() {
      return _historicalTimeSeriesLoader;
    }

    /**
     * The meta-property for the {@code dataSource} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<String> dataSource() {
      return _dataSource;
    }

    /**
     * The meta-property for the {@code dataProvider} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<String> dataProvider() {
      return _dataProvider;
    }

    /**
     * The meta-property for the {@code dataField} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<String> dataField() {
      return _dataField;
    }

    /**
     * The meta-property for the {@code identifierScheme} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<String> identifierScheme() {
      return _identifierScheme;
    }

    /**
     * The meta-property for the {@code updateExisting} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<Boolean> updateExisting() {
      return _updateExisting;
    }

  }

  ///CLOVER:ON
  //-------------------------- AUTOGENERATED END --------------------------
}
TOP

Related Classes of com.opengamma.component.factory.tool.ConventionInstrumentTimeSeriesLoaderTool$Meta

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.