copyData


URI

<dataprocessingJobs_uri>/copydata[.<format>]

支持的方法

GETPOSTHEAD

父资源

dataProcessingJobs

子资源

copyDataJob

介绍

copyData 资源表示拷贝数据作业根资源,列出所有可用的拷贝数据作业资源。

支持的方法:

支持的表述格式:RJSON、JSON、HTML、XML。

资源层次

HTTP 请求方法

对如下 URI 执行 HTTP 请求,以 rjson 输出格式为例加以说明,其中,supermapiserver 是服务器名。

http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.rjson

GET 请求

获取拷贝数据作业列表

响应结构

对 copyData 资源执行 GET 请求,在响应消息的实体主体里是一个拷贝数据资源描述集,其中单个资源描述的结构如下:

字段 类型 说明
id String 应用ID。
state SparkJobState 该任务的状态。包括执行状态、起止时间、耗时等。
setting SparkJobSetting 列举了任务配置的详细信息。

响应示例

对 copyData 资源执行 GET 请求,返回 rjson 格式的资源描述如下:

[

    {

        "id": "c5da4059_e6e2_4e0e_a34e_09ca4df62d72",

        "state": {

            "errorStackTrace": null,

            "endState": true,

            "startTime": 1544423610986,

            "endTime": 1544423686309,

            "publisherelapsedTime": 0,

            "runState": "FINISHED",

            "errorMsg": null,

            "elapsedTime": 72688

        },

        "setting": {

            "output": {

                "outputPath": null,

                "datasetName": "analystResult",

                "datasourceInfo": {

                    "dataBase": "iserver021",

                    "server": "192.168.120.21:2181",

                    "password": null,

                    "driver": null,

                    "openLinkTable": false,

                    "alias": null,

                    "engineType": "HBASE",

                    "exclusive": false,

                    "readOnly": false,

                    "user": null,

                    "connect": false

                },

                "type": "HBASE"

            },

            "args": null,

            "input": {

                "datasetNames": [

                    "samples_processing_newyorkZone_R",

                    "samples_processing_singleRegion_R",

                    "samples_processing_newyorkRoads_L"

                ],

                "datasetIndexSettings": [

                    {

                        "datasetName": "samples_processing_newyorkZone_R",

                        "buildPyramid": false,

                        "indexFieldNames": [

                            "Shape_Area"

                        ]

                    },

                    {

                        "datasetName": "samples_processing_singleRegion_R",

                        "buildPyramid": true,

                        "indexFieldNames": [

                            "SmUserID",

                            "SmArea"

                        ]

                    },

                    {

                        "datasetName": "samples_processing_newyorkRoads_L",

                        "buildPyramid": true,

                        "indexFieldNames": [

                            "name",

                            "type"

                        ]

                    }

                ]

            },

            "DEFAULT_MASTER_ADRESS": "local[*] ",

            "referToken": "6Ut0ie-7OxwqW8UGDworIUS1tGgTPJ1iHQTpjs0XiAsY9iNOk2vu1BghOyBdszaYyC0A3hjIbzyEStl1nUMvKg..",

            "mainClass": null,

            "sparkLogFile": null,

            "appName": null,

            "contextSetting": null,

            "serviceInfo": {

                "targetDataPath": null,

                "targetServiceInfos": null

            },

            "referServicesAddress": "http://localhost:8090/iserver"

        }

    },

    {

        "id": "b5201533_8c54_4803_a3e2_426f190b64a9",

        "state": {

            "errorStackTrace": null,

            "endState": true,

            "startTime": 1544424266266,

            "endTime": 1544424283154,

            "publisherelapsedTime": 0,

            "runState": "FINISHED",

            "errorMsg": null,

            "elapsedTime": 15202

        },

        "setting": {

            "output": {

                "outputPath": null,

                "datasetName": "analystResult",

                "datasourceInfo": {

                    "dataBase": "iserver020",

                    "server": "localhost:2181",

                    "password": "",

                    "driver": null,

                    "openLinkTable": false,

                    "alias": "hbase",

                    "engineType": "HBASE",

                    "exclusive": false,

                    "readOnly": false,

                    "user": "",

                    "connect": false

                },

                "type": "HBASE"

            },

            "args": null,

            "input": {

                "datasetNames": [

                    "newyorkZone_R"

                ],

                "copyDataType": "UDB",

                "dataPath": "F:\\01_package\\ProcessingData\\processing.udb"

            },

            "DEFAULT_MASTER_ADRESS": "local[*] ",

            "referToken": "6Ut0ie-7OxwqW8UGDworIUS1tGgTPJ1iHQTpjs0XiAsY9iNOk2vu1BghOyBdszaYyC0A3hjIbzyEStl1nUMvKg..",

            "mainClass": null,

            "sparkLogFile": null,

            "appName": null,

            "contextSetting": null,

            "serviceInfo": {

                "targetDataPath": null,

                "targetServiceInfos": null

            },

            "referServicesAddress": "http://localhost:8090/iserver"

        }

    }

]

POST 请求

创建一个拷贝数据任务

请求参数

对 copyData 资源执行 POST 请求,创建一个拷贝数据任务,请求体需包含参数如下:

名称 类型 含义
input CopyDatasetInputSetting 支持以下输入参数且对数据集支持批量输入,其中包含以下字段:
  • 数据集输入设置,当输入数据是一个已注册的UDB数据集时,用该设置。其中包含如下字段
    • datasetNames:数据集名称。可设置多个数据集,使用逗号“,”隔开。【必填参数】
    • datasetIndexSettings:数据集字段索引设置类。可设置多个数据集。【选填参数】。
      • datasetName:创建索引字段的数据集名称
      • indexFieldNames:待创建的索引字段。可多选。【非时间属性字段
      • buildPyramid:是否创建矢量金字塔。默认为false。
CopyFileDataInputSetting
  • 数据集信息输入设置,当输入本地数据集文件时,用该设置。其中包含如下字段
    • datasetNames:数据集名称。选填参数。可设置多个数据集,使用逗号“,”隔开。若不设置该参数,默认输入全部数据集。当前仅支持地理坐标系。
    • dataPath:源数据所在路径。可以是一个具体的UDB或者GDB地址,也可以是一个目录。
    • copyDataType:拷贝数据类型。支持UDB、GDB。
output  DatabaseOutputSetting  结果输出到自定义目标数据库或已注册允许编辑的目标数据库时,其中包含以下字段【必填参数】:
  • type:目标数据库类型。只支持输出到HBASE目录。
  • datasourceInfo:结果数据源的连接信息。详细参数设定请参考:大数据分析输出参数设定

示例1:输入已注册的数据集到自定义目标数据库

对示例 copyData 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.json 以输入已注册的数据集,输出结果到自定义目标数据库形式执行POST 请求,创建一个拷贝数据任务。请求体中的参数如下:

{

    "input": {

        "datasetIndexSettings": [

            {

                "datasetName": "samples_processing_newyorkZone_R",

                "buildPyramid": false,

                "indexFieldNames": [

                    "Shape_Area"

                ]

            },

            {

                "datasetName": "samples_processing_singleRegion_R",

                "buildPyramid": true,

                "indexFieldNames": [

                    "SmUserID",

                    "SmArea"

                ]

            },

            {

                "datasetName": "samples_processing_newyorkRoads_L",

                "buildPyramid": true,

                "indexFieldNames": [

                    "name",

                    "type"

                ]

            }

        ],

        "datasetNames": [

            "samples_processing_newyorkZone_R",

            "samples_processing_singleRegion_R",

            "samples_processing_newyorkRoads_L"

        ]

    },

    "output": {

        "type": "HBASE",

        "datasourceInfo": {

            "dataBase": "iserver021",

            "server": "localhost:2181",

            "engineType": "HBASE"

        }

    }

}

返回 rjson 格式的操作结果表述如下:

{

    "postResultType": "CreateChild",

    "newResourceID": "2e6a9552_f956_4969_b56a_811060e86b09",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata/2e6a9552_f956_4969_b56a_811060e86b09"

}

示例2:输入数据集文件路径,输出到已注册的允许编辑的目标数据库

对示例 copyData 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.json 以输入数据集文件路径,输出结果到已注册允许编辑的目标数据库的形式执行POST 请求,创建一个拷贝数据任务。请求体中的参数如下:

{

    "input": {

        "datasetNames": [

            "newyorkZone_R"

        ],

        "dataPath": "F:\\data\\ProcessingData\\processing.udb",

        "copyDataType": "UDB"

    },

    "output": {

        "type": "HBASE",

        "datasourceInfo": {

            "dataBase": "iserver008",

            "server": "192.168.120.91:2181",

            "password": "",

            "driver": null,

            "openLinkTable": false,

            "alias": "Hbase",

            "engineType": "HBASE",

            "exclusive": false,

            "readOnly": false,

            "user": "",

            "connect": false

        }

    }

}

返回 rjson 格式的操作结果表述如下:

{

    "postResultType": "CreateChild",

    "newResourceID": "317cd0c8_d410_48cf_bdb1_f769f65d9959",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata/317cd0c8_d410_48cf_bdb1_f769f65d9959"

}

示例3:批量拷贝数据集到自定义的目标数据库

对示例 copyData 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.json 批量拷贝数据集到自定义的目标数据库的形式执行POST 请求,创建一个拷贝数据任务。请求体中的参数如下:

{

    "input": {

        "dataPath": "F:\\01_package\\20180822\\ProcessingData\\processing.udb",

        "copyDataType": "UDB"

    },

    "output": {

        "type": "HBASE",

        "datasourceInfo": {

            "dataBase": "iserver010",

            "server": "192.168.120.21:2181",

            "engineType": "HBASE"

        }

    }

}

返回 rjson 格式的操作结果表述如下:

{

    "postResultType": "CreateChild",

    "newResourceID": "694405aa_d41c_4ecc_a057_60a072e1be94",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata/694405aa_d41c_4ecc_a057_60a072e1be94"

}

HEAD 请求

返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。

HEAD 请求可以用来判断 copyData 资源是否存在,或者客户端是否有权限访问 copyData  资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 copyData 资源是否支持<format>格式的表述。

请参见