Tobi’s Blog

Gedanken zur Softwareentwicklung und anderes

Fukurama::Frame-Config

Der Erste Versuch, die Controllerkonfig für das Fukurama-Framework zu definieren. Jedes Plugin benötigt eine Fassade zur Kommunikation mit der allen anderen Plugins. Erst durch die Definition in der Konfig kann daraus eine Struktur erstellt werden. Durch diese Entkopplung muss der Controller einer Aktion nicht fix im Code definieren, wohin bei Erfolg oder Misserfolg geleitet wird. Somit kann man eine Controlleraktion beliebig oft wiederverwenden und auch in einen komplett anderen Kontext stellen, ohne sich verbiegen oder Code verdoppeln zu müssen.

Config file for a Fukurama-Plugin. Syntax can be extendet with plugins:


<plugin class="My::Class" type="[new|decorate|extend]" key="user">
type: new=a new plugin, decorate=this plugin decorates the interface of another plugin, extend=this plugin extends another plugin
key: the key to access the interface of this plugin. Only valid for type=new
the key=main is the main-controller, which is the root-point of all controller
class:which class is the facade of this plugin. (For type=decorate the facade-interface has to be exact the same)
<allowed_extends>
which other plugins can extend the extended plugin (without unknown side effects). Only valid for plugin-type extends.
<plugin class="Your::Class" version="1.2" [max_version="1.4"]/>
version:compatible since, max_version:max compatible version(optional)
class: you have to define the plugin directly with the classname, not the key, which can be non unique
</allowed_extends>
<relatives>
all relatives for this plugin
<pass plugin="user" [action="list"] url="user"/>
passes all urls, which are defined in this plugin, into this plugin-interface
if action is defined, then only the defined action incl. all nested actions would pass into this plugin, not all.
<use plugin="user"/>
Now you can use the public interface of another plugin in this plugin.
</relatives>
<interface>
is'nt allowed for type=decorate
for type=extend, you can overwrite existing actions add new
<action key="list" [url="list"] view="list">
bind an action to a view, which is defined in the plugin-facade-class, key and view doesn't have to be the same
if no url is given, this action is not available directly, but you can use it as nested action
you can use views multiple times, i.e. with other predefined parameters and different keys
<parameter>
Optional preset for parameters
<param name="id" type="[set|default]" value="-1"/>
You can set an default-value for optional parameter if there are not given or set any parameter directly
</parameter>
<nested>
optional: all allowed, nested actions
<action call="delete" url="delete" onsuccess="[stay|exit|return]" onerror="[stay|exit|return]" return_link_text="Back to List">
in this view, you can call the subview with the key "delete". To call "used" plugins, you can say youplugin:youraction
url: under which url this action is available
onsuccess/onerror: what should happen, when the view return success or on failure
stay:stay in this view, return:the nested view exit and fall back to this view, exit:the nested and this view exit an fall back to the next higher view
return_link_text:the text for the "back" link
<parameter>
optional:you can predefine default values for optional or set parameters for the called action
<param name="id" type="[set|default]" value="1"/>
</parameter>
</action>
</nested>
</action>
</interface>
</plugin>

The interface for a plugin-controller (a facade):

My::Class
sub my_first_view : View(obsolete_parameter:datatype,title:string;optional_parameter:datatype) {
	return boolean: true:success, false:error
}
sub my_first_public_method : Method(public|void|id:int) {
	see Fukurama::Class for interface-description
	Any public method is part of the plugin-interface, but only as Views() declared methods can be used as a view
}

Kommentar schreiben

XHTML: Sie können diese Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>