Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add saga state machine Java stream builder support #5849

Merged
merged 10 commits into from
Oct 26, 2023
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.saga.statelang.builder;

/**
* Build exception.
*
* @author ptyin
*/
public class BuildException extends RuntimeException {
public BuildException() {
}

public BuildException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.ChoicePropertyBuilder;
import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.domain.ChoiceState;

/***
* Choice state builder for {@link ChoiceState}
*
* @author ptyin
*/
public interface ChoiceStateBuilder extends
StateBuilder<ChoiceState>,
BasicPropertyBuilder<ChoiceStateBuilder>,
ChoicePropertyBuilder<ChoiceStateBuilder> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.ServiceTaskPropertyBuilder;
import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.builder.prop.TaskPropertyBuilder;
import io.seata.saga.statelang.domain.CompensateSubStateMachineState;

/***
* Compensate SubStateMachine state builder for {@link CompensateSubStateMachineState}.
*
* @author ptyin
*/
public interface CompensateSubStateMachineStateBuilder extends
StateBuilder<CompensateSubStateMachineState>,
BasicPropertyBuilder<CompensateSubStateMachineStateBuilder>,
TaskPropertyBuilder<CompensateSubStateMachineStateBuilder>,
ServiceTaskPropertyBuilder<CompensateSubStateMachineStateBuilder> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.domain.CompensationTriggerState;

/**
* Compensation trigger state builder for {@link CompensationTriggerState}
*
* @author ptyin
*/
public interface CompensationTriggerStateBuilder extends
StateBuilder<CompensationTriggerState>,
BasicPropertyBuilder<CompensationTriggerStateBuilder> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.builder.prop.FailEndPropertyBuilder;
import io.seata.saga.statelang.domain.FailEndState;

/**
* Fail end state builder for {@link FailEndState}
*
* @author ptyin
*/
public interface FailEndStateBuilder extends
StateBuilder<FailEndState>,
BasicPropertyBuilder<FailEndStateBuilder>,
FailEndPropertyBuilder<FailEndStateBuilder> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.builder.prop.ForkPropertyBuilder;
import io.seata.saga.statelang.domain.ForkState;

/**
* Fork state builder for {@link ForkState}
*
* @author ptyin
*/
public interface ForkStateBuilder extends
StateBuilder<ForkState>,
BasicPropertyBuilder<ForkStateBuilder>,
ForkPropertyBuilder<ForkStateBuilder> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.domain.JoinState;

/**
* Join state builder for {@link JoinState}
*
* @author ptyin
*/
public interface JoinStateBuilder extends
StateBuilder<JoinState>,
BasicPropertyBuilder<JoinStateBuilder> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.builder.prop.ScriptTaskPropertyBuilder;
import io.seata.saga.statelang.builder.prop.TaskPropertyBuilder;
import io.seata.saga.statelang.domain.ScriptTaskState;

/***
* Script task state builder for {@link ScriptTaskState}
*
* @author ptyin
*/
public interface ScriptTaskStateBuilder extends
StateBuilder<ScriptTaskState>,
BasicPropertyBuilder<ScriptTaskStateBuilder>,
TaskPropertyBuilder<ScriptTaskStateBuilder>,
ScriptTaskPropertyBuilder<ScriptTaskStateBuilder> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.builder.prop.ServiceTaskPropertyBuilder;
import io.seata.saga.statelang.builder.prop.BasicPropertyBuilder;
import io.seata.saga.statelang.builder.prop.TaskPropertyBuilder;
import io.seata.saga.statelang.domain.ServiceTaskState;

/***
* Service task state builder for {@link ServiceTaskState}.
*
* @author ptyin
*/
public interface ServiceTaskStateBuilder extends
StateBuilder<ServiceTaskState>,
BasicPropertyBuilder<ServiceTaskStateBuilder>,
TaskPropertyBuilder<ServiceTaskStateBuilder>,
ServiceTaskPropertyBuilder<ServiceTaskStateBuilder> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 1999-2019 Seata.io Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.seata.saga.statelang.builder;

import io.seata.saga.statelang.domain.State;

/***
* State builder.
*
* @param <S> state type
* @author ptyin
*/
public interface StateBuilder<S extends State> {
/**
* Build a state.
*
* @return built state
*/
S build();

/**
* Get the working {@link StatesConfigurer} parent.
*
* @return parent
*/
StatesConfigurer and();
}
Loading