Skip to content

Latest commit

 

History

History
140 lines (122 loc) · 5.49 KB

File metadata and controls

140 lines (122 loc) · 5.49 KB

Labs 0 - Introduction

Goal

  • Who is who
  • Get familiar with course plan and rules
  • Propose changes in course plan (if any)
  • Configure Git
  • Configure Maven

Realization

Course plan

  1. Java threads
  • Introduction, threads creation
  • Data synchronization, critical sections
  • Concurrent collections, advanced mechanisms
  1. Java Messaging System (JMS)
  • JMS Message
  • Topic/Queue
  • Spring and JMS
  • Transactions
  1. REST services as communication for MicroServices
  • Expose REST API
  • Consume REST API
  1. Actor model in Akka
  2. In-memory data grid - Hazelcast

Course rules

There will be a project to implement at home after each section. There will be two weeks to implement the project. Final grade will be the mean of all grades.

There will be possibility to gain additional points (positive or negative) for being active or distracting during labs.

Presence will be verified. Student can miss two labs without giving a reason. However, he/she might be asked by tutor to deliver exercises that were solved on labs during his absence.

Students should work individually, however cooperation during labs is allowed and even desired. At the end of particular lab all students should have all exercises implemented.

Git How-To

Git is a distributed revision control and source code management system. It allows multiple users to work simultaneously on the same project. In contrast to client-server systems (like CVS, SVN) every Git working directory is a full-fledged repository with complete history.

GitHub is a web-based hosting service for Git repositories.

GitBash is a command line client for Git available on Windows.

  1. Go to https://github.com/ and create account
  2. Set up Git on your workstation using GitBash
  • Get familiar with instructions at https://help.github.com/articles/set-up-git
  • Set your full name using command git config --global user.name "YOUR NAME"
  • Set your email address using command git config --global user.email "YOUR EMAIL ADDRESS"
  1. Fork main repository https://github.com/bsodzik/distributed-java-intro
  1. Prepare your workstation
  • Clone forked repository using command git clone https://github.com/<your_login>/distributed-java-intro.git
  • Add upstream repository with git remote add upstream https://github.com/bsodzik/distributed-java-intro.git
  1. Synchronize your fork with main repository
  1. Get familiar with basic Git commands http://git-scm.com/docs
  • git clone - clone repository
  • git status - check status of your project
  • git pull - fetch changes from remote repository and merge them with your local repository (equivalent to git fetch plus git merge)
  • git add - add untracked files to commit
  • git commit -m "Your message" - commit tracked files to your local repository
  • git push origin master - push commits to remote repository
  1. Change README.md file (you may write some joke) and then commit your change to local repository and push it to remote repository
  2. After your change is pushed, create a Pull Request on GitHub so that tutor can see your work.

Maven How-To

  1. Maven is a
  • building tool
  • dependency management tool
  • documentation tool
  1. Installation
  • check installation: mvn --version
  1. Quick start
  • mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  • Archetype: In Maven, an archetype is a template of a project
  • groupId: This element indicates the unique identifier of the organization or group that created the project
  • artifactId: This element indicates the unique base name of the primary artifact being generated by this project.
  • Standard project structure
my-app
|-- pom.xml
`-- src
    |-- main
    |   `-- java
    |       `-- com
    |           `-- mycompany
    |               `-- app
    |                   `-- App.java
    `-- test
        `-- java
            `-- com
                `-- mycompany
                    `-- app
                        `-- AppTest.java
  1. POM
  • dependencies
<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.2</version>
      <scope>test</scope>
    </dependency>
</dependencies>
  1. Commands
  • mvn clean install
  1. Exercise: Add google guava
package com.mycompany.app;

import com.google.common.base.Function;

public class App {
    public static void main(String[] args) {
        System.out.println(HELLO_FUNCTION.apply("UAM"));
    }
    private final static Function<String, String> HELLO_FUNCTION = new Function<String, String>() {
        @Override
        public String apply(String name) {
            return "Hello " + name;
        }
    };
}
  1. Q&A

Feedback

http://goo.gl/forms/vM1rvczGaW