Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Use Cases:

User has configured a pipeline with multiple plugins , User wants to see the plugins used in the app along with programs, streams and datasets used by the pipeline when getting application detail.

User has configured DBSource plugin with macros for the fields "connectionString",  "username" and uses macro function secure for the "password" field. UI wants to get all the configured macro properties for that plugin, in this case "connectionString" and "username", so its easy for user to provide the values for those macros as runtime arguments before starting the run.

User Story:


1) User wants to see list of plugins in the app when calling application detail REST endpoint.
2) For a plugin, user wants to get the details on plugin, including plugin properties and list of macros used in properties.

3) UI wants to get properties macro used by a plugin.

Design:


 
class PluginDetail {
	String pluginName;
	String pluginType;
}
 
Example : PluginDetail {pluginName : "source1", pluginType: "DBSource"}

 

PluginDetail for plugins will be added to co.cask.cdap.proto.ApplicationDetail

public class ApplicationDetail {
  // existing
  private final String name;
  private final String version;
  private final String description;
  private final String configuration;
  private final List<StreamDetail> streams;
  private final List<DatasetDetail> datasets;
  private final List<ProgramRecord> programs;
  private final ArtifactSummary artifact;
  // new field
  private final List<PluginDetail> plugins;
}


REST Endpoint :

GET: /v3/namespaces/{namespace-id}/apps/{app-id}/plugins/{plugin-id}
 
{plugin-id} is unique in the app.
this will return JSON of PluginInfo object corresponding to the plugin-id. 
/**
 * Internal class used by REST API to provide plugin information and the macros used in the plugin.
 */
class PluginInfo {
  Plugin plugin;
  MacroInfo macroInfo;
}
// No changes to existing Plugin class in CDAP-API.
public final class Plugin {
  private final ArtifactId artifactId;
  private final PluginClass pluginClass;
  private final PluginProperties properties;
   Plugin(ArtifactId artifactId, PluginClass pluginClass, PluginProperties) {
	...
  }
  ...
}
// internal class
class MacroInfo {
 
  /* macro properties used at this plugin 
   * Examples : 
   * for the field value ${hostname}:${port}/${path}, the set would be[hostname, port, path]
   * for the field value ${key1:${key2}}, the set would be [key2, key1:${key2}]
   * for the field value \${u-name}, the set would be empty as macro is escaped    
   * for the field value ${key1\${key2}}, the set would be [key1\${key2}] so the user understands key2 is not a macro and will provide value for         the key, "key1${key2}"
   */
	Set<String> properties; 
	Set<MacroFunction> functions;
}


class MacroFunction {
	String functionName;
	List<String> arguments;
}

 

Notes:

MacroInfo object can be constructed by looking into plugin properties and for the fields which are macro enabled, we can use the parser to get the macros used in those fields.

Though the UI will only be interested in properties, having macro function information will be useful when getting details of a plugin.

 

 

  • No labels