生命周期组件框架:生命周期描述语言——简略状态机示例代码

生命周期组件框架:生命周期描述语言——简单状态机示例代码
    //状态机元数据描述
    @StateMachine
    protected static interface CustomerLifecycleMeta {

        @StateSet
        static interface States {

            @Initial
            @Function(transition = CustomerLifecycleMeta.Transitions.Activate.class, value = { Active.class })
            static interface Draft {}
            @Functions({ @Function(transition = CustomerLifecycleMeta.Transitions.Suspend.class, value = Suspended.class),
                    @Function(transition = CustomerLifecycleMeta.Transitions.Cancel.class, value = Canceled.class) })
            static interface Active {}
            @Function(transition = CustomerLifecycleMeta.Transitions.Resume.class, value = Active.class)
            static interface Suspended {}
            @End
            static interface Canceled {}
        }
        @TransitionSet
        static interface Transitions {

            static interface Activate {}
            static interface Suspend {}
            static interface Resume {}
            static interface Cancel {}
        }
    }
    

 

    public abstract static class ReactiveObject {

        @StateIndicator
        private String state = null;

        protected void initialState(String stateName) {
            if ( null == state ) {
                this.state = stateName;
            } else {
                throw new IllegalStateException("Cannot call initialState method after state had been intialized.");
            }
        }

        public String getState() {
            return state;
        }
    }

 

   // 标记生命周期元数据引用的业务对象(反应型对象)

    @LifecycleMeta(CustomerLifecycleMeta.class)
    public static class Customer extends ReactiveObject {

        protected Customer() {
            initialState(Draft.class.getSimpleName());
        }

        @Transition
        public void activate() {}

        @Transition
        public void suspend() {}

        @Transition
        public void resume() {}

        @Transition
        public void cancel() {}
    }

 

   // 测试用例

    @Test
    public void test_standalone_object_without_relation_lifecycle() throws VerificationException {
        Customer customer = new Customer();
        customer.activate();
        assertEquals(CustomerLifecycleMeta.States.Active.class.getSimpleName(), customer.getState());
        customer.suspend();
        assertEquals(CustomerLifecycleMeta.States.Suspended.class.getSimpleName(), customer.getState());
        customer.resume();
        assertEquals(CustomerLifecycleMeta.States.Active.class.getSimpleName(), customer.getState());
        customer.cancel();
        assertEquals(CustomerLifecycleMeta.States.Canceled.class.getSimpleName(), customer.getState());
    }

 

正确配置执行环境参数后可以获得下面的引擎执行Log

 

//BCEL字节码在线转换生成类的日志
[FINE]: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$6 extends java.lang.Object
implements java.util.concurrent.Callable
filename CoreFuntionTestMetadata.java
compiled from CoreFuntionTestMetadata.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(CoreFuntionTestMetadata.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$6("net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer this$0

3 methods:
void <init>(net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

[FINE]: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$7 extends java.lang.Object
implements java.util.concurrent.Callable
filename CoreFuntionTestMetadata.java
compiled from CoreFuntionTestMetadata.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(CoreFuntionTestMetadata.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$7("net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer this$0

3 methods:
void <init>(net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

[FINE]: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$8 extends java.lang.Object
implements java.util.concurrent.Callable
filename CoreFuntionTestMetadata.java
compiled from CoreFuntionTestMetadata.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(CoreFuntionTestMetadata.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$8("net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer this$0

3 methods:
void <init>(net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

[FINE]: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$9 extends java.lang.Object
implements java.util.concurrent.Callable
filename CoreFuntionTestMetadata.java
compiled from CoreFuntionTestMetadata.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(CoreFuntionTestMetadata.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer$9("net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer this$0

3 methods:
void <init>(net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

[FINE]: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder$7 extends java.lang.Object
implements java.util.concurrent.Callable
filename CoreFuntionTestMetadata.java
compiled from CoreFuntionTestMetadata.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(CoreFuntionTestMetadata.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder$7("net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder this$0

3 methods:
void <init>(net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

[FINE]: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder$8 extends java.lang.Object
implements java.util.concurrent.Callable
filename CoreFuntionTestMetadata.java
compiled from CoreFuntionTestMetadata.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(CoreFuntionTestMetadata.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder$8("net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder this$0

3 methods:
void <init>(net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

[FINE]: class net.madz.lifecycle.engine.EngineTestBase$BaseService$8 extends java.lang.Object
implements java.util.concurrent.Callable
filename EngineTestBase.java
compiled from EngineTestBase.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(EngineTestBase.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.EngineTestBase$BaseService$8("net.madz.lifecycle.engine.EngineTestBase$BaseService", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.EngineTestBase$BaseService this$0

3 methods:
void <init>(net.madz.lifecycle.engine.EngineTestBase$BaseService arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

[FINE]: class net.madz.lifecycle.engine.EngineTestBase$BaseService$9 extends java.lang.Object
implements java.util.concurrent.Callable
filename EngineTestBase.java
compiled from EngineTestBase.java
compiler version 50.0
access flags 32
constant pool 38 entries
ACC_SUPER flag true

Attribute(s):
SourceFile(EngineTestBase.java)
Signature(Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/Void;>;)
(Unknown attribute EnclosingMethod: 00 0a 00 0e)
InnerClass:net.madz.lifecycle.engine.EngineTestBase$BaseService$9("net.madz.lifecycle.engine.EngineTestBase$BaseService", "<anonymous>")

1 fields:
final synthetic net.madz.lifecycle.engine.EngineTestBase$BaseService this$0

3 methods:
void <init>(net.madz.lifecycle.engine.EngineTestBase$BaseService arg1)
public Void call()
throws java.lang.Exception
public volatile synthetic Object call()
throws java.lang.Exception

//测试程序注册状态机元数据
Registering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields

[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta.TransitionSet.End
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta.TransitionSet.Start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta.CustomerRelation
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.TransitionSet.Activate
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.TransitionSet.Cancel
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.TransitionSet.Resume
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.TransitionSet.Suspend
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.StateSet.Active
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.StateSet.Canceled
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.StateSet.Draft
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$CustomerLifecycleMeta.StateSet.Suspended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMeta.StateSet.New.ValidWhiles.CustomerRelation
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields.TransitionSet.End.end
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields.TransitionSet.Start.start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$BaseServiceWithRelationOnFields.RelationSet.CustomerRelation.customerRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.TransitionSet.Suspend.suspend
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.TransitionSet.Resume.resume
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.TransitionSet.Activate.activate
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.TransitionSet.Cancel.cancel
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.StateSet.Active
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.StateSet.Canceled
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.StateSet.Draft
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.StateSet.SuspendedRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder.TransitionSet.End.end
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder.TransitionSet.Start.start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder.RelationSet.CustomerRelation.customerRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile.TransitionSet.End
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile.TransitionSet.Start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile.CustomerRelation
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceLifecycleMetaWithInboundWhile.StateSet.InService.InboundWhiles.CustomerRelation
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile.TransitionSet.End.end
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile.TransitionSet.Start.start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrderWithInboundWhile.RelationSet.CustomerRelation.customerRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceLifecycle
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceLifecycle.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceLifecycle.TVProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVProviderLifecycle
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$ServiceProviderLifecycle
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$ServiceProviderLifecycle.TransitionSet.Shutdown
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$ServiceProviderLifecycle.StateSet.Closed
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$ServiceProviderLifecycle.StateSet.ServiceAvailable
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceLifecycle.StateSet.New.ValidWhiles.TVProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService.TransitionSet.End.end
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService.TransitionSet.Start.start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService.RelationSet.TVProvider.getProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVService.RelationSet.CustomerRelation.getCustomerRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceProvider


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceProvider

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceProvider.TransitionSet.Shutdown.shutdown
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceProvider.StateSet.Closed
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceProvider.StateSet.ServiceAvailableRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields.TransitionSet.End.end
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields.TransitionSet.Start.start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields.RelationSet.TVProvider.provider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetTVServiceWithRelationOnFields.RelationSet.CustomerRelation.customerRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPostValidateCondition
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition.ConditionSet.TimesLeft
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition.TransitionSet.PressAnyKey
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition.StateSet.Broken
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition.StateSet.ReadingInput
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition.PowerRelation
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerLifecycleMetadata
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerLifecycleMetadata.ConditionSet.PowerLeftCondition
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerLifecycleMetadata.TransitionSet.ReducePower
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerLifecycleMetadata.TransitionSet.ShutDown
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerLifecycleMetadata.StateSet.PowerOff
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerLifecycleMetadata.StateSet.PowerOn
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition.StateSet.Broken.InboundWhiles.PowerRelation
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPreValidateCondition.StateSet.ReadingInput.InboundWhiles.PowerRelation
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardLifecycleMetadataPostValidateCondition.TransitionSet.PressAnyKey
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition.ConditionSet.TimesLeft
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition.TransitionSet.PressAnyKey.pressAnyKey
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition.StateSet.Broken
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition.StateSet.ReadingInput
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPostValidateCondition.RelationSet.PowerRelation.powerObjectRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition.ConditionSet.TimesLeft
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition.TransitionSet.PressAnyKey.pressAnyKey
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition.StateSet.Broken
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition.StateSet.ReadingInput
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$KeyBoardObjectPreValidateCondition.RelationSet.PowerRelation.powerObjectRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject.ConditionSet.PowerLeftCondition
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject.TransitionSet.ShutDown.shutDown
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject.TransitionSet.ReducePower.reducePower
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject.StateSet.PowerOff
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$PowerObject.StateSet.PowerOnRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPProvider


[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPProvider

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPProviderLifecycleMeta
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPProvider.TransitionSet.Shutdown.shutdownRegistering Lifecycle class: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPProvider.StateSet.Closed
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPProvider.StateSet.ServiceAvailable

[FINE]: registering .. class net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService

[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPServiceLifecycleMeta
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPServiceLifecycleMeta.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPServiceLifecycleMeta.VoipProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPServiceLifecycleMeta.StateSet.New.ValidWhiles.VoipProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService.TransitionSet.End.end
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService.TransitionSet.Start.start
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService.StateSet.New
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService.StateSet.InService
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService.RelationSet.VoipProvider.getProvider
[FINE]: net.madz.lifecycle.engine.CoreFuntionTestMetadata$VOIPService.RelationSet.CustomerRelation.getCustomerRegistering Lifecycle class: class net.madz.lifecycle.engine.EngineTestBase$BaseService


[FINE]: registering .. class net.madz.lifecycle.engine.EngineTestBase$BaseService

[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseService
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseService.TransitionSet.End.end
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseService.TransitionSet.Start.start
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseService.StateSet.Ended
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseService.StateSet.InService
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseService.StateSet.New
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseService.RelationSet.CustomerRelation.getCustomerRegistering Lifecycle class: class net.madz.lifecycle.engine.EngineTestBase$BaseServiceProvider


[FINE]: registering .. class net.madz.lifecycle.engine.EngineTestBase$BaseServiceProvider

[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseServiceProvider
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseServiceProvider.TransitionSet.Shutdown.shutdown
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseServiceProvider.StateSet.Closed
[FINE]: net.madz.lifecycle.engine.EngineTestBase$BaseServiceProvider.StateSet.ServiceAvailable

##################################################################################
//开始执行测试方法
Processing test: test_standalone_object_with_definite_relation(net.madz.lifecycle.engine.EngineCoreFunctionPositiveTests)

//状态机引擎拦截到标记有@Transition的方法执行,开始执行生命周期相关工作
[FINE]: Found Intercept Point: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer.activate( )
[FINE]: Intercepting....instatiating InterceptContext ...

[FINE]: Intercepting....InterceptorController is doing exec ...

[FINE]: Intercepting....instantiating LifecycleInterceptor

[FINE]: intercepting with :net.madz.bcel.intercept.LifecycleInterceptor @preExec

[FINE]: intercepting [net.madz.lifecycle.engine.CoreFuntionTestMetadata$Customer@67bba966]
from state: [Draft]
[FINE]: Step 1. start validating State [Draft]
[FINE]: Step 2. start validating transition: [Activate] on state: [Draft]
[FINE]: Step 3. start validating inbound relation constraint is next state is predictable before method invocation.
[FINE]: Step 4. start callback before state change from : Draft => to : Active

[FINE]: intercepting with: net.madz.bcel.intercept.CallableInterceptor @intercept

[FINE]: intercepting with :net.madz.bcel.intercept.LifecycleInterceptor @postExec

[FINE]: Step 5. start validating inbound relation constraint is next state after method invocation.
[FINE]: Step 6. Set next state to reactiveObject.
[FINE]: Step 6. ReactiveObject is tranisited to state: [Active]
[FINE]: Step 7. Start Callback after state change from : Draft => to : Active
[FINE]: Step 8. Start fire state change event.

[FINE]: intercepting with :net.madz.bcel.intercept.LifecycleInterceptor @cleanup

[FINE]: Intercepting....LifecycleInterceptor is doing cleanup ...

[FINE]: Found Intercept Point: class net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder.start( )
[FINE]: Intercepting....instatiating InterceptContext ...

[FINE]: Intercepting....InterceptorController is doing exec ...

[FINE]: Intercepting....instantiating LifecycleInterceptor

[FINE]: intercepting with :net.madz.bcel.intercept.LifecycleInterceptor @preExec

[FINE]: intercepting [net.madz.lifecycle.engine.CoreFuntionTestMetadata$InternetServiceOrder@3033e3e0]
from state: [New]
[FINE]: Step 1. start validating State [New]
[FINE]: Step 2. start validating transition: [Start] on state: [New]
[FINE]: Step 3. start validating inbound relation constraint is next state is predictable before method invocation.
[FINE]: Step 4. start callback before state change from : New => to : InService

[FINE]: intercepting with: net.madz.bcel.intercept.CallableInterceptor @intercept

[FINE]: intercepting with :net.madz.bcel.intercept.LifecycleInterceptor @postExec

[FINE]: Step 5. start validating inbound relation constraint is next state after method invocation.
[FINE]: Step 6. Set next state to reactiveObject.
[FINE]: Step 6. ReactiveObject is tranisited to state: [InService]
[FINE]: Step 7. Start Callback after state change from : New => to : InService
[FINE]: Step 8. Start fire state change event.

[FINE]: intercepting with :net.madz.bcel.intercept.LifecycleInterceptor @cleanup

[FINE]: Intercepting....LifecycleInterceptor is doing cleanup ...
Finish test: test_standalone_object_with_definite_relation(net.madz.lifecycle.engine.EngineCoreFunctionPositiveTests)
########################################################################################################################

 

 前文:生命周期组件框架——关系型状态及服务

1 楼 superdingdang 前天  
@Function中的value表达什么意思?
2 楼 barryzhong 前天  
superdingdang 写道
@Function中的value表达什么意思?


value指的是函数值,是转移函数的函数值。也就是下一个可能的状态的集合。

引用*的关于有限状态自动机的数学模型http://zh.wikipedia.org/wiki/%E6%9C%89%E9%99%90%E7%8A%B6%E6%80%81%E6%9C%BA#.E6.95.B0.E5.AD.A6.E6.A8.A1.E5.9E.8B