The 1000 steps program to MDriven Chapter 14

Chapter 14

Back to chapter 13:The_1000_steps_program_to_MDriven_Chapter_13

In this chapter we go over the installation and initial use of the MDrivenServer for development. The MDrivenServer makes your application enterprise grade and allows you to connect to your own database with a connection string. The MDrivenServer understands your model and offloads you of all the hassle to keep your db-schema compatible with your system needs.

Video: https://youtu.be/c7bTqDWC-bU

407 Press play button - start Turnkey prototyper

408 Find the xml file that stores the data

409 Open the xml file with notepad and take a look to see that you recongnise it

410 Open the Cloud-connection dialog from the toolbar

411 Download the latest for Local servers

412 Add a server-pair - server1

413 Refresh the install to Server1

414 Open the install folder and make sure you see the files

415 Add another server-pair server2

416 Refresh install for server2

417 Start Server1

418 Ensure you see 2 command windows, one for MDrivenServer and one for TurnkeyServer

419 Try and press start servers again to verify that the server pair re-starts

420 Start Server2 - ensure you see 2 new cmd windows

421 Pick the Server1's MDrivenServer as the active MDrivenServer by first switching tab to "Active MDriven Server"

422 Then type in the address of the MDrivenServer http://localhost:5000, also type user a and pwd 123456

423 Press Check Server status - verify that it says "Never started, No current version"

424 Head back to the "Local Servers" - tab, use the "Use above MDrivenServer" button to choose Active MDriven Server

425 Try to start the Server2-pair, choose it as Active - check its Server status

426 Stop the cmd-windows for the Server2-pair (port 5002 and 5003) - now press "Check server status" again

427 Verify you get the expected Time out due to the server addressed being closed

428 Switch back to "Local servers"-tab, pick Server1 - click Use Above MDrivenServer

429 Verify that the green indicator shows http://localhost:5000

430 press "Upload model" button - this will upload your current model to the active MDrivenServer

431 press "Check Server Status" button - if you do it too quick after upload you will not get full result - if so click again

432 Verify the returned result states that the database was created for us

433 Also press "Update serverside jobs" for good meassure, since we have not covered or defined server side jobs yet - the result will nothing

434 Go to the MDrivenServer Web-ui by entering http://localhost:5000  in a browser

435 Log in with a and 12345 (the weak pwd is ok since this server is on localhost and can only be reached by users allowed on your machine )

436 Go to Running/Model

437 Go to Running in Data in A0, choose Car, Search - verify that there is no data

438 Migrate data into the db , start by pressing play

439 Start the system with xml persistence

440 Press Migrate, then the Green button inside the migrate window, save the data to migrateToDB.xml

441 Close Migrate dialog, switch to MDrivenServer persistence, start the system, press migrate button again

442 Now choose the pink button - choose the migrateToDB.xml file - the choose the yellow button to save the data.

443 Head back to MDrivenServer web ui, Running/Data in A0/Car search - verify that you now have data

444 Double click one of the Cars in the search result - verify you get an AutoForm displaying the data

445 Click the "Open" behind BrandOfCar single-link and verify you get the Brand-autoform - showing the data including the image of the brand

446 In the Play- LocalTurnkeyPrototyper-tab switch the "Data" from "Use xml" to "Use MDriven server"

447 Press re-start to apply the changed settings to the Turnkey-prototyper

448 In the web-page spawned we may now see an error "Singleton class SysSingleton has multiple instances"

449 If you see this error use the following steps to fix it - if you do not have the error - follow the steps but avoid any data

450 The error is an effect of the migration migrated in one instance of SysSingleton, and the system already had one instances of SysSingleton - totalling to 2 - the Singleton-concept does however force us to have only 1 object. In order to fix we much reach in and delete one of the instances of the SysSingleton - leaving only 1 , or zero, because if zero the oclSingleton operator will recreate it for us when first asked for.

451 To remove the extra SysSingleton: Play/MDrivenServer persistence/ start the system - click debugger. Find the SysSingleton in the classes picker - click "Seeker" - search and see the 2 objects, select one of them , click "delete selected" , head back to main debugger form and click save

452 Now go back to the failed web page and press F5, verify that the app now works as before

453 We are now running against a relational database controlled by the MDrivenServer - this means that we must change the schema (definition of db tables and db columns) in the database whenever we change things in our model. Start by adding a new class Class1 , head over to cload-connection dialog. click "Upload Model"

454 Click "Check Server status" - if you get no new feedback - wait 1 second then press again

455 Verify that the feedback from the server states that a table for storing objects of Class1 has been added to the database for us

456 Add a few attributes to the Class1, then upload model again, and verify that the MDrivenServer status says the database schema was changed to accomodate the new attributes

457 Delete some of the attributes, upload model again - verify that MDrivenServerSTatus indicates that the MDrivenServer has removed columns from the table

458 Add an association between Class1 and BrandOfCar for example, upload model, verify that MDrivenServerSTatus indicates that the MDrivenServer has added columns to store the foreign key - that will hold the primary key of an object-  that consitutes the association on database level

459 Now delete this experiment Class1 , upload model and verify that MDrivenServerSTatus indicates that the MDrivenServer has dropped the table for Class1 and also drops the column for the foreign key in BrandOfCar

460 To learn more about the mdrivenserver - go to wiki.mdriven.net and look it up by searching MDriven Server

461 When you are ready to deploy your application to a wider audience you will want to run the MDrivenServer and MDrivenTurnkey on a server where your users has access - this may be a companies internal network or on the internet. You can always refer to the wiki.mdriven.net to find out how to install the software on Microsoft Internet Server, or a Azure web application, or run the core servers from linux based servers.

This page was edited 8 days ago on 04/29/2024. What links here