本文整理匯總了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;
}