com.zfabrik.states
Interface ISystemState


public interface ISystemState

System states are abstract target configurations of a z2 environment at runtime.

System states are declared as components of type com.zfabrik.systemState.

The most important use-case of this is the heterogeneous designation of worker processes to different purposes using the system state mechanism. In essence, the runtime should only download resources of component and execute components as far as required for the implemented scenario. The system state mechanism allows to define scenario requirements via a graph of system state and component dependencies. See also the worker process javadoc.

System states can be attained. Attaining a system state translates to invoking all components that declare a participation in the state using the configuration property STATES_PARTICIPATION (see there).

Components, including system states, may declare dependency on a system state using the configuration property IComponentDescriptor.STATES_DEPENDENCY. If so, the declared system states must have been attained before providing the component.

A system state in turn can be looked up as ISystemState (this interface) or as Runnable. When invoking the method attain() or Runnable.run() respectively, the system state will try to be attained.

For example, the system state com.zfabrik.boot.main/process_up is declared like this:

 #
 # a system state
 #
 com.zfabrik.component.type=com.zfabrik.systemState
 #
 # it's a generalization that applies to worker processes
 # as well as home processes. For example, the distributed
 # component provisioning participates in this state to advertise
 # itself at the package management
 #
 com.zfabrik.systemStates.participation=\
           com.zfabrik.boot.main/home_up,\
           com.zfabrik.boot.main/worker_up
 #
 #
 

Author:
hb

Field Summary
static java.lang.String STATES_PARTICIPATION
          A comma-separated list of system states that a component using this configuration property participates in.
static java.lang.String TYPE
          Type of a system state component.
 
Method Summary
 void attain()
          Try to attain the system state
 java.lang.String getName()
          Gets the name of the system state.
 boolean isAttained()
          verify whether the system state is currently attained.
 

Field Detail

TYPE

static final java.lang.String TYPE
Type of a system state component.

See Also:
Constant Field Values

STATES_PARTICIPATION

static final java.lang.String STATES_PARTICIPATION
A comma-separated list of system states that a component using this configuration property participates in. Participation in a system state means that in order to attain the system states, all participating components will be looked up as an ISystemStateListener and invoked correspondingly. In case the invocation fails with an exception, the state will not be attained.

A system state depends on all of its participating components. Once any of those is invalidated (see Resource), the system state will leave its "attained" state.

This mechanism is particularly important during system synchronization (see ISynchronizer).

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Gets the name of the system state.

Returns:
the name of the system state component

attain

void attain()
Try to attain the system state


isAttained

boolean isAttained()
verify whether the system state is currently attained.

Returns: