本文整理汇总了Java中net.opengis.sensorml.v20.AbstractProcess类的典型用法代码示例。如果您正苦于以下问题:Java AbstractProcess类的具体用法?Java AbstractProcess怎么用?Java AbstractProcess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractProcess类属于net.opengis.sensorml.v20包,在下文中一共展示了AbstractProcess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateSensorML
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
/**
* Retrieves SensorML object for the given procedure unique ID
* @param uri
* @return
*/
protected AbstractProcess generateSensorML(String uri, TimeExtent timeExtent) throws ServiceException
{
try
{
ISOSDataProviderFactory factory = getDataProviderFactoryBySensorID(uri);
double time = Double.NaN;
if (timeExtent != null)
time = timeExtent.getBaseTime();
return factory.generateSensorMLDescription(time);
}
catch (Exception e)
{
throw new ServiceException("Error while retrieving SensorML description for sensor " + uri, e);
}
}
示例2: getSensorDescription
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
public AbstractProcess getSensorDescription(String sensorUID) throws SensorHubException
{
try
{
DescribeSensorRequest req = new DescribeSensorRequest();
req.setGetServer(grRequest.getGetServer());
req.setVersion(grRequest.getVersion());
req.setProcedureID(sensorUID);
InputStream is = sosUtils.sendGetRequest(req).getInputStream();
DOMHelper dom = new DOMHelper(new BufferedInputStream(is), false);
OWSExceptionReader.checkException(dom, dom.getBaseElement());
Element smlElt = dom.getElement("description/SensorDescription/data/*");
AbstractProcess smlDesc = new SMLUtils(SMLUtils.V2_0).readProcess(dom, smlElt);
log.debug("Retrieved sensor description for sensor {}", sensorUID);
return smlDesc;
}
catch (Exception e)
{
throw new SensorHubException("Cannot fetch SensorML description for sensor " + sensorUID);
}
}
示例3: updateSensorDescription
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
public void updateSensorDescription(AbstractProcess systemDesc, boolean recordHistory) throws SensorException
{
sensorDescription = systemDesc;
// generate output hashcodes to compare with insert result templates
structureToOutputMap.clear();
IOPropertyList outputList = sensorDescription.getOutputList();
for (int i = 0; i < outputList.size(); i++)
{
DataStructureHash hashObj = new DataStructureHash(outputList.getComponent(i), null);
structureToOutputMap.put(hashObj, outputList.getProperty(i).getName());
}
long unixTime = System.currentTimeMillis();
lastUpdatedSensorDescription = unixTime;
eventHandler.publishEvent(new SensorEvent(unixTime, this, SensorEvent.Type.SENSOR_CHANGED));
}
示例4: removeDataSourceDescriptionHistory
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
@Override
public void removeDataSourceDescriptionHistory(double startTime, double endTime)
{
Storage db = getStorage();
Iterator<AbstractProcess> it = descriptionTimeIndex.iterator(new Key(startTime), new Key(endTime), Index.ASCENT_ORDER);
while (it.hasNext())
{
AbstractProcess sml = it.next();
// get end of validity of process description
double endValidity = Double.NaN;
AbstractTimeGeometricPrimitive validTime = sml.getValidTimeList().get(0);
if (validTime instanceof TimePeriod)
endValidity = ((TimePeriod) validTime).getEndPosition().getDecimalValue();
// check that end of validity is also within time range
// if end of validity is now, endValidity will be NaN
// if this is the last description returned, don't remove it if end of validity is now
if (endValidity <= endTime || (Double.isNaN(endValidity) && it.hasNext()))
{
it.remove();
db.deallocate(sml);
}
}
}
示例5: ensureProducerInfo
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
protected void ensureProducerInfo(String producerID)
{
if (storage instanceof IMultiSourceStorage)
{
if (((IMultiSourceStorage<?>)storage).getProducerIDs().contains(producerID))
return;
IDataProducerModule<?> dataSource = dataSourceRef.get();
if (dataSource != null && dataSource instanceof IMultiSourceDataProducer)
{
// create producer data store
IBasicStorage dataStore = ((IMultiSourceStorage<IBasicStorage>)storage).addDataStore(producerID);
// save producer SensorML description if any
AbstractProcess sml = ((IMultiSourceDataProducer) dataSource).getCurrentDescription(producerID);
if (sml != null)
dataStore.storeDataSourceDescription(sml);
// create one data store for each sensor output
for (IStreamingDataInterface output: getSelectedOutputs(dataSource))
dataStore.addRecordStore(output.getName(), output.getRecordDescription(), output.getRecommendedEncoding());
}
}
}
示例6: getDataSourceDescriptionAtTime
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
@Override
public AbstractProcess getDataSourceDescriptionAtTime(double time)
{
for (AbstractProcess sml: dataSourceDescriptions)
{
AbstractTimeGeometricPrimitive validTime = sml.getValidTimeList().get(0);
if (validTime instanceof TimeInstant)
{
if (time == ((TimeInstant)validTime).getTimePosition().getDecimalValue())
return sml;
}
else if (validTime instanceof TimePeriod)
{
if (time >= ((TimePeriod)validTime).getBeginPosition().getDecimalValue() &&
time <= ((TimePeriod)validTime).getEndPosition().getDecimalValue())
return sml;
}
}
return null;
}
示例7: getConfiguredInstance
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
/**
* Generates a configured instance by copying I/Os definition from parent instance
* (if typeOf property is present), and applying configuration settings.
* @param process process with typeOf and configuration settings
* @param mergeMetadata if true, parent metadata will also be copied to the new instance
* @return new process instance with configuration values set
* @throws SMLException if configuration is invalid or cannot be applied
*/
public static AbstractProcess getConfiguredInstance(AbstractProcess process, boolean mergeMetadata) throws SMLException
{
AbstractProcess baseProcess = null;
// retrieve parent instance by resolving typeOf reference
String typeOfUrl = process.getTypeOf().getHref();
if (typeOfUrl != null)
{
// TODO load base process
// merge metadata
// apply config
Settings settings = (Settings)process.getConfiguration();
applyConfig(baseProcess, settings);
}
return baseProcess;
}
示例8: readAbstractProcess
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
/**
* Dispatcher method for reading elements derived from AbstractProcess
*/
public AbstractProcess readAbstractProcess(XMLStreamReader reader) throws XMLStreamException
{
String localName = reader.getName().getLocalPart();
if ("SimpleProcess".equals(localName))
return readSimpleProcess(reader);
else if ("PhysicalSystem".equals(localName))
return readPhysicalSystem(reader);
else if ("PhysicalComponent".equals(localName))
return readPhysicalComponent(reader);
else if ("AggregateProcess".equals(localName))
return readAggregateProcess(reader);
throw new XMLStreamException(ERROR_INVALID_ELT + reader.getName() + errorLocationString(reader));
}
示例9: readWriteCompareProcessXml
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
protected void readWriteCompareProcessXml(String path) throws Exception
{
SMLUtils smlUtils = new SMLUtils(SMLUtils.V2_0);
// read from file
InputStream is = getClass().getResourceAsStream(path);
AbstractProcess smlObj = smlUtils.readProcess(is);
is.close();
// write back to stdout and buffer
System.out.println();
ByteArrayOutputStream os = new ByteArrayOutputStream();
smlUtils.writeProcess(os, smlObj, false);
smlUtils.writeProcess(System.out, smlObj, true);
// compare with original
InputSource src1 = new InputSource(getClass().getResourceAsStream(path));
InputSource src2 = new InputSource(new ByteArrayInputStream(os.toByteArray()));
assertXMLEqual(src1, src2);
}
示例10: testGetSensorDesc
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
@Test
public void testGetSensorDesc() throws Exception
{
System.out.println();
AbstractProcess smlDesc = driver.getCurrentDescription();
new SMLUtils(SWEUtils.V2_0).writeProcess(System.out, smlDesc, true);
}
示例11: generateSensorMLDescription
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
@Override
public AbstractProcess generateSensorMLDescription(double time)
{
if (Double.isNaN(time))
return storage.getLatestDataSourceDescription();
else
return storage.getDataSourceDescriptionAtTime(time);
}
示例12: checkSensorML
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
protected void checkSensorML(AbstractProcess smlProcess, OWSExceptionReport report) throws Exception
{
String sensorUID = smlProcess.getUniqueIdentifier();
if (sensorUID == null || sensorUID.length() == 0)
throw new SOSException(SOSException.invalid_param_code, "procedureDescription", null, INVALID_SML_MSG + "Missing unique ID");
if (sensorUID.length() < 10)
report.add(new SOSException(SOSException.invalid_param_code, "procedureDescription", sensorUID, INVALID_SML_MSG + "Procedure unique ID is too short"));
if (procedureToOfferingMap.containsKey(smlProcess.getIdentifier()))
report.add(new SOSException(SOSException.invalid_param_code, "procedureDescription", sensorUID, INVALID_SML_MSG + "A procedure with unique ID " + sensorUID + " is already registered on this server"));
}
示例13: getCurrentDescription
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
@Override
public AbstractProcess getCurrentDescription(String entityID)
{
SMLHelper fac = new SMLHelper();
PhysicalComponent sensor = fac.newPhysicalComponent();
sensor.setUniqueIdentifier(entityID);
sensor.setName("Networked sensor " + entityID.substring(entityID.lastIndexOf(':')+1));
return sensor;
}
示例14: getLatestDataSourceDescription
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
@Override
public AbstractProcess getLatestDataSourceDescription()
{
Iterator<AbstractProcess> it = descriptionTimeIndex.iterator(KEY_SML_START_ALL_TIME, KEY_SML_END_ALL_TIME, Index.DESCENT_ORDER);
if (it.hasNext())
return it.next();
return null;
}
示例15: getDataSourceDescriptionAtTime
import net.opengis.sensorml.v20.AbstractProcess; //导入依赖的package包/类
@Override
public AbstractProcess getDataSourceDescriptionAtTime(double time)
{
Iterator<AbstractProcess> it = descriptionTimeIndex.iterator(KEY_SML_START_ALL_TIME, new Key(time), Index.DESCENT_ORDER);
if (it.hasNext())
return it.next();
return null;
}