diff --git a/EffectiveJavaExercises/src/StaticFactoryMethods.java b/EffectiveJavaExercises/src/StaticFactoryMethods.java
new file mode 100644
index 0000000..9ef3884
--- /dev/null
+++ b/EffectiveJavaExercises/src/StaticFactoryMethods.java
@@ -0,0 +1,9 @@
+import java.util.Collections;
+
+public class StaticFactoryMethods {
+
+ public static void main(String args[]){
+ Collections.emptyMap();
+ }
+
+}
diff --git a/README.md b/README.md
deleted file mode 100644
index 739c44e..0000000
--- a/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# SpringBootApplications
-
-After the application started, you are supposed to see file named 'UploadRepo' under 'C:' directory.
-This folder will be used to save the content of the uploaded files.
-
-src/main/resources/DownloadRepository: Download API will write the file content here.
-
-I used RestTemplate for client-side HTTP access. Run the Application.java as Spring Boot Application to run RestTemplate tests.
-
-Future enhancement:
-
-RestClientTest.java will be filled in to make the same tests in Application.java
-ScheduledCronJobs.java will be completed with the related business methods. Template and the annotations are ready.
diff --git a/SpringRESTExample/pom.xml b/SpringRESTExample/pom.xml
deleted file mode 100644
index dea964b..0000000
--- a/SpringRESTExample/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
- 4.0.0
-
- com.springboot.restapi
- SpringRESTExample
- 0.0.1-SNAPSHOT
- jar
-
- SpringRESTExample
- Demo project for Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.3.3.RELEASE
-
-
-
-
- UTF-8
- 1.8
- 3.6.8
-
-
-
-
-
- org.hsqldb
- hsqldb
- 2.4.0
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-starter-data-rest
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
-
- org.hsqldb
- hsqldb
- runtime
-
-
-
- com.mysema.querydsl
- querydsl-jpa
- ${querydsl.version}
-
-
- commons-lang
- commons-lang
- 2.6
-
-
- org.apache.commons
- commons-lang3
- 3.3.2
-
-
- org.springframework.boot
-
- spring-boot-starter-cloud-connectors
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- com.mysema.maven
- apt-maven-plugin
- 1.1.3
-
-
-
- process
-
-
- target/generated-sources/java
- com.mysema.query.apt.jpa.JPAAnnotationProcessor
-
-
-
-
-
- com.mysema.querydsl
- querydsl-apt
- ${querydsl.version}
-
-
-
-
-
-
-
-
diff --git a/SpringRESTExample/src/main/java/com/springboot/restapi/Application.java b/SpringRESTExample/src/main/java/com/springboot/restapi/Application.java
deleted file mode 100644
index 3497f0b..0000000
--- a/SpringRESTExample/src/main/java/com/springboot/restapi/Application.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.springboot.restapi;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.web.client.RestTemplate;
-
-@SpringBootApplication
-public class Application {
-
- public static void main(String[] args) {
- ApplicationContext context = SpringApplication.run(Application.class,
- args);
-
- /**
- * This method call will create a the folder "C://UploadRepo". This
- * folder will be used to save the content of uploaded files.
- */
- ((FileUploadUtil) context.getBean("fileUploadUtil"))
- .createUploadRepository();
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .getAllFiles());
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .uploadFile(
- "src/main/resources/UploadFromRepository/TextFile.txt",
- null, null));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .getAllFiles());
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .uploadFile(
- "src/main/resources/UploadFromRepository/TextFile.txt",
- "TextFile_1.txt", null));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .uploadFile(
- "src/main/resources/UploadFromRepository/TextFile.txt",
- "TextFile_2.txt", "Test"));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .uploadFile("C://FileRepo/TextFileee.txt", "TextFile_3.txt",
- "Test"));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .uploadFile("C://FileRepo///", "TextFile_4.txt", "Test"));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .uploadFile("C://FileRepo/TextFile.txt", "Text//File_5.txt",
- "Test"));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .getAllFiles());
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .getFileMetaDataById(1));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .getFileMetaDataById(null));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .getFileMetaDataById(100));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .downloadFile(1));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .downloadFile(null));
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .downloadFile(100));
-
- FileMetaDataSearchCriteria fileMetaDataSearchCriteria = new FileMetaDataSearchCriteria();
-
- fileMetaDataSearchCriteria.setName("File_1");
-
- System.out.println(((RESTClient) context.getBean("restClient"))
- .searchFiles(fileMetaDataSearchCriteria));
-
- }
-
- @Bean
- public RestTemplate getRestTemplate() {
- return new RestTemplate();
- }
-
-}
diff --git a/SpringRESTExample/src/main/java/com/springboot/restapi/FileController.java b/SpringRESTExample/src/main/java/com/springboot/restapi/FileController.java
deleted file mode 100644
index 692845d..0000000
--- a/SpringRESTExample/src/main/java/com/springboot/restapi/FileController.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package com.springboot.restapi;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.Collection;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-
-@RestController
-public class FileController {
-
- @Autowired
- private FileRepository repo;
-
- @Autowired
- private FileUploadUtil fileUploadUtil;
-
- @Autowired
- private FileMetaDataDao fileMetaDataDao;
-
- /**
- * This controller method is for fetching all uploaded files in the system
- *
- * @return
- */
- @RequestMapping(value = "/files", method = RequestMethod.GET)
- public ResponseEntity> getAllFiles() {
- List resultList = null;
- try {
- resultList = repo.findAll();
- } catch (Exception e) {
- return new ResponseEntity(
- "Exception: getAllFiles has failed.",
- HttpStatus.BAD_REQUEST);
- }
- return new ResponseEntity>(resultList,
- HttpStatus.OK);
- }
-
- /**
- * This controller method is for searching all uploaded files with a search
- * criteria
- *
- * @param searchCriteria
- * @return
- */
- @RequestMapping(value = "/searchFile", method = RequestMethod.POST)
- public List searchFiles(
- @RequestBody FileMetaDataSearchCriteria searchCriteria) {
- return fileMetaDataDao.searchFileMetaData(searchCriteria);
- }
-
- /**
- * This controller method is for finding a FileMetaData entity with the
- * given id
- *
- * @param id
- * @return
- */
- @RequestMapping(value = "/metadata/{id}", method = RequestMethod.GET)
- public ResponseEntity> getFileMetaData(@PathVariable Integer id) {
- FileMetaData fileMetaData = repo.findOne(id);
-
- if (fileMetaData != null) {
- try {
- Path path = Paths.get(fileMetaData.getPath());
- BasicFileAttributes attr = Files.readAttributes(path,
- BasicFileAttributes.class);
- if (attr != null) {
- fileMetaData.setLastUpdatedDate(fileUploadUtil
- .createLocalDateTimeFrom(attr.lastModifiedTime()));
- fileMetaData.setLastAccessDate(fileUploadUtil
- .createLocalDateTimeFrom(attr.lastAccessTime()));
- fileMetaData.setDirectory(attr.isDirectory());
- fileMetaData.setOther(attr.isOther());
- fileMetaData.setRegularFile(attr.isRegularFile());
- fileMetaData.setSymbolicLink(attr.isSymbolicLink());
- fileMetaData.setSize(attr.size());
- repo.saveAndFlush(fileMetaData);
-
- return new ResponseEntity(fileMetaData,
- HttpStatus.OK);
- }
-
- } catch (IOException e) {
- e.printStackTrace();
- return new ResponseEntity(
- "IOException: Get file meta-data process has failed.",
- HttpStatus.BAD_REQUEST);
- }
-
- catch (Exception e) {
- e.printStackTrace();
- return new ResponseEntity(
- "Exception: Request has failed.",
- HttpStatus.BAD_REQUEST);
- }
- }
-
- return new ResponseEntity("No FileMetaData found with id: "
- + id, HttpStatus.BAD_REQUEST);
- }
-
- /**
- * This controller method is for uploading the given file with the given
- * meta data information
- *
- * @param file
- * @param name
- * @param descr
- * @return
- */
- @RequestMapping(value = "/upload", method = RequestMethod.POST, consumes = "multipart/form-data")
- public ResponseEntity> uploadFile(
- @RequestParam("file") MultipartFile file,
- @RequestParam(value = "name", required = false) String name,
- @RequestParam(value = "descr", required = false) String descr) {
-
- if (file.isEmpty()) {
- return new ResponseEntity