當前位置: 首頁>>代碼示例>>Java>>正文


Java DataSource類代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:sensiasoft,項目名稱:sensorhub,代碼行數:55,代碼來源:SOSService.java

示例2: getDataSource

import org.vast.cdm.common.DataSource; //導入依賴的package包/類
public DataSource getDataSource()
{
    return dataSource;
}
 
開發者ID:sensiasoft,項目名稱:lib-swe-common,代碼行數:5,代碼來源:SWEData.java

示例3: setDataSource

import org.vast.cdm.common.DataSource; //導入依賴的package包/類
public void setDataSource(DataSource dataSource)
{
    this.dataSource = dataSource;
}
 
開發者ID:sensiasoft,項目名稱:lib-swe-common,代碼行數:5,代碼來源:SWEData.java

示例4: getResultDataSource

import org.vast.cdm.common.DataSource; //導入依賴的package包/類
public DataSource getResultDataSource()
{
    return resultDataSource;
}
 
開發者ID:sensiasoft,項目名稱:lib-ows,代碼行數:5,代碼來源:InsertResultRequest.java

示例5: setResultDataSource

import org.vast.cdm.common.DataSource; //導入依賴的package包/類
public void setResultDataSource(DataSource resultDataSource)
{
    this.resultDataSource = resultDataSource;
}
 
開發者ID:sensiasoft,項目名稱:lib-ows,代碼行數:5,代碼來源:InsertResultRequest.java


注:本文中的org.vast.cdm.common.DataSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。