blob: 0fab87358ff50e958498067c184368db88b170d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
package org.apache.tuscany.core.context;
import java.util.List;
import org.apache.tuscany.core.config.ConfigurationException;
import org.apache.tuscany.model.assembly.Aggregate;
import org.apache.tuscany.model.assembly.Extensible;
import org.apache.tuscany.model.assembly.AggregatePart;
/**
* A context which contains child component contexts.
*
* @version $Rev$ $Date$
*/
public interface AggregateContext extends InstanceContext {
/**
* Propagates an event to registered listeners. All lifecycle events will be propagated to children in the order
* that they were registered. Listeners are expected to be well-behaved and if an exception is thrown the
* notification process will be aborted.
*
* @param pEventType the type of event. Basic types are defined in {@link EventContext}
* @param pMessage the message associated with the event or null
* @throws EventException if an error occurs while sending the event
*/
public void fireEvent(int pEventType, Object pMessage) throws EventException;
/**
* Registers a listener to receive notifications for the context
*
* @throws ContextRuntimeException if an error occurs during registration
*/
public void registerListener(RuntimeEventListener listener) throws ContextRuntimeException;
/**
* Adds runtime artifacts represented by the set of model objects to the aggregate context by merging them with
* existing artifacts. Implementing classes may support only a subset of {@link AggregatePart} types.
*
* @see org.apache.tuscany.model.assembly.Component
* @see org.apache.tuscany.model.assembly.ModuleComponent
* @see org.apache.tuscany.model.assembly.SimpleComponent
* @see org.apache.tuscany.model.assembly.EntryPoint
* @see org.apache.tuscany.model.assembly.ExternalService
*/
public void registerModelObjects(List<Extensible> models) throws ConfigurationException;
/**
* Adds a runtime artifact represented by the model object to the aggregate context by merging it with existing
* artifacts. Implementing classes may support only a subset of {@link AggregatePart} types.
*
* @see org.apache.tuscany.model.assembly.Component
* @see org.apache.tuscany.model.assembly.ModuleComponent
* @see org.apache.tuscany.model.assembly.SimpleComponent
* @see org.apache.tuscany.model.assembly.EntryPoint
* @see org.apache.tuscany.model.assembly.ExternalService
*/
public void registerModelObject(Extensible model) throws ConfigurationException;
/**
* Returns the child context associated with a given name
*/
public InstanceContext getContext(String name);
/**
* Returns the parent context, or null if the context does not have one
*/
public AggregateContext getParent();
/**
* Intended for internal use by the runtime, returns an implementation instance for the given context name, which
* may be a compound component/service form. Unlike {@link InstanceContext#getInstance(QualifiedName)}, which for aggregate contexts only returns
* entry point proxies, this method will return any type of contained implementation instance.
*
* @throws TargetException if there was an error returning the instance
*/
public Object locateInstance(String name) throws TargetException;
/**
* Returns the aggregate managed by this aggregate context
* @return
*/
@Deprecated
public Aggregate getAggregate();
}
|