/** * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.component.factory.source; 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.impl.direct.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.component.ComponentInfo; import com.opengamma.component.ComponentRepository; import com.opengamma.component.factory.ComponentInfoAttributes; import com.opengamma.core.position.PositionSource; import com.opengamma.core.position.impl.DataPositionSourceResource; import com.opengamma.core.position.impl.NonVersionedRedisPositionSource; import com.opengamma.core.position.impl.RemotePositionSource; /** * */ @BeanDefinition public class NonVersionedRedisPositionSourceComponentFactory extends AbstractNonVersionedRedisSourceComponentFactory { @Override public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception { NonVersionedRedisPositionSource source = new NonVersionedRedisPositionSource(getRedisConnector().getJedisPool(), getRedisPrefix()); ComponentInfo positionSourceInfo = new ComponentInfo(PositionSource.class, getClassifier()); positionSourceInfo.addAttribute(ComponentInfoAttributes.LEVEL, 1); positionSourceInfo.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemotePositionSource.class); repo.registerComponent(positionSourceInfo, source); ComponentInfo redisSourceInfo = new ComponentInfo(NonVersionedRedisPositionSource.class, getClassifier()); redisSourceInfo.addAttribute(ComponentInfoAttributes.LEVEL, 1); repo.registerComponent(redisSourceInfo, source); if (isPublishRest()) { repo.getRestComponents().publish(positionSourceInfo, new DataPositionSourceResource(source)); } } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code NonVersionedRedisPositionSourceComponentFactory}. * @return the meta-bean, not null */ public static NonVersionedRedisPositionSourceComponentFactory.Meta meta() { return NonVersionedRedisPositionSourceComponentFactory.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(NonVersionedRedisPositionSourceComponentFactory.Meta.INSTANCE); } @Override public NonVersionedRedisPositionSourceComponentFactory.Meta metaBean() { return NonVersionedRedisPositionSourceComponentFactory.Meta.INSTANCE; } //----------------------------------------------------------------------- @Override public NonVersionedRedisPositionSourceComponentFactory clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { return super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(32); buf.append("NonVersionedRedisPositionSourceComponentFactory{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } @Override protected void toString(StringBuilder buf) { super.toString(buf); } //----------------------------------------------------------------------- /** * The meta-bean for {@code NonVersionedRedisPositionSourceComponentFactory}. */ public static class Meta extends AbstractNonVersionedRedisSourceComponentFactory.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap()); /** * Restricted constructor. */ protected Meta() { } @Override public BeanBuilder<? extends NonVersionedRedisPositionSourceComponentFactory> builder() { return new DirectBeanBuilder<NonVersionedRedisPositionSourceComponentFactory>(new NonVersionedRedisPositionSourceComponentFactory()); } @Override public Class<? extends NonVersionedRedisPositionSourceComponentFactory> beanType() { return NonVersionedRedisPositionSourceComponentFactory.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }