...
Use Case Walkthrough
1. Deploying an Artifact
User builds their application jar the same way they build it today. They make a call to deploy their artifact (jar).A development team creates a project built on top of CDAP. Their CI build runs and produces a jar file. An administrator deploys the jar by making a REST call:
Code Block |
---|
POST /namespaces/default/artifacts/myapp --data-binary @myapp-1.0.0.jar |
CDAP opens the jar, figures out the artifact version based on the the bundle-version as in the artifact versionmanifest, figures out what apps, programs, datasets, and plugins are in the artifact, then stores the artifact on the filesystem and metadata in a table.
The user administrator can examine the metadata by making a call:
Code Block |
---|
GET /namespaces/default/artifacts/myapp/versions/1.0.0 { "name": "purchase", "version": "3.1.0", "meta": { "created": "1234567890000", ... }, "classes": { "apps": [ { "className": "co.cask.cdap.examples.myapp.MyApp", "properties": { "stream": { "name": "stream", "description": "The name of the stream to read from. Defaults to 'A'.", "type": "string", "required": false }, "table": { "name": "table", "description": "The name of the table to write to. Defaults to 'X'.", "type": "string", "required": false, }, "flowConfig": { "name": "flow", "description": "", "type": "config", "fields": { "reader": { "name": "reader", "description": "", "type": "config", "required": true, "fields": { "name": { "name": "name", "description": "The name of the reader plugin to use.", "type": "string", "required": true }, "properties": { "name": "properties", "description": "The properties needed by the chosen reader plugin.", "type": "plugin", "plugintype": "reader", "required": true } } }, "writer": { ... } } } } } ], "flowsplugins": [ ... ], { "flowlets": [ ... ], "plugins": [ { "name": "default", "type": "reader", "description": "Writes timestamp and body as two columns and expects the row key to come as a header in the stream event.", "className": "co.cask.cdap.examples.myapp.plugins.DefaultStreamReader", "configFieldName": "config", "properties": { "rowkey": { "name": "rowkey", "description": "The header that should be used as the row key to write to. Defaults to 'rowkey'.", "type": "string", "required": false } } } ], "flows": [ ... ], } } |
...
"flowlets": [ ... ],
"datasetModules": [ ... ]
}
} |
2. Creating an Application
The administrator notices there is an app 'co.cask.cdap.examples.myapp.MyApp' contained in the artifact. Based on the app properties, the admin gathers that it needs a config of the form:
Code Block |
---|
{
"stream": "A",
"table": "X",
"flow": {
"reader": {
"name": "<some plugin name>",
"properties": { <properties for plugins of type "reader"> }
},
"writer": { ... }
}
} |
He then makes a call to see what plugins of type 'reader' are available:
Code Block |
---|
GET /namespaces/default/plugintypes/reader
[
{
"type": "reader",
"name": "default",
"description": "Writes timestamp and body as two columns and expects the row key to come as a header in the stream event.",
"className": "co.cask.cdap.examples.myapp.plugins.DefaultStreamReader"
"artifact": {
"namespace": "default",
"name": "myapp",
"version": "1.0.0"
}
}
] |
It looks like there is only one plugin of type reader available. Another call gives more details about what that plugin requires:
Code Block |
---|
GET /namespaces/default/plugintypes/reader/plugins/default
[
{
"type": "reader",
"name": "default",
"description": "Writes timestamp and body as two columns and expects the row key to come as a header in the stream event.",
"className": "co.cask.cdap.examples.myapp.plugins.DefaultStreamReader",
"properties": {
"rowkey": {
"name": "rowkey",
"description": "The header that should be used as the row key to write to. Defaults to 'rowkey'.",
"type": "string",
"required": false
}
},
"artifact": {
"namespace": "default",
"name": "myapp",
"version": "1.0.0"
}
}
] |
contained in the artifact.
Users will still be able to deploy an app in one call. Suppose a user wants to deploy their application contained in myapp-1.0.0.jar. They make the same RESTful call they would today:
...