Getting started with DDBS Toolkit

Import modules into your project

Add the needed dependencies into your pom.xml

Create your data model

You need to create your data classes with the following requirements :

Example for distributed Actor data

				public class Actor extends DistributedEntity {

				    @Id
				    @EntityName(name="actor_id")
				    private Integer actorId;
				
				    @EntityName(name="actor_name")
				    private String actorName;
				
				    @EntityName(name="film_id")
				    private Integer filmId;
				    
				    public Integer getActorId() {
						return actorId;
					}
				
					public void setActorId(Integer actorId) {
						this.actorId = actorId;
					}
				
					public String getActorName() {
						return actorName;
					}
				
					public void setActorName(String actorName) {
						this.actorName = actorName;
					}
				
					public Integer getFilmId() {
						return filmId;
					}
				
					public void setFilmId(Integer filmId) {
						this.filmId = filmId;
					}
				}

Instantiate your data modules

Example for MySQL Module

				MySQLConnector mysqlConnector = new MySQLConnector("jdbc:mysql://localhost:3306/myDB", "user", "password");
				DistributableEntityManager manager = new DistributedMySQLTableManager(mysqlConnector);

You can already start to use your data module

Example to add an actor data

				manager.open();
		
				Actor anActor = new Actor();
				anActor.setActorName("Steven");
					
				manager.add(anActor);
				
				manager.close();

For middleware modules: Create your receiver interface and start to listen

The receiver interface will listen to data transactions and will transmit the command into the data module. Example for JGroups module:

				DistributableReceiverInterface receiver = null;
				try {
					receiver = new JGroupReceiver(manager, "defaultCluster", "receiver");
					receiver.start();
				} finally {
					if(receiver != null) {
						receiver.stop();
					}
				}

For middleware modules: Create your sender interface

The sender module will send commands to your receiver interfaces. Example for JGroups module:

				DistributableSenderInterface senderInterface = new JGroupSender("defaultCluster", "sender");

For middleware modules: You can already start to use your middleware module

Example to add an actor data

				senderInterface.open();
		
				Actor anActor = new Actor();
				anActor.setPeerUid("receiver");
				anActor.setActorName("Steven"); 
					
				senderInterface.add(anActor);
				
				senderInterface.close();

Create your own module

You first need to add the DDBS Toolkit core dependency into your pom.xml

				
					org.ddbstoolkit.toolkit.core
					ddbstoolkit-core
					1.0.0-beta2
					compile
				

In order to create your own data module, you will have to :

In order to create your own middleware module, you will have to :

More information about modules

Data layer modules :

Middleware modules :