# Teaching-HEIGVD-RES-2019-Labo-Java-IO
### About the 2019 version of this lab
We changed the project structure. In previous editions, there was a "test" project (with its own pom.xml), a "production" project (with its own pom.xml) and a top-level "build" project. This is what you will see in the webcasts. This year, we have moved to a single project, with production and test packages.
**Warning: do NOT change the code in the test packages**
### About previous versions of this lab
Before reading this documentation and diving into the code, you should watch [this webcast](https://www.youtube.com/watch?v=qgncWAUqcbY&index=1&list=PLfKkysTy70QYD00EqEabdwyDNTPwLcsFV), which shows a **demo** of the application that you will implement. Later on, you might also watch [this webcast](https://www.youtube.com/watch?v=v_ZpVgf0lGc&index=2&list=PLfKkysTy70QYD00EqEabdwyDNTPwLcsFV), which gives you some hints about the **code structure**.
If you watch carefully, you will see that in 2015, we were using a web service called [iheartquotes](http://www.iheartquotes.com/) to fetch dynamic text data. This service is now down, so this year we had to look for [a replacement](http://www.icndb.com/api/). We also had to adapt the code of the starter project a bit. You will see why and how when in the commented source code.
We also fixed an issue with previous versions of the lab. In the past, our specification was not correct when talking about **depth-first traversal**. Our unit tests specified a wrong behaviour. We have fixed them. For these reasons, there will be some differences in the console output, but nothing extraordinary.
![image](./diagrams/chuck.png)
### Introduction
The objective of this lab is to get familiar with the Java IO APIs and to interact with the file system. You will implement an application that performs the following tasks:
1. The user invokes the application on the **command line** and provides a numeric argument (*n*).
2. The application **uses a Web Service client** (which is provided to you) to fetch *n* **quotes** from the [Internet Chuck Norris Database](http://www.icndb.com/api/) online service.
3. The application stores the content of each quote in a **text file** (utf-8), on the local filesystem. It uses the *tags* associated to each quote to create a hierarchical structure of directories.
4. The application then **traverses the local file system** (depth-first) and applies a processing to each visited quote file.
5. The processing consists of 1) converting all characters to their **uppercase** value and 2) adding a **line number** (followed by a tab character) at the beginning of each line. This is achieved by combining sub-classes of the `FilterWriter` class.
If your application is fully implemented you should have the following result on your machine:
#### A. When building the application
```
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< ch.heigvd.res.io:lab-java-io >--------------------
[INFO] Building RES Lab Java IO 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
... (skipping some of the log output)
[INFO] Running ch.heigvd.res.labio.impl.explorers.DFSFileExplorerTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.15 s - in ch.heigvd.res.labio.impl.explorers.DFSFileExplorerTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 27, Failures: 0, Errors: 0, Skipped: 0
... (skipping some of the log output)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.497 s
[INFO] Finished at: 2019-03-04T08:12:55+01:00
[INFO] ------------------------------------------------------------------------
```
#### B. When running the application
```
$ java -jar Lab01App-code/target/Lab01App-code-1.0-SNAPSHOT-launcher.jar 10
INFO: Received a new joke with 4 tags.
INFO: > movie
INFO: > internet
INFO: > geek
INFO: > popular
INFO: Received a new joke with 4 tags.
INFO: > movie
INFO: > funny
INFO: > geek
INFO: > joke
INFO: Received a new joke with 2 tags.
INFO: > hilarious
INFO: > movie
INFO: Received a new joke with 1 tags.
INFO: > geek
INFO: Received a new joke with 7 tags.
INFO: > internet
INFO: > geek
INFO: > movie
INFO: > joke
INFO: > funny
INFO: > hilarious
INFO: > popular
INFO: Received a new joke with 0 tags.
INFO: Received a new joke with 1 tags.
INFO: > popular
INFO: Received a new joke with 0 tags.
INFO: Received a new joke with 1 tags.
INFO: > popular
INFO: Received a new joke with 2 tags.
INFO: > hilarious
INFO: > geek
INFO: ./workspace/quotes
./workspace/quotes/geek
./workspace/quotes/geek/quote-4.utf8
./workspace/quotes/hilarious
./workspace/quotes/hilarious/geek
./workspace/quotes/hilarious/geek/quote-10.utf8
./workspace/quotes/hilarious/movie
./workspace/quotes/hilarious/movie/quote-3.utf8
./workspace/quotes/internet
./workspace/quotes/internet/geek
./workspace/quotes/internet/geek/movie
./workspace/quotes/internet/geek/movie/joke
./workspace/quotes/internet/geek/movie/joke/funny
./workspace/quotes/internet/geek/movie/joke/funny/hilarious
./workspace/quotes/internet/geek/movie/joke/funny/hilarious/popular
./workspace/quotes/internet/geek/movie/joke/funny/hilarious/popular/quote-5.utf8
./workspace/quotes/movie
./workspace/quotes/movie/funny
./workspace/quotes/movie/funny/geek
./workspace/quotes/movie/funny/geek/joke
./workspace/quotes/movie/funny/geek/joke/quote-2.utf8
./workspace/quotes/movie/internet
./workspace/quotes/movie/internet/geek
./workspace/quotes/movie/internet/geek/popular
./workspace/quotes/movie/internet/geek/popular/quote-1.utf8
./workspace/quotes/popular
./workspace/quotes/popular/quote-7.utf8
./workspace/quotes/popular/quote-9.utf8
./workspace/quotes/quote-6.utf8
./workspace/quotes/quote-8.utf8
```
#### C. After running the application
```
$ find ./workspace
./workspace
./workspace/quotes
./workspace/quotes/geek
./workspace/quotes/geek/quote-4.utf8
./workspace/quotes/geek/quote-4.utf8.out
./workspace/quotes/hilarious
./workspace/quotes/hilarious/geek
./workspace/quotes/hilarious/geek/quote-10.utf8
./workspace/quotes/hilarious/geek/quote-10.utf8.out
./workspace/quotes/hilarious/movie
./workspace/quotes/hilarious/movie/quote-3.utf8
./workspace/quotes/hilarious/movie/quote-3.utf8.out
./workspace/quotes/internet
./workspace/quotes/internet/geek
./workspace/quotes/internet/geek/movie
./workspace/quotes/internet/geek/movie/joke
./workspace/quotes/internet/geek/movie/joke/funny
./workspace/quotes/internet/geek/movie/joke/funny/hilarious
./workspace/quotes/internet/geek/movie/joke/funny/hilarious/popular
./workspace/quotes/internet/geek/movie/joke/funny/hilarious/popular/quote-5.utf8
./workspace/quotes/internet/geek/movie/joke/funny/hilarious/popular/quote-5.utf8.out
./workspace/quotes/movie
./workspace/quotes/movie/funny
./workspace/quotes/movie/funny/geek
./workspace/quotes/movie/funny/geek/joke
./workspace/quotes/movie/funny/geek/joke/quote-2.utf8
./workspace/quotes/movie/funny/geek/joke/quote-2.utf8.out
./workspace/quotes/movie/internet
./workspace/quotes/movie/internet/geek
./workspace/quotes/movie/internet/geek/popular
./workspace/quotes/movie/internet/geek/popular/quote-1.utf8
./workspace/quotes/movie/internet/geek/popular/quote-1.utf8.out
./workspace/quotes/popular
./workspace/quotes/popular/quote-7.utf8
./workspace/quotes/popular/quote-7.utf8.out
./workspace/quotes/popular/quote-9.utf8
./workspace/quotes/popular/quote-9.utf8.out
./workspace/quotes/quote-6.utf8
./workspace/quotes/quote-6.utf8.out
./workspace/quotes/quote-8.utf8
./workspace/quotes/quote-8.utf8.out
```
You can then compare `quote-8.utf8` with `quote-8.utf8` to see the text received as input (from the web service) and the text produced as output (by your program).
### Tasks
Here is the proposed list of tasks to achieve the objectives:
1. Start by forking and cloning this repo (**mandatory!!**).
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。毕业设计、课程设计源码文件,已经过测试可以直接使用。
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计&课设-Java IO实验室(流上的文件系统、管道和过滤器模式).zip (29个子文件)
Teaching-HEIGVD-RES-2019-Labo-Java-IO-master
.travis.yml 174B
diagrams
chuck.png 470KB
diagrams.graffle
image6.tiff 156KB
data.plist 37KB
.gitignore 2KB
README.md 9KB
LabJavaIO
pom.xml 3KB
src
test
java
ch
heigvd
res
labio
impl
ApplicationTest.java 5KB
UtilsTest.java 2KB
explorers
DFSFileExplorerTest.java 3KB
filters
FileNumberingFilterWriterTest.java 5KB
UpperCaseFilterWriterTest.java 2KB
transformers
FileTransformerTest.java 1KB
CompleteFileTransformerTest.java 1KB
main
java
ch
heigvd
res
labio
interfaces
IFileExplorer.java 939B
IFileVisitor.java 683B
IApplication.java 1KB
quotes
TagsGenerator.java 1KB
SimpleObjectMapperProvider.java 1KB
QuoteClient.java 2KB
Quote.java 3KB
impl
Utils.java 2KB
Application.java 6KB
explorers
DFSFileExplorer.java 1KB
filters
UpperCaseFilterWriter.java 742B
FileNumberingFilterWriter.java 2KB
transformers
CompleteFileTransformer.java 828B
NoOpFileTransformer.java 476B
FileTransformer.java 2KB
共 29 条
- 1
资源评论
zy_zeros
- 粉丝: 953
- 资源: 320
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功