HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file pal.Assembly by barry
expand copy to clipboardexpand
uses App
uses data.String
uses pal.ProxyLoader

//data type for proxy loaders
data ProxyLoaderInfo {
	char tag[]
	ProxyLoader loader
}

data InterceptInfo {
	char rule[]
	char impl[]
	}

data UpdateInfo {
	char currentConfig[]
	String remConfigs[]
	String addConfigs[]
}

/*
 {"description" : "This interface offers support for deriving a set of compositional options for a given software system, by searching for all implementation variants of each interface. It also supports runtime adaptation between compositions and the injection of proxy and intercept components. "}
*/

interface Assembly {

	/*
	{ "@description" : "Constructor function which discovers the set of possible assemblies for a given 'main' component.",
		"main" : "Path to a compiled Dana component which implements the App interface.",
		"perceptionModule" : "A loaded Dana component which implements the pal.Perception interface." }
	*/
	Assembly(char main[], store AppParam params[], store IDC perceptionModule, opt store String interfaceExcludeList[], store String componentExcludeList[])
	
	/* { "@description" : "Gets a list of all valid assemblies of the software system being managed, where each assembly is identified with a unique string." } */
	String[] getConfigs()
	
	/*
	{ "@description" : "Changes the current assembly. The 'main' method of the assembled program is called the first time setConfig is called.",
		"conf" : "Identifier of the assembly to adapt to, which must be one previously returned by getConfigs()",
		"loaders" : "A set of proxy component loaders, to which the loading of a proxy is delegated during adaptation (see addProxy).",
		"@return" : "Returns true if adaptation was successful, false otherwise." }
	*/
	bool setConfig(char conf[], opt ProxyLoaderInfo loaders[])

	/* { "@description" : "Get the current config (the caller would usually already have this information, but may not do if setConfig() fails)." } */
	char[] getConfig()
	
	/* { "@description" : "Launches the main method of the program, blocking until that function completes." } */
	bool runApp(char launchPath[])

	/*
	{ "@description" : "Adds a new component to the pool of available alternatives. The component being added, and any new dependencies, must already be in the appropriate directory relative to the system it is being added to." }
	*/
	String[] addComponent(char path[])
	/*
	{ "@description" : "Removes an existing component from the pool of available alternatives. The currently selected composition must not be using this component)." }
	*/
	String[] remComponent(char path[])

	/*
	{ "@description" : "Updates an existing component to a new version. The component passed into this function must support the same provided interface type as its current version, but otherwise can have both implementation and sub-architecture changes. No other components that already exist in the running system, besides that passed as a parameter to this function, can have architecture changes of their own. The component being updated, and any new dependencies, must already be in the appropriate directory relative to the system being updated. The list of all configurations may be re-ordered following this operation, even if dependencies have not changed within the updated component.",
		"path" : "The specific component for which a new compiled version is now in the appropriate directory relative to the managed system.",
		"@return" : "Returns the configuration identifier that is now active (or null if the operation failed)." }
	*/
	UpdateInfo updComponent(char path[], opt ProxyLoaderInfo loaders[])

	/*
	{ "@description" : "Adds a proxy component for the given interface (which should be specified using its full package). New configuration options are generated which include the proxy component as an implementation of that interface. The actual loading of a proxy component is delegated to a proxy loader, and the 'proxyComponent', 'tag', and 'parameters' arguments to this function are all passed in to the proxy loader.",
		"@return" : "True if successful, false otherwise." }
	*/
	String[] addProxy(char forInterface[], char proxyComponent[], char tag[], char parameters[])

	/*
	{ "@description" : "Remove a previously-addedproxy component for the given interface (which should be specified using its full package). Configuration options which included this proxy component are removed from the set of available options.",
		"@return" : "True if successful, false otherwise." }
	*/
	String[] remProxy(char forInterface[], char proxyComponent[], char tag[], char parameters[])

	/*
	{ "@description" : "Adds an intercepting component at every instance of the given interface (which should be specified using its full package). A new instance of the intercepting component is loaded at each injection site. The intercepting component can either provide the same interface type as that being intercepted, or can provide the dynamic proxy interfaces lang.Proxy and lang.Morph. The intercepting component can also optionally implement pal.ProxyInfo to receive information about its injection site.",
		"@return" : "True if successful, false otherwise." }
	*/
	bool addIntercept(char intf[], char cmp[])
	
	/*
	{ "@description" : "Removes an existing interception rule, and all active interceptors of that rule.",
		"@return" : "True if successful, false otherwise." }
	*/
	bool remIntercept(char intf[], char cmp[])
	
	/*
	{ "@description" : "Gets the list of currently installed intercept rules.",
		"@return" : "True if successful, false otherwise." }
	*/
	InterceptInfo[] getIntercepts()

	/* { "@description" : "Disable printing of exceptions for the given components (specified as absolute paths)." } */
	void disableExceptions(store String paths[])

	}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n pal.Assembly.Assembly -m "reason for update" -u yourUsername
Version 1 (this version) by barry
Notes for this version: Standard Library Initialisation