/*
Q1: do we want third-parties to create decorators?
S: yes it may be possible, preferably as components
J: why not?
R: no
A: essentially no, third-parties provide SDK and decorators available there can be used in the components
Standa: no
G: yes
---------
no decision yet, but taking into account
*/
/*
Q2: who creates them, for now it is source component (CreateDecoratedOutputItem(outputItem, inputItem)
S: define an interface, IDecoratorFactory component and exchange item may decide to implement it when they need
J: --||--||--
R: source component
A: any possible way, preferably IExchangeItem, we always instantiate decorators from IExchangeItem.Create/whatever
Standa: source component
G: IDecoratorFactory, but note that only ILinkableComponent (and/or IExchangeItem) will asked by the gui if it implements it
*/
*
---------------------------
current solution (there will be quesions):
// query available/create
interface IDecoratorFactory
{
IIdentifiable[] GetAvailableDecorators(IExchangeItem item, IExchangeItem target);
IDescribable GetDecoratorDescription(IIdentifiable);
IOutputDecorator CreateOutputDecorator(IIdentifiable decoratorId, IOutputItem item, IExchangeItem target);
IInputDecorator CreateInputDecorator(IIdentifiable decoratorId, IInputItem item, IExchangeItem target);
}
interface ILinkableComponent
{
IDecoratorFactory GetDecoratorFactory();
}
NOTE: Remove input decorators for now!
-------------------------------------------
IExchangeItem
IExchangeItem.GetAvailableDecorators();
* request available decorators from component
ILinkableComponent.GetAvailableDecorator(IExchangeItem item);
* create using factory
IDecoratorFactory.GetAvailableDecorators(IExchangeItem item);
* create somewhere else, e.g.:
IOutputItem decorator = new MyCustomDecorator(outputItem);
interface IDecoratorFactory
{
IIdentifiable[] GetAvailableDecorators(IExchangeItem item, IExchangeItem target);
IDescribable GetDecoratorDescription(IIdentifiable);
IOutputDecorator CreateOutputDecorator(IIdentifiable decoratorId, IOutputItem item, IExchangeItem target);
IInputDecorator CreateInputDecorator(IIdentifiable decoratorId, IInputItem item, IExchangeItem target);
}
IExchangeItem
{
IDecoratorFactory GetDecoratorFactory();
}
if(component is IDecoratorFactory)
{
var factory = (IDecoratorFactory)excahngeItem;
}
/*
Q3: how can we re-use decorators!? inject them manually. It could be
Q3.1: inside the component (code)
S: we offer utilities to let the factories build decorators
J: yes, add/remove operations for decorator should be available
R: yes
A: no, if they are from third-parties, because the provider dictates what decorators are available
yes, if they're coming from the component
Standa: yes, if they're coming from the component
G: yes, when third-party decorators are injected - Component property will be set when decorator is added to the component.
Q3.2: during configuration (forced by user!)
S: just add them to the component.OutputItems (every created decorator will already have component)
J: --||--
R: add then not via OutputItems.Add() but using another way (which?), add method to linkable component which will re-create given decorators
A: having combination of Decorator.Id + exchange item being decorated
Standa: yes
G: yes
*/
*
ILinkableComponent.AddDecorator(IDecoratedOutputItem decorator)
ILinkableComponent.RemoveDecorator(IDecoratedOutputItem decorator)
ILinkableComponent.AddDecorator(IDecoratedInputItem decorator)
ILinkableComponent.RemoveDecorator(IDecoratedInputItem decorator)
* add via exchange item
IOutputItem.AddDecorator(IDecoratedOutputItem decorator)
IOutputItem.RemoveDecorator(IDecoratedOutputItem decorator)
IInputItem.AddDecorator(IDecoratedInputItem decorator)
IInputItem.RemoveDecorator(IDecoratedInputItem decorator)
Push/Pop (Add/Remove only at the end)
AddLast/RemoveLast (see LinkedList in .NET)
// add/remove
.....
/*
- how do we query them
- where from?
- how do we add/remove them
*/
public void CreateDecotarors()
{
ILinkableComponent sourceComponent = ...;
ILinkableComponent targetComponent = ...;
IOutputItem outputItem = sourceComponent.OutputItems[0];
IInputItem inputItem = targetComponent.InputItems[0];
IOutputItem decoratedOutputItem = <create>;
}
/*
Q4: why can't we use decorators on input exchange items?
S: we can, we should provide a mirror interface
J: --||--
R: yes, IExchangeItemDecorator { IExhchangeItem DecoratedItem { get; } }
A: yes, we can
Standa: yes, probably mirror interface
G: we should add it
-----------
yes, we can
Q5: can we use decorators without real components, just by generating output item and transforming it to another output item (important for tests)
S: we can
J: yes
R: yes
A: yes, we do need an exchange item
Standa: for testing yes
G: yes, it must be possible
----
yes, but no one could stop developer of the decorator to be used only in the context of the component, which owns item being decorated.
Q6: it sounds nice to make a decorator know about component it decorates
S: Decorator.Component is the owner component
J: --||--
R: optional, when we use them independently (test) then it is not used
A: not neccessary, I'd consider it redundant, there is always an exchange item and component is known by it
Standa: yes
G: yes, in the current interface it is Component property of the decorator
------
leave it for now
Q7: can we use linkable components as/instead of decorators?
S: no
J: if instead - no, for something more advanced - yes, use as a separate components
R: no
A: we can't stop anybody to do it
Standa: yes
G: with the current solution we don't force it, but user's can wrap components as decorators
-----------
yes, as a separate components connected to existing components
Q8: when and where we provide consumer to the DecoratedOutputItem (IInputItem)
S: we don't
G: we don't
J: we don't
R: we don't
A: we don't care :)
Standa: we don't
G: --||--
-------------
don't
Q9: can we have 2 output items as input of a decorator, or 2 outputs?
S: no, make a small component
J: no
R: yes, I'd prefer to do that
A: yes, behind the scenes it may use anything from the component
Standa: no, make it a component
G: yes, but maybe in 3.0 (I'd not put too much effort now)
-------------
not for now, for now it is 1 to 1, this is a special case
*/
|