Issue #1491 add Geometry converter and move registry spring instantiation

Change-Id: I7794f41c637b5e29662356d81e172d3484e66a56

Former-commit-id: 94b52c4d617f15bb0bd8d460eb9c5ab6e1a201e6
This commit is contained in:
Matt Nash 2013-01-15 16:50:53 -06:00
parent c78078ee6e
commit b4f48078ca
4 changed files with 92 additions and 13 deletions

View file

@ -22,3 +22,4 @@ Require-Bundle: org.apache.commons.codec;bundle-version="1.4.0",
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
org.apache.http;bundle-version="4.1.2"
Import-Package: com.vividsolutions.jts.geom

View file

@ -0,0 +1,79 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.registry.ebxml.slots;
import java.util.ArrayList;
import java.util.List;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
import com.vividsolutions.jts.geom.Geometry;
/**
* Turns {@link Geometry} into Strings for storage in the registry
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 14, 2012 mnash Initial creation
*
* </pre>
*
* @author mnash
* @version 1.0
*/
public class GeometrySlotConverter implements SlotConverter {
public static final GeometrySlotConverter INSTANCE = new GeometrySlotConverter();
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.registry.ebxml.slots.SlotConverter#getSlots(java
* .lang.String, java.lang.Object)
*/
@Override
public List<SlotType> getSlots(String slotName, Object slotValue)
throws IllegalArgumentException {
List<SlotType> slots = new ArrayList<SlotType>();
if (slotValue instanceof Geometry) {
Geometry geom = (Geometry) slotValue;
SlotType slot = new SlotType();
StringValueType type = new StringValueType();
slot.setName(slotName);
type.setStringValue(geom.toText());
slot.setSlotValue(type);
slots.add(slot);
} else {
throw new IllegalArgumentException("Object of type "
+ slotValue.getClass().getName()
+ " cannot be converted by "
+ GeometrySlotConverter.class.getName());
}
return slots;
}
}

View file

@ -26,17 +26,4 @@
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="ebxmlSessionFactory" />
</bean>
<bean id="edexRegistryManager" class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager" />
<bean id="registryHandler" class="com.raytheon.uf.common.registry.ebxml.FactoryRegistryHandler">
<property name="txManager" ref="edexRegistryManager"/>
<property name="lcmFactory" ref="edexRegistryManager"/>
<property name="queryFactory" ref="edexRegistryManager"/>
</bean>
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
<constructor-arg ref="registryHandler" />
</bean>
</beans>

View file

@ -43,5 +43,17 @@
class="com.raytheon.uf.edex.registry.ebxml.services.cataloger.CatalogerImpl" >
<property name="registryObjectDao" ref="registryDao"/>
</bean>
<bean id="edexRegistryManager" class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager" />
<bean id="registryHandler" class="com.raytheon.uf.common.registry.ebxml.FactoryRegistryHandler">
<property name="txManager" ref="edexRegistryManager"/>
<property name="lcmFactory" ref="edexRegistryManager"/>
<property name="queryFactory" ref="edexRegistryManager"/>
</bean>
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
<constructor-arg ref="registryHandler" />
</bean>
</beans>