Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
3d3be408
Commit
3d3be408
authored
7 years ago
by
ashutoshm
Committed by
Madhan Neethiraj
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1968: updated import documentation for fileName option usage
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
02e4e86b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
7 deletions
+41
-7
Import-API-Options.twiki
docs/src/site/twiki/Import-API-Options.twiki
+22
-0
Import-API.twiki
docs/src/site/twiki/Import-API.twiki
+3
-3
AtlasImportRequest.java
...ava/org/apache/atlas/model/impexp/AtlasImportRequest.java
+15
-3
ImportService.java
...ava/org/apache/atlas/repository/impexp/ImportService.java
+1
-1
No files found.
docs/src/site/twiki/Import-API-Options.twiki
View file @
3d3be408
...
...
@@ -111,3 +111,25 @@ To use the option, set the contents of _importOptions.json_ to:
}
}
</verbatim>
---++++ Specifying File to be Imported From Server Location
In scenario where the file to be imported is present at a location on the server, the _importfile_ API can be used. It behaves like the Import API.
To use the option, set the contents of _importOptions.json_ to:
<verbatim>
{
"options": {
"fileName": "/root/fileToBeImported.zip"
}
}
</verbatim>
_CURL_
<verbatim>
curl -g -X POST -u adminuser:password -H "Content-Type: application/json"
-H "Cache-Control: no-cache"
-d r@importOptions.json
"http://localhost:21000/api/atlas/admin/importfile"
</verbatim>
This diff is collapsed.
Click to expand it.
docs/src/site/twiki/Import-API.twiki
View file @
3d3be408
...
...
@@ -24,7 +24,7 @@ The general approach is:
| _Description_|Provide the path of the file to be imported.|
| _URL_ |_api/atlas/admin/importfile_ |
| _Method_ |_POST_ |
| _URL Parameters_ |_
?FILENAME=<path of file>_ Specify the options as name-value pairs. Use _FILENAME_ to specify the file path.
|
| _URL Parameters_ |_
None_
|
| _Data Parameters_|_None_|
| _Success Response_ | _!AtlasImporResult_ is returned as JSON. See details below.|
|_Error Response_|Errors that are handled within the system will be returned as _!AtlasBaseException_. |
...
...
@@ -68,8 +68,8 @@ curl -g -X POST -u adminuser:password -H "Content-Type: multipart/form-data"
The call below performs Import of _!QuickStart_ database using a ZIP file available on server.
<verbatim>
curl -X POST -u adminuser:password -H "Cache-Control: no-cache"
"http://localhost:21000/api/atlas/admin/importFile
?FILENAME=/root/quickStartDB.zip
" > quickStartDB-import-result.json
curl -X POST -u adminuser:password -H "Cache-Control: no-cache"
-d ./importOptions.json
"http://localhost:21000/api/atlas/admin/importFile" > quickStartDB-import-result.json
</verbatim>
Below is the _!AtlasImportResult_ JSON for an import that contains _hive_db_.
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/model/impexp/AtlasImportRequest.java
View file @
3d3be408
...
...
@@ -36,9 +36,11 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONL
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
AtlasImportRequest
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
String
TRANSFORMS_KEY
=
"transforms"
;
private
static
final
String
START_POSITION_KEY
=
"startPosition"
;
private
static
final
String
START_GUID_KEY
=
"startGuid"
;
public
static
final
String
TRANSFORMS_KEY
=
"transforms"
;
private
static
final
String
START_POSITION_KEY
=
"startPosition"
;
private
static
final
String
START_GUID_KEY
=
"startGuid"
;
private
static
final
String
FILE_NAME_KEY
=
"fileName"
;
private
static
final
String
UPDATE_TYPE_DEFINITION_KEY
=
"updateTypeDefinition"
;
private
Map
<
String
,
String
>
options
;
...
...
@@ -76,6 +78,16 @@ public class AtlasImportRequest implements Serializable {
}
@JsonIgnore
public
String
getFileName
()
{
return
getOptionForKey
(
FILE_NAME_KEY
);
}
@JsonIgnore
public
void
setFileName
(
String
fileName
)
{
setOption
(
FILE_NAME_KEY
,
fileName
);
}
@JsonIgnore
public
String
getStartPosition
()
{
return
getOptionForKey
(
START_POSITION_KEY
);
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/impexp/ImportService.java
View file @
3d3be408
...
...
@@ -99,7 +99,7 @@ public class ImportService {
public
AtlasImportResult
run
(
AtlasImportRequest
request
,
String
userName
,
String
hostName
,
String
requestingIP
)
throws
AtlasBaseException
{
String
fileName
=
(
String
)
request
.
get
Options
().
get
(
"FILENAME"
);
String
fileName
=
(
String
)
request
.
get
FileName
(
);
if
(
StringUtils
.
isBlank
(
fileName
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"FILENAME parameter not found"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment