本文整理汇总了Java中org.vast.cdm.common.DataSource类的典型用法代码示例。如果您正苦于以下问题:Java DataSource类的具体用法?Java DataSource怎么用?Java DataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSource类属于org.vast.cdm.common包,在下文中一共展示了DataSource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleRequest
import org.vast.cdm.common.DataSource; //导入依赖的package包/类
@Override
protected void handleRequest(InsertResultRequest request) throws Exception
{
DataStreamParser parser = null;
checkTransactionalSupport(request);
String templateID = request.getTemplateId();
// retrieve consumer based on template id
ISOSDataConsumer consumer = (ISOSDataConsumer)getDataConsumerByTemplateID(templateID);
Template template = consumer.getTemplate(templateID);
DataComponent dataStructure = template.component;
DataEncoding encoding = template.encoding;
try
{
InputStream resultStream;
// select data source (either inline XML or in POST body for KVP)
DataSource dataSrc = request.getResultDataSource();
if (dataSrc instanceof DataSourceDOM) // inline XML
{
encoding = SWEHelper.ensureXmlCompatible(encoding);
resultStream = dataSrc.getDataStream();
}
else // POST body
{
resultStream = new BufferedInputStream(request.getHttpRequest().getInputStream());
}
// create parser
parser = SWEHelper.createDataParser(encoding);
parser.setDataComponents(dataStructure);
parser.setInput(resultStream);
// parse each record and send it to consumer
DataBlock nextBlock = null;
while ((nextBlock = parser.parseNextBlock()) != null)
consumer.newResultRecord(templateID, nextBlock);
// build and send response
InsertResultResponse resp = new InsertResultResponse();
sendResponse(request, resp);
}
catch (ReaderException e)
{
throw new SOSException("Error in SWE encoded data", e);
}
finally
{
if (parser != null)
parser.close();
}
}
示例2: getDataSource
import org.vast.cdm.common.DataSource; //导入依赖的package包/类
public DataSource getDataSource()
{
return dataSource;
}
示例3: setDataSource
import org.vast.cdm.common.DataSource; //导入依赖的package包/类
public void setDataSource(DataSource dataSource)
{
this.dataSource = dataSource;
}
示例4: getResultDataSource
import org.vast.cdm.common.DataSource; //导入依赖的package包/类
public DataSource getResultDataSource()
{
return resultDataSource;
}
示例5: setResultDataSource
import org.vast.cdm.common.DataSource; //导入依赖的package包/类
public void setResultDataSource(DataSource resultDataSource)
{
this.resultDataSource = resultDataSource;
}