### Start HornetQ with STOMP Over WebSocket Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/stomp/doc/index.html Commands to navigate to the example directory and build the project to enable STOMP over WebSocket support in HornetQ. ```bash $ cd hornetq-x.y.z/examples/jms/stomp-websockets $ mvn clean install ``` -------------------------------- ### Setup Local Test Sandbox Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/CONTRIBUTING.md Use these Grunt commands to set up a local test sandbox and begin development. Ensure you copy the example HTML file first. ```bash cp sandbox/index.html.example sandbox/index.html grunt connect ``` ```bash open http://localhost:9999/sandbox/index.html ``` -------------------------------- ### STOMP Connection and Subscription Example Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/stomp/doc/index.html Example of connecting to a STOMP server via WebSocket and subscribing to a queue. This is a basic setup for a chat application. ```javascript var client = Stomp.client('ws://localhost:15674/ws'); client.connect('guest', 'guest', function(frame) { console.log('connected to Stomp'); client.subscribe('/queue/test', function (message) { console.log('received message: ' + message.body); }); }, function(error) { console.log('STOMP: ' + error); }); ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/stomp/README.md Install all necessary dependencies for development, including testing and building the library. This command should be run in the project's root directory. ```bash $ npm install ``` -------------------------------- ### Install JavaScript dependency management tools Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/README.adoc Commands to install Node.js, npm, and Bower on an Ubuntu system. ```bash sudo apt-get install nodejs sudo apt-get install npm sudo sudo npm install bower ``` -------------------------------- ### Start Distributed State Machine Instance Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-web.adoc Command to start a single instance of the distributed state machine sample. Ensure Zookeeper is running locally. Use `--server.port=` to distinguish instances on the same host. ```text # java -jar spring-statemachine-samples-web-{revnumber}.jar ``` -------------------------------- ### Install Flat UI via Bower Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/flat-ui/README.md Use this command to install the Flat UI package using the Bower dependency manager. ```bash bower install flat-ui ``` -------------------------------- ### Install Bower Globally Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/flat-ui/docs/getting-started.html If Bower is not installed globally, run this command first to install it. ```bash npm install -g bower ``` -------------------------------- ### Install Grunt Packages Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/flat-ui/docs/getting-started.html Before running Grunt commands, ensure all necessary Grunt packages are installed by running this command. ```bash npm install ``` -------------------------------- ### Install AngularJS Toaster with Bower or NPM Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/angularjs-toaster/README.md Use these commands to install the library via package managers. ```bash bower install --save angularjs-toaster ``` ```bash npm install --save angularjs-toaster ``` -------------------------------- ### Get State HTTP Request Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-turnstilereactive.adoc Example HTTP GET request to retrieve the current state of the StateMachine. ```bash GET http://localhost:8080/state ``` -------------------------------- ### Select Spring Profile for Persistence Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-datajpapersist.adoc Examples of how to run the sample application with specific Spring profiles activated to choose the persistence backend. ```text # java -jar spring-statemachine-samples-datapersist-{revnumber}.jar --spring.profiles.active=jpa # java -jar spring-statemachine-samples-datapersist-{revnumber}.jar --spring.profiles.active=mongo # java -jar spring-statemachine-samples-datapersist-{revnumber}.jar --spring.profiles.active=redis ``` -------------------------------- ### Instantiate State Machine with Configuration Model Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/appendix-distributedpaper.adoc Demonstrates how to instantiate a state machine by building a model with configuration data classes and then using a factory to create the state machine. This approach allows for easier integration and customization. ```java StateMachineModel model = StateMachineModelFactory.create("sample-machine", new StateMachineConfigObject(new StateMachineConfigObject.States(), new StateMachineConfigObject.Transitions())); StateMachine stateMachine = stateMachineFactory.create(model); ``` -------------------------------- ### Component Initialization API Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.SliderHandle.md APIs related to the initialization and setup of components. ```APIDOC ## init( player, options, ready ) ### Description The constructor function for the class. ### Method POST ### Endpoint N/A (Constructor) ### Parameters #### Path Parameters * **player** - Required - The player instance. * **options** - Required - Initialization options. * **ready** - Required - Callback function when initialization is complete. ``` ```APIDOC ## initChildren() ### Description Add and initialize default child components from options. This method processes the `children` option to add and configure child components. ### Method POST ### Endpoint N/A (Method call on component instance) ### Parameters None ### Example ```javascript // Example of setting children in options MyComponent.prototype.options_.children = { myChildComponent: { myChildOption: true } }; // Or when creating the component var myComp = new MyComponent(player, { children: { myChildComponent: { myChildOption: true } } }); // Children can also be an Array var myComp = new MyComponent(player, { children: [ 'button', { name: 'button', someOtherOption: true } ] }); ``` ``` -------------------------------- ### Get State HTTP Response Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-turnstilereactive.adoc Example response when retrieving the StateMachine state. ```text "LOCKED" ``` -------------------------------- ### init( player, options ) Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.LoadProgressBar.md Initializes the component with player and options. ```APIDOC ## init( player, options ) ### Parameters - **player** (Object) - Required - The player instance. - **options** (Object) - Required - Configuration options. ``` -------------------------------- ### Get Children Components Example Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.CaptionsButton.md Retrieves an array containing all child components currently associated with a parent component. ```javascript var kids = myComponent.children(); ``` -------------------------------- ### Get video duration Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.Player.md Retrieves the length of the video in seconds. The video must have started loading before this value is available. ```javascript var lengthOfVideo = myPlayer.duration(); ``` -------------------------------- ### Configure Simple Machine with JPA Repository Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-repository.adoc Demonstrates manual creation of states and transitions for a simple machine using JPA repositories. ```java include::samples/DocsJpaRepositorySampleTests1.java[tags=snippetA] ``` -------------------------------- ### Run Turnstile Sample Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-turnstile.adoc Command line interaction showing how to start the state machine and send events. ```text $ java -jar spring-statemachine-samples-turnstile-{revnumber}.jar sm>print +----------------------------------------------------------------+ | SM | +----------------------------------------------------------------+ | | | +----------------+ +----------------+ | | *-->| LOCKED | | UNLOCKED | | | +----------------+ +----------------+ | | +---| entry/ | | entry/ |---+ | | | | exit/ | | exit/ | | | | | | | | | | | | PUSH| | |---COIN-->| | |COIN | | | | | | | | | | | | | | | | | | | | |<--PUSH---| | | | | +-->| | | |<--+ | | | | | | | | +----------------+ +----------------+ | | | +----------------------------------------------------------------+ sm>start State changed to LOCKED State machine started sm>event COIN State changed to UNLOCKED Event COIN send sm>event PUSH State changed to LOCKED Event PUSH send ``` -------------------------------- ### Run Sample Application Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-datajpa.adoc Command to execute the JPA state machine sample JAR. ```text # java -jar spring-statemachine-samples-datajpa-{revnumber}.jar ``` -------------------------------- ### Install AngularJS via bower Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/angular/README.md Use this command to install the package in a bower-managed project. ```shell bower install angular ``` -------------------------------- ### Install AngularJS via npm Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/angular/README.md Use this command to install the package in an npm-managed project. ```shell npm install angular ``` -------------------------------- ### init(player, options) Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.MenuItem.md Initializes the component with a player instance and options. ```APIDOC ## init(player, options) ### Description Initializes the component. ### Method POST ### Endpoint N/A ### Parameters #### Path Parameters * __player__ - The player instance. * __options__ - Initialization options. ``` -------------------------------- ### init(player, options) Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.MuteToggle.md Initializes the component with a player instance and options. ```APIDOC ## init(player, options) ### Description Initializes the component with a player instance and options. ### Method `init(player, options)` ### Endpoint N/A (Method within a class) ### Parameters * __player__ - The player instance. * __options__ - The options for initializing the component. ``` -------------------------------- ### Install grunt-cli globally Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/CONTRIBUTING.md Install the grunt command-line interface globally to manage build tasks. ```bash sudo npm install -g grunt-cli ``` ```bash npm install -g grunt-cli ``` -------------------------------- ### init(player, options) Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.PlayToggle.md Initializes the component with a player instance and options. ```APIDOC ## init(player, options) ### Description Initializes the component with a player instance and options. ### Method [Method details not explicitly provided, assumed to be a component method] ### Endpoint [Not applicable for this method] ### Parameters #### Path Parameters * **player** - Required - The player instance. * **options** - Required - Initialization options. ### Request Example None ### Response None explicitly defined. ``` -------------------------------- ### Install contribflow globally Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/CONTRIBUTING.md Install the git workflow tool used for managing branches and pull requests. ```bash sudo npm install -g contribflow ``` ```bash npm install -g contribflow ``` -------------------------------- ### Run the Deploy Sample Application Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-deploy.adoc Execute the Spring Boot-based deploy sample application using the provided JAR file. ```text # java -jar spring-statemachine-samples-deploy-{revnumber}.jar ``` -------------------------------- ### Interact with Shell Instance 1 Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-zookeeper.adoc Demonstrates starting the state machine and transitioning states in the first shell instance. ```text sm>start Entry state LOCKED State machine started sm>event COIN Exit state LOCKED Entry state UNLOCKED Event COIN send sm>state UNLOCKED ``` -------------------------------- ### Copy Sandbox Index File Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/CONTRIBUTING.md Copy the example index file to the sandbox directory to create a local player instance for testing. This allows you to see your local changes in a browser. ```bash cp sandbox/index.html.example sandbox/index.html open sandbox/index.html ``` -------------------------------- ### Install angular-animate with npm Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/angular-animate/README.md Use npm to install the angular-animate package. Then, require it as a dependency for your AngularJS application module. ```shell npm install angular-animate ``` ```javascript angular.module('myApp', [require('angular-animate')]); ``` -------------------------------- ### Run Order Shipping Sample Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-ordershipping.adoc Execute the order shipping sample application using the provided JAR file. ```text # java -jar spring-statemachine-samples-ordershipping-{revnumber}.jar ``` -------------------------------- ### Set or Get Component Width Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.Html5.md This method allows you to set or get the width of a component. When setting, only pixel values are reliably supported; percentage values may not compute correctly. Returns the component instance when setting width, or the width value when getting. ```javascript myComponent.width(100); myComponent.width(); ``` -------------------------------- ### Component Initialization Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.MediaLoader.md Initializes a component with player, options, and a ready callback. ```APIDOC ## init( player, options, ready ) ### Description Initializes the component with the provided player instance, options, and a ready callback function. ### Method POST ### Endpoint N/A (Method on component instance) ### Parameters #### Path Parameters * **player** - The player instance. * **options** - Configuration options for the component. * **ready** - A callback function to be executed when the component is ready. ``` -------------------------------- ### Install stompjs for Node.js Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/stomp/README.md Install the 'stompjs' module using npm. This is the first step to using the library in a Node.js application. ```bash $ npm install stompjs ``` -------------------------------- ### Interact with Shell Instance 2 Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-zookeeper.adoc Demonstrates starting the second shell instance and observing the distributed state. ```text sm>start State machine started sm>state UNLOCKED ``` -------------------------------- ### Set or Get Height Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.ChaptersTrack.md Gets or sets the height of the component using CSS values. Pixel values are required for setting. ```APIDOC ## GET/PUT height( [num], [skipListeners] ) ### Description Get or set the height of the component (CSS values). Setting the video tag dimension values only works with values in pixels. Percent values will not work. Some percents can be used, but width()/height() will return the number + %, not the actual computed width/height. ### Method GET/PUT ### Endpoint /api/component/height ### Parameters #### Path Parameters - **num** (Number|String) - Optional - New component height. - **skipListeners** (Boolean) - Optional - Skip the resize event trigger. ### Returns * `vjs.Component` - This component, when setting the height. * `Number|String` - The height, when getting. ``` -------------------------------- ### Video.js Player HTML Setup Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.Player.md This HTML snippet shows how to set up a video element for Video.js using the `data-setup` attribute. The library will automatically create a player instance when ready. ```html ``` -------------------------------- ### Start Zookeeper Shell Instance Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-zookeeper.adoc Command to launch the Zookeeper sample application shell. ```text @n1:~# java -jar spring-statemachine-samples-zookeeper-{revnumber}.jar ``` -------------------------------- ### Get or Set Height Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.SubtitlesTrack.md Gets or sets the height of the component using CSS values. Pixel values are required for setting the height. ```APIDOC ## height( [num], [skipListeners] ) ### Description Get or set the height of the component (CSS values). Setting the video tag dimension values only works with values in pixels. Percent values will not work. Some percents can be used, but width()/height() will return the number + %, not the actual computed width/height. ### Parameters * __num__ `Number|String` _(OPTIONAL)_ - The new component height. * __skipListeners__ `Boolean` _(OPTIONAL)_ - Whether to skip the resize event trigger. ### Returns * `vjs.Component` - This component, when setting the height. * `Number|String` - The height, when getting. ``` -------------------------------- ### Component Initialization Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.TextTrack.md Initializes a component with player and options. ```APIDOC ## POST /api/component/init ### Description Initialize a component with player and options. ### Method POST ### Endpoint /api/component/init ### Parameters #### Request Body - **player** (Object) - The player instance. - **options** (Object) - Configuration options for the component. ``` -------------------------------- ### Build Samples with Gradle Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples.adoc Command to clean and build the samples using Gradle. Use '-x test' to exclude tests during the build. ```bash ./gradlew clean build -x test ``` -------------------------------- ### Define a Simple Runnable Task Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/recipes.adoc This example shows a basic Runnable task that performs a sleep operation. It serves as a foundation for other task examples. ```java Runnable sleepRunnable = () -> { try { Thread.sleep(50); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }; ``` -------------------------------- ### Run Security Sample Source: https://github.com/spring-projects/spring-statemachine/blob/main/docs/src/reference/asciidoc/sm-examples-security.adoc Command to execute the compiled security sample JAR. ```text # java -jar spring-statemachine-samples-secure-{revnumber}.jar ``` -------------------------------- ### Install angular-animate with bower Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/angular-animate/README.md Use bower to install the angular-animate package. Include the script in your index.html and then add 'ngAnimate' as a dependency for your AngularJS application module. ```shell bower install angular-animate ``` ```html ``` ```javascript angular.module('myApp', ['ngAnimate']); ``` -------------------------------- ### Get or Set Component Height - JavaScript Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/api/vjs.TextTrack.md Gets or sets the height of a component. Pixel values are required when setting the height. This method is inherited from src/js/component.js. ```javascript var height = player.height(); player.height(360); player.height('360px'); ``` -------------------------------- ### Configure Video.js via data-setup Source: https://github.com/spring-projects/spring-statemachine/blob/main/spring-statemachine-samples/web/src/main/resources/static/lib/videojs/docs/guides/options.md Provide player options as a JSON object within the data-setup attribute of the video tag. ```html