arff

Hello Dynamic Group

To run this application you must

  1. Install mysql database. Once installed, run the dump.sql script below. Then configure the connection information to the database server ip, user, password in class BaseMySQL.java
  2. Run the TomCat WebServer
  3. GroupProcessingLogic.java
  4. MacroRegionListener.java
  5. VehicleControlledSimulator.java
  6. Open your browser and put the link: http://localhost:8080/ARFF_Web/. The prototype system web page will appear.

Note that the component that lists groups appear by default the following options: Todos, Região A and Região B. However, these groups are formed dynamically by creating hedges in maps (Regions) and their respective incoming and outgoing as shown in GroupDefinerSelector.java file. Basically tests whether the mobile node is within each of the regions. If positive, creates a group with the ID of the area and places it in the list of prohibited groups. The javascript for regions creation is encapsulated by LAC api .

Now try to extend this example and have fun. :-)
Please do not hesitate to contact us for any questions

Project Download: http://www.lac.inf.puc-rio.br/dokuwiki/ARFF.rar

GroupDefinerSelector.java
@Override
  public Set<Integer> processProhibitedGroups(lac.cnet.sddl.objects.Message nodeMessage) {
    Object applicationObject = Serialization.fromJavaByteStream(nodeMessage.getContent());
 
    listRegion = getRegions();
 
    Set<Integer> groups = new HashSet<Integer>();
 
    if (applicationObject instanceof Vehicle) {
      Vehicle vehicle = (Vehicle) applicationObject;
      try {
        for (Region region : listRegion) {
          if (region.isVehicleInMacroRegion(vehicle)) {
            groups.add(region.getId());
            prohibitedGroups.add(region.getId());
          }
        }
      }
      catch (Exception e) {
        e.printStackTrace();
      }
    }
    return groups;
  }
dump.sql
CREATE DATABASE  IF NOT EXISTS `arffdb` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `arffdb`;
-- MySQL dump 10.13  Distrib 5.6.12, for Win64 (x86_64)
--
-- Host: localhost    Database: arffdb
-- ------------------------------------------------------
-- Server version	5.6.12
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
 
--
-- Table structure for table `tb_coordinate`
--
 
DROP TABLE IF EXISTS `tb_coordinate`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_coordinate` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `region_id` INT(11) NOT NULL,
  `latitude` DOUBLE NOT NULL,
  `longitude` DOUBLE NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_tb_coordinate_tb_region_idx` (`region_id`),
  CONSTRAINT `fk_tb_coordinate_tb_region` FOREIGN KEY (`region_id`) REFERENCES `tb_region` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
 
--
-- Dumping data for table `tb_coordinate`
--
 
LOCK TABLES `tb_coordinate` WRITE;
/*!40000 ALTER TABLE `tb_coordinate` DISABLE KEYS */;
INSERT INTO `tb_coordinate` (`id`, `region_id`, `latitude`, `longitude`) VALUES (1,3,-22.878073096397944,-43.37127685546875),(2,3,-22.925512054125306,-43.376426696777344),(3,3,-22.92393102293397,-43.429298400878906),(4,3,-22.88945995932842,-43.44715118408203),(5,3,-22.836313097991482,-43.42723846435547),(6,3,-22.878073096397944,-43.37127685546875),(7,4,-22.748955329085454,-43.275146484375),(8,4,-22.808465975108554,-43.309478759765625),(9,4,-22.776181505086505,-43.40629577636719),(10,4,-22.748955329085454,-43.275146484375);
/*!40000 ALTER TABLE `tb_coordinate` ENABLE KEYS */;
UNLOCK TABLES;
 
--
-- Table structure for table `tb_region`
--
 
DROP TABLE IF EXISTS `tb_region`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_region` (
  `id` INT(11) NOT NULL,
  `description` VARCHAR(150) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
 
--
-- Dumping data for table `tb_region`
--
 
LOCK TABLES `tb_region` WRITE;
/*!40000 ALTER TABLE `tb_region` DISABLE KEYS */;
INSERT INTO `tb_region` (`id`, `description`) VALUES (3,'Região A'),(4,'Região B');
/*!40000 ALTER TABLE `tb_region` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
-- Dump completed on 2013-11-29 15:00:52
  • arff.txt
  • Last modified: 2017/07/21 03:08
  • (external edit)