-
Notifications
You must be signed in to change notification settings - Fork 15
/
README.md.OLD
219 lines (140 loc) · 16 KB
/
README.md.OLD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
Sample Skeleton Projects
========================
[![Join the chat at https://gitter.im/MSaifAsif/sample-skeleton-projects](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/MSaifAsif/sample-skeleton-projects?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/MSaifAsif/sample-skeleton-projects.svg?branch=master)](https://travis-ci.org/MSaifAsif/sample-skeleton-projects)
These projects are basic and easy to execute implementations of some of the popularly used frameworks and libraries out in the market and can be used to jump start your coding time by simply forking these projects or using them as reference and then building your application on top of them. The implementations range from advanced MVC frameworks such as Struts to small testing libraries like JUnit or pyUnit (python).
**Note:** Projects not listed in the index table below are either in development phase or in debug mode and are not be relied on yet.
**To detach module:** In order to use a submodule as an isolated project, use the following command on your terminal
```bash
[./~]$ curl -s -L https://raw.githubusercontent.com/MSaifAsif/sample-skeleton-projects/master/detachme.sh | bash -s <module_name> <target_directory>
```
and the required parameters as explained below
- module_name : The name of the module to extract, this should exactly match the directory name of original modules in the code base
- target_directory : Destination directory where to place the extracted out module
So e.g if you need to only work on `JPA` project, the command will look like
```bash
curl -s -L https://raw.githubusercontent.com/MSaifAsif/sample-skeleton-projects/master/detachme.sh | bash -s JPA /home/user
```
## <a name="list-index">List of implementation</a>
* [Struts(2.x)](#struts2skeleton)
* [Struts(1.x)](#struts1skeleton)
* [Jacoco Code coverage](#jacococoverage)
* [JBOSS REST-Easy service](#jboss-rest-service)
* [JSF](#jsf-skeleton)
* [Log4j logger](#log4j-logger)
* [Play skeleton](#play-skeleton)
* [Axis2 Webservice](#axis2-ws)
* [EJBs](#ejb-hw)
* [JPA (Hibernate)](#jpa-hibernate)
* [JSoup](#jsoup-html)
* [Spark](#spark-mvc)
* [Servlet (3.x)](#servlet30-mvc)
* [Applets](#applet-hw)
* [MapReduce](#mr-hw)
* [SpringBoot](#springboot-hw)
* [MongoDB](#mongo-hw)
* [JavaLite](#java-lite)
* [Apache Wickets](#wickets-mvc)
* [Dropwizard](#dropwizard-mvc)
* [Ebean](#ebean)
* [Pippo](#pippo)
* [How to contribute](#how-to-contrib)
## <a name="struts2skeleton">Struts(2.x)</a> [↑](#list-index)
**Language:** Java
**Description:** A blank runnable web project based on the struts2 MVC architecture. The project comprises of a sample action class that will return success and display the resulting view (jsp file). The project can be run on any application server. Basic configurations including struts and log4j are also added for reference
**How to run:** Import the project as a maven project, build the war file using maven and place the war in the tomcat webapps folder. Once deployment is complete by tomcat, the sample MVC can be viewed at the URL `http://localhost:8080/Struts2HelloWorld/sample/GreetAction`. Another added feature is the support for the Struts REST plugin to add support for rest based web services. A sample rest controller can be called at the URL `http://localhost:8080/Struts2HelloWorld/rest/employee.xml` which will return a list of all the users in xml format. For JSON based response, the same URL can be used by replacing the extension `.xml` with `.json`
## <a name="struts1skeleton">Struts(1.x)</a> [↑](#list-index)
**Language:** Java
**Description:** A blank runnable web project based on the struts (The struts1) MVC architecture. The project comprises of a sample action class that will return success and display the resulting view (jsp file). The project can be run on any application server. Basic configurations including struts and log4j are also added for reference
**How to run:** Import the project as a maven project, build the war file using maven and place the war in the tomcat webapps folder. Once deployment is complete by tomcat, the sample MVC can be viewed at the URL `http://localhost:8080/StrutsHelloWorld/helloWorld.action`
## <a name="jacococoverage">JaCoco code coverage</a> [↑](#list-index)
**Language:** Java
**Description:** A beginner level application implementing the jacoco maven plugin to cover code coverage of the JUNIT test cases within the application
**How to run:** Import the project as a maven project, run `mvn clean test` and jacoco will create a site project inside `{proj.dir}/target/site` with multiple files. Open the index.html in any browser and you can view and browse to the various classes and test cases and get a visual representation of the code coverage of the test cases written
## <a name="jboss-rest-service">JBOSS RESTEasy</a> [↑](#list-index)
**Language:** Java
**Description:** An entry level application implementing the RESTEasy service of JBOSS.
**How to run:** Import the project as a maven project, build the war file using maven and deploy this war in tomcat or Jboss application server. Once deployement is successful, you can view the service by opening any browser and navigate to the url `http://localhost:8080/RestEasyService/rest/greet/hello/Tenka`. For running integration tests, you can run the command `mvn verify`. Integration tests will be run using an embedded jetty server that is configured to be part of the maven build cycle.
## <a name="jsf-skeleton">JSF</a> [↑](#list-index)
**Language:** Java
**Description:** An entry level MVC application built using the JSF framework.
**How to run:** Import the project as a maven project, build the war file using maven and deploy this war in any JEE application server (Glassfish4 recommended). Once deployement is successful, you can view the landing page by opening any browser and navigate to the url `http://localhost:8080/JSFHelloWorld-0.0.1/welcome_page.xhtml`
## <a name="log4j-logger">Log4j</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation of how to create configure and use the logging capabilites provided by log4j.
**How to run:** Checkout the project to any directory and on the command prompt type `mvn clean test` and it will execute the test cases and a log will get printed on the console and the same log will be redirected to a log file namely `myApp.log` located at `${project_home}/logs`. The key point to understand is how to use the configuration file that is read by the log4j library. This file is located at `src/main/resources/log4j.properties`
## <a name="play-skeleton">Play MVC</a> [↑](#list-index)
**Language:** Java & Scala
**Description:** Basic implementation of creating an MVC application using the Play framework.
**How to run:** Perhaps the most easy to use/configure MVC framework out there. To run the application, you need to have Play installed and available on the classpath. Once installed, checkout the project, and while standing inside the directory of the `PlayHelloWorld`, run the command `play` and you will enter inside the play terminal. Next, just type in `run` and play will compile and deploy your application on an embedded jetty server and you can view your application using the url `http://localhost:9000` or `http://localhost:9000/HelloWorld` (routes have been set for both URLs)
## <a name="axis2-ws">Axis2 Webservice</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation of creating an XML SOAP web service using Axis2. Note that this is just a web service implementation, to consume the web service, use any web service client like SOAPUI or you can create your own.
**How to run:** To run the project, checkout and deploy the war on tomcat7 application server. The wsdl will be available at the URL `http://localhost:8080/AxisWebserviceHelloWorld/services/CalculatorService?wsdl`.
## <a name="ejb-hw">EJBs</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation of how to create, deploy and then retrieve a stateless session bean using the EJBs API via JNDI.
**How to run:** There are two parts on how to execute the project. First we need to build the project with `mvn clean install`. Next, copy the built war file into the deployements folder for the application server (project has been optimized and tested against wildfly8.2). Once deployed, now we need to retrieve this EJB via JNDI. For this, run the main method in the class `com.sample.client.StandAloneClient`. You can see the logs printed in the server logs.
## <a name="jpa-hibernate">JPA using Hibernate ORM</a> [↑](#list-index)
**Language:** Java
**Description:** Basic workflow of how to implement the Hibernate implementation of JPA. Hibernate is one of the powerfull, scalable, flexible and most used ORM framework used in the software industry. To understand the difference between JPA and Hibernate, the best possible description is the statement; "JPA is the dance and Hibernate is the dancer".
**How to run:** Checkout the project and execute the MainRunner class that is located inside the package `com.main`. The application uses HSQLDB(http://hsqldb.org/) for carrying out CRUD operations so no DB is required to run the program, although you can direct it to your Database by simply changing the `hibernate.connection.url` in `hibernate.cfg.xml`. This is the configuration file used by hibernate to connect to your DB.
## <a name="jsoup-html">Jsoup HTML parser</a> [↑](#list-index)
**Language:** Java
**Description:** A dummy implementation of the Jsoup library to parse html documents.
**How to run:** Checkout the project and execute the command `mvn clean test`. Basic parsing have been implemented as Junit cases. Also there is a main method in the class `com.sample.one.MainRunner` that shows how to parse and retreive information via Jsoup for a particualr Html page on the web
## <a name="spark-mvc">Spark MVC</a> [↑](#list-index)
**Language:** Java (JDK8)
**Description:** A skeleton implementation of an MVC application using the Spark framework. Another simple and easy to implement MVC framework that can be used to expose a set of REST calls quick and easy. Comes with an embedded server so no deployment is required.
**How to run:** Checkout the project and execute the command `mvn clean test`. Then simply run the main method located at `com.sampl.main.MainRunner` and the server will load up at `localhost:4567`. Navigate to the URL `localhost:4567/helloWorld` and you will see the logs in the console as well as a sample text being returned from the exposed method
## <a name="servlet30-mvc">Servlet/JSP (3.x)</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation of an MVC architecture based on raw Servlets and JSPs.
**How to run:** Checkout the project and execute the command `mvn clean install`. Deploy the generated war file in any application server (Tomcat 7) and then navigate to the page `http://localhost:8080/Servlet30HelloWorld/helloServlet` and you will be greeted with a message from a compiled JSP.
## <a name="applet-hw">Applets</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation of a java applet.
**How to run:** Checkout the project compile the class at the root of the project using the command `javac MyFirstApplet.java`. Once compiled, execute the command `appletviewer myapplet.html` and the default applet viewer application shipped with the JDK will load up and execute the applet.
## <a name="mr-hw">MapReduce</a> [↑](#list-index)
**Language:** Java (JDK7)
**Description:** A word count example of how MapReduce works. You need atleast a single node Hadoop cluster already setup before running this example.
**How to run:** Checkout the project and run `mvn clean install` to build the jar. Once jar is built, copy it to the Hadoop cluster and execute the command `hadoop jar MapReduceHelloWorld-0.0.1.jar com.sample.client.ClientRunner /test_data/a_sample_file.csv output`. The result of the word count will be written in the output directory on the configured HDFS.
## <a name="springboot-hw">SpringBoot</a> [↑](#list-index)
**Language:** Java (JDK8)
**Description:** Basic implementation of an MVC structure and web services using Spring Boot
**How to run:** Checkout the project and run `mvn spring-boot:run` to run the main method. Once ready, open the browser and navigate to the page `http://localhost:8080` and the greeting message will be printed on the screen. For parameter based web service, hit the url `http://localhost:8080/hello?name=John` and the paramter will be passed to the controller and greeting message for John will be printed on the browser.
## <a name="mongo-hw">MongoDB</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation crud operations on mongo via JAVA
**How to run:** Checkout the project and run `mvn clean test` to run the test cases. Application uses an embedded mongo instance that is initialized on runtime on a random port. All test cases are run on this mongo instance.
## <a name="java-lite">JavaLite</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation of the Javalite framework
**How to run:** Checkout the project and run `mvn process-classs` to first execute the instrumentation plugin. Next run `mvn clean test` and the `http` library will run some test cases where basic get and post requests are tested. To execute the `orm` part, first execute the sql script located at `src/main/resources/person_modes.sql` to create the table in a Mysql database. Afterwards, run the class `com.sample.orm.MainRunner` and the ORM will perform basic crud operations.
## <a name="wickets-mvc">Wickets</a> [↑](#list-index)
**Language:** Java
**Description:** Basic implementation of the Apache Wickets framework
**How to run:** Checkout the project and run `mvn clean install` to create the war file. Next, deploy this war to any application server of your choice and navigate to the url `http://localhost:8080/WicketHelloWorld` and you will see the greetings page rendered.
## <a name="dropwizard-mvc">Dropwizard</a> [↑](#list-index)
**Language:** Java
**Description:** Ready to use implementation of the Dropwizard framework
**How to run:** Checkout the project and run `mvn clean install` to create the jar file. To start the application
run the command `java -jar target/DropwizardHelloWorld-0.0.1.jar server src/main/resources/my-app.yml` and then
navigate to the url `http://localhost:8080/greet` and you will see the greetings JSON returned from the API.
## <a name="ebean">Ebean</a> [↑](#list-index)
**Language:** Java
**Description:** Ready to use implementation of Ebeans
**How to run:** Checkout the project and run `mvn clean install` to create the jar file. The application uses HSQLDB(http://hsqldb.org/) for carrying out CRUD operations so no DB is requiered to run the program. The test case `com.test.human.CrudTest` demonstrates basic usage.
## <a name="pippo">Pippo</a> [↑](#list-index)
**Language:** Java
**Description:** Ready to use implementation of the Pippo framework
**How to run:** Checkout the project and run the class `com.sample.pippo.Init`. The application will serve a HelloWorl message at `localhost:8338/`. Alternatively the application can also be depolyed to your favourite application server. Run `mvn clean install` to create the war file and deploy to tomcat e.g. `http://localhost:8080/Pippo-0.0.1/` will serve the same class.
## <a name="how-to-contrib">How to contribute</a> [↑](#list-index)
The project is open for contributions from everyone. If you want to contribute to the project, the best way is to
* Check the issues page to see if any pending issue is left and fixable
* Fork the repo
* Add documented and tested code
* Open a pull request to the master branch
* Once reviewed, the pull request will be merged
* README.md will contain information of runnable projects ONLY. All other projects are either in dev or testing phase and such projects are not to be relied on yet.
Its always best to open a issue and discuss its possibility before writing up the code. I am always open for suggestions. Feel free to contact me or contribute to the project.